问:
how to remove eventhandler from bootstrap carousel indicator items
I am using bootstrap5 carousel, and I want to fire a custom event when the previous or next indicators are clicked.
I want to prevent the default bootstrap event from firing.   I have tried a bunch of different techniques, but with no success.

Does anyone know how to do this?

Mtia

答:
I found the solution in the end.  I was programatically placing bs-slide-to on the next and previous indicators, and this was causing the event handler to fire.
So, to stop the bootstrap event handler, remove the bs-slide-to and the bs-slide attributes from the next and previous indicators, and the event won't fire.
I removed that, and used a custom event handler and it works fine (I hope).</p>


来源: stackexchange

问:
Error on fetch data, function instead of value
Hi guys I am trying to fetch data using get, and I want the data to be displayed after  I click on the button, as a normal crud
I am new in programming if there is someone that can help me. I APPRECIATE THANKS
everything in my backend is ok, I try in postman and console.log is everything good. My problem is only in this part thanks</p>
```<code>
import { useState, useEffect } from "react";
import axios from "axios";

 function Usuarios() {
    const [users, setUsers] = useState([]);

     useEffect(()=> {
        const todosUsers = async () => {
            const res= await axios.get("/users");
            console.log(res)
            setUsers(res.data);
        }
        todosUsers()
    },[])

    return (
        <>
        <button onClick=
        {users.map((users) => (
            <h1>{users.username}</h1>
            ))}></button>
        </>

        )
}

export default Usuarios;

</code>```

答:
one solution would be to keep a seperate variable to see if button is clicked as S.Singh mentioned

  const [users, setUsers] = useState([]);
  const [clicked, setClicked] = useState(false);
```
<p>and in your component you can set the <code>clicked</code> variable to <code>true</code> on click</p>
``` return (
        <>
        <button onClick={() => setClicked(true)}></button> //setting clicked true onclick
        {clicked && users.map((users) => (  //only renders when click is true

{users.username}

         ))}
        </>

        )
```

if you want to hide and show alternatively on click just change the line to onClick={() => setClicked(!clicked)}

codesandbox demo

ContentLicense: CC BY-SA 4.0

Body:
Hi guys I am trying to fetch data using get, and I want the data to be displayed after  I click on the button, as a normal crud
I am new in programming if there is someone that can help me. I APPRECIATE THANKS
everything in my backend is ok, I try in postman and console.log is everything good. My problem is only in this part thanks

import { useState, useEffect } from "react";
import axios from "axios";

 function Usuarios() {
    const [users, setUsers] = useState([]);

     useEffect(()=> {
        const todosUsers = async () => {
            const res= await axios.get("/users");
            console.log(res)
            setUsers(res.data);
        }
        todosUsers()
    },[])

    return (
        <>
        <button onClick=
        {users.map((users) => (

{users.username}

            ))}></button>
        </>

        )
}

export default Usuarios;

Body:
one solution would be to keep a seperate variable to see if button is clicked as S.Singh mentioned

  const [users, setUsers] = useState([]);
  const [clicked, setClicked] = useState(false);

and in your component you can set the clicked variable to true on click

 return (
        <>
        <button onClick={() => setClicked(true)}></button> //setting clicked true onclick
        {clicked && users.map((users) => (  //only renders when click is true
            <h1>{users.username}</h1>
         ))}
        </>

        )

if you want to hide and show alternatively on click just change the line to onClick={() => setClicked(!clicked)}

codesandbox demo


问:
Weird keyboard behavior in my iOS app
Ok, so here's how my keyboard behaves:
There's a button which calls a method to send a textmessage, that works fine. If the user now sends the text everything's fine.
Now if (s)he taps cancel it switches back to my view (as it's supposed to do), but the keyboard won't show up. I already tried

```<code>- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
   [self dismissModalViewControllerAnimated:YES];
   [inputView becomeFirstResponder];
}
</code>```

since it didn't work I tried:

```<code>-(void)viewDidAppear:(BOOL)animated{
   [inputView becomeFirstResponder];
}
</code>```

but that won't work either. So how can I get my keyboard to show up?

EDIT: inputText is an UITextView.

答:
This might be related to sending YES in dismissModalViewControllerAnimated:. When animations are involved, statements generally don't remain synchronous. So, your call to [inputView becomeFirstResponder] must be executing before the modal dialog has been dismissed, resulting in an inconsistent state. This is the reason why the inputView does not take focus.

HTH,

Akshay

ContentLicense: CC BY-SA 3.0

Title: Weird keyboard behavior in my iOS app

Body:
Ok, so here's how my keyboard behaves:
There's a button which calls a method to send a textmessage, that works fine. If the user now sends the text everything's fine.
Now if (s)he taps cancel it switches back to my view (as it's supposed to do), but the keyboard won't show up. I already tried

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
   [self dismissModalViewControllerAnimated:YES];
   [inputView becomeFirstResponder];
}

since it didn't work I tried:

-(void)viewDidAppear:(BOOL)animated{
   [inputView becomeFirstResponder];
}

but that won't work either. So how can I get my keyboard to show up?

EDIT: inputText is an UITextView.


问:
Scp from Linux to Windows machine using jumphost
Below command is working, I am able to download file from jumphost to my current directory in Windows machine using .pub file

```<code>scp -r -i user_202201281017.pub user@jumphost_ip_address:/home/user/check-job-status.sh .
</code>```

As of now I am copying file to jumphost server using sftp, then doing scp to my Windows machine. I would like to bypass jumphost and want to use 2nd hop to transfer file to Windows machine like below command

```<code>scp -r -i user_202201281017.pub user@jumphost_ip_address,user@file_present_at_original_server:/home/user/check-job-status.sh .
</code>```

Error:

ssh: connect to host file_present_at_original_server port 22:
Connection timed out

答:
If you have OpenSSH 8.0 and newer, you can use -J (jump) switch:

```<code>scp -r -i user_202201281017.pub -J user@jumphost_ip_address user@file_present_at_original_server:/home/user/check-job-status.sh .
</code>```

With older version, but at least 7.3, use ProxyJump directive:

```<code>scp ... -o ProxyJump=user@jumphost_ip_address
</code>```

For more options, see Does OpenSSH support multihop login?

With Windows build of OpenSSH (Win32-OpenSSH), you need the latest version in any case, as earlier versions had broken jump host support. They fail with:

CreateProcessW failed error:2 posix_spawn: No such file or directory

Body:
Below command is working, I am able to download file from jumphost to my current directory in Windows machine using .pub file

scp -r -i user_202201281017.pub user@jumphost_ip_address:/home/user/check-job-status.sh .

As of now I am copying file to jumphost server using sftp, then doing scp to my Windows machine. I would like to bypass jumphost and want to use 2nd hop to transfer file to Windows machine like below command

scp -r -i user_202201281017.pub user@jumphost_ip_address,user@file_present_at_original_server:/home/user/check-job-status.sh .

Error:

ssh: connect to host file_present_at_original_server port 22:
Connection timed out

Body:
If you have OpenSSH 8.0 and newer, you can use -J (jump) switch:

scp -r -i user_202201281017.pub -J user@jumphost_ip_address user@file_present_at_original_server:/home/user/check-job-status.sh .

With older version, but at least 7.3, use ProxyJump directive:

scp ... -o ProxyJump=user@jumphost_ip_address

For more options, see Does OpenSSH support multihop login?

With Windows build of OpenSSH (Win32-OpenSSH), you need the latest version in any case, as earlier versions had broken jump host support. They fail with:

CreateProcessW failed error:2 posix_spawn: No such file or directory


问:
Vulkan Invalid attribAddress alignment for vertex attribute 0
I really do not understand what the validation error means. There is no alignment requirement for vertex shader attributes in VkPhysicalDeviceLimits.

Here is the full error:
[2022-02-07.20:42:38]: Validation Error: [ VUID-vkCmdDrawIndexed-None-02721 ] Object 0: handle = 0xfef35a00000000a0, type = VK_OBJECT_TYPE_BUFFER; Object 1: handle = 0xa56ac00000000d4, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0x24afafc5 | vkCmdDrawIndexed: Invalid attribAddress alignment for vertex attribute 0, VK_FORMAT_R32G32B32_SFLOAT,from of VkPipeline 0xa56ac00000000d4[] and vertex VkBuffer 0xfef35a00000000a0[]. The Vulkan spec states: For a given vertex buffer binding, any attribute data fetched must be entirely contained within the corresponding vertex buffer binding, as described in Vertex Input Description (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-vkCmdDrawIndexed-None-02721)

Here is my shader.

```<code>#version 450 core

layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec2 inTexCoord;

// Instancing Data
//layout (location = 3) in vec2 XYOffset;

layout (binding = 0) uniform View_Projection {
    mat4 u_View;
    mat4 u_Projection;
};

layout (binding = 1) uniform Model {
    mat4 u_Model;
    mat4 u_NormalModel; // transpose(inverse(u_Model))
};

layout (location = 0) out vec3 Normal;
layout (location = 1) out vec2 TexCoord;

void main() {
    Normal = mat3(u_NormalModel) * inNormal;
    TexCoord = inTexCoord;
    //vec4 InstancePosition = vec4(inPosition.xy + XYOffset, inPosition.z, 1.0);
    //gl_Position = u_Projection * u_View * u_Model * InstancePosition;
    gl_Position = u_Projection * u_View * u_Model * vec4(inPosition, 1.0);
}
</code>```

UPDATE 1:

```<code>struct VulkanPipelineVertexInput
{
    VkPipelineVertexInputStateCreateInfo createInfo;
    std::vector<VkVertexInputBindingDescription> binding_descriptions;
    std::vector<VkVertexInputAttributeDescription> attribute_descriptions;
    std::vector<VkVertexInputBindingDivisorDescriptionEXT> divisor_description;
    VkPipelineVertexInputDivisorStateCreateInfoEXT divisorCreateInfo;
};

static VulkanPipelineVertexInput Vulkan_Internal_PipelineState_InitalizeVertexInput(IPipelineLayout layout)
{
    VulkanPipelineVertexInput input_state;

    PipelineVertexInputDescription &input_description = layout->m_vertex_input_description;
    if(input_description.m_input_elements.size() > 0)
    {
        int lastBinding = -1;
        for(const auto& element : input_description.m_input_elements)
        {
            VkVertexInputAttributeDescription attribute;
            attribute.binding = element.m_binding_id;
            attribute.format = element.m_vk_format;
            attribute.location = element.m_location;
            attribute.offset = element.m_offset;
            input_state.attribute_descriptions.push_back(attribute);
            if(lastBinding != element.m_binding_id)
            {
                lastBinding = element.m_binding_id;
                VkVertexInputBindingDescription binding_description;
                binding_description.binding = element.m_binding_id;
                binding_description.inputRate = element.m_per_instance ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX;
                binding_description.stride = element.m_stride;
                if(element.m_per_instance)
                {
                    VkVertexInputBindingDivisorDescriptionEXT divisor_description;
                    divisor_description.binding = element.m_binding_id;
                    divisor_description.divisor = element.m_divisor_rate;
                    input_state.divisor_description.push_back(divisor_description);
                }
                input_state.binding_descriptions.push_back(binding_description);
            }
        }
    }

    input_state.createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
    input_state.createInfo.pNext = input_state.divisor_description.size() > 0 ? &input_state.divisorCreateInfo : nullptr;
    input_state.createInfo.flags = 0;
    input_state.createInfo.vertexBindingDescriptionCount = input_state.binding_descriptions.size();
    input_state.createInfo.pVertexBindingDescriptions = input_state.binding_descriptions.data();
    input_state.createInfo.vertexAttributeDescriptionCount = input_state.attribute_descriptions.size();
    input_state.createInfo.pVertexAttributeDescriptions = input_state.attribute_descriptions.data();
    return input_state;
}
</code>```

UPDATE 2:
This code does render, however some geometry is shifted.

Render Output

答:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/3733

I figured it out!!!!!!!!! I thought this was a driver bug.

I opened the program in RenderDoc and it showed that the vertex buffer had an offset of 1

The problem was setting the vkCmdSetVertexBuffers wrong. vkCmdSetVertexBuffers requires an array of VkDeviceSize[] pOffsets even if you don't use them. I made a typo, writing VkDeviceSize[1] pOffsets = {1} instead of VkDeviceSize[1] = {0}

Body:
I really do not understand what the validation error means. There is no alignment requirement for vertex shader attributes in VkPhysicalDeviceLimits.

Here is the full error:
[2022-02-07.20:42:38]: Validation Error: [ VUID-vkCmdDrawIndexed-None-02721 ] Object 0: handle = 0xfef35a00000000a0, type = VK_OBJECT_TYPE_BUFFER; Object 1: handle = 0xa56ac00000000d4, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0x24afafc5 | vkCmdDrawIndexed: Invalid attribAddress alignment for vertex attribute 0, VK_FORMAT_R32G32B32_SFLOAT,from of VkPipeline 0xa56ac00000000d4[] and vertex VkBuffer 0xfef35a00000000a0[]. The Vulkan spec states: For a given vertex buffer binding, any attribute data fetched must be entirely contained within the corresponding vertex buffer binding, as described in Vertex Input Description (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-vkCmdDrawIndexed-None-02721)

Here is my shader.

#version 450 core

layout (location = 0) in vec3 inPosition;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec2 inTexCoord;

// Instancing Data
//layout (location = 3) in vec2 XYOffset;

layout (binding = 0) uniform View_Projection {
    mat4 u_View;
    mat4 u_Projection;
};

layout (binding = 1) uniform Model {
    mat4 u_Model;
    mat4 u_NormalModel; // transpose(inverse(u_Model))
};

layout (location = 0) out vec3 Normal;
layout (location = 1) out vec2 TexCoord;

void main() {
    Normal = mat3(u_NormalModel) * inNormal;
    TexCoord = inTexCoord;
    //vec4 InstancePosition = vec4(inPosition.xy + XYOffset, inPosition.z, 1.0);
    //gl_Position = u_Projection * u_View * u_Model * InstancePosition;
    gl_Position = u_Projection * u_View * u_Model * vec4(inPosition, 1.0);
}

UPDATE 1:

struct VulkanPipelineVertexInput
{
    VkPipelineVertexInputStateCreateInfo createInfo;
    std::vector<VkVertexInputBindingDescription> binding_descriptions;
    std::vector<VkVertexInputAttributeDescription> attribute_descriptions;
    std::vector<VkVertexInputBindingDivisorDescriptionEXT> divisor_description;
    VkPipelineVertexInputDivisorStateCreateInfoEXT divisorCreateInfo;
};

static VulkanPipelineVertexInput Vulkan_Internal_PipelineState_InitalizeVertexInput(IPipelineLayout layout)
{
    VulkanPipelineVertexInput input_state;

    PipelineVertexInputDescription &input_description = layout->m_vertex_input_description;
    if(input_description.m_input_elements.size() > 0)
    {
        int lastBinding = -1;
        for(const auto& element : input_description.m_input_elements)
        {
            VkVertexInputAttributeDescription attribute;
            attribute.binding = element.m_binding_id;
            attribute.format = element.m_vk_format;
            attribute.location = element.m_location;
            attribute.offset = element.m_offset;
            input_state.attribute_descriptions.push_back(attribute);
            if(lastBinding != element.m_binding_id)
            {
                lastBinding = element.m_binding_id;
                VkVertexInputBindingDescription binding_description;
                binding_description.binding = element.m_binding_id;
                binding_description.inputRate = element.m_per_instance ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX;
                binding_description.stride = element.m_stride;
                if(element.m_per_instance)
                {
                    VkVertexInputBindingDivisorDescriptionEXT divisor_description;
                    divisor_description.binding = element.m_binding_id;
                    divisor_description.divisor = element.m_divisor_rate;
                    input_state.divisor_description.push_back(divisor_description);
                }
                input_state.binding_descriptions.push_back(binding_description);
            }
        }
    }

    input_state.createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
    input_state.createInfo.pNext = input_state.divisor_description.size() > 0 ? &input_state.divisorCreateInfo : nullptr;
    input_state.createInfo.flags = 0;
    input_state.createInfo.vertexBindingDescriptionCount = input_state.binding_descriptions.size();
    input_state.createInfo.pVertexBindingDescriptions = input_state.binding_descriptions.data();
    input_state.createInfo.vertexAttributeDescriptionCount = input_state.attribute_descriptions.size();
    input_state.createInfo.pVertexAttributeDescriptions = input_state.attribute_descriptions.data();
    return input_state;
}

UPDATE 2:
This code does render, however some geometry is shifted.

Render Output


问:
Which memory barriers are minimally needed for updating array elements with greater values?
What would be the minimally needed memory barriers in the following scenario?

Several threads update the elements of an array int a[n] in parallel.
All elements are initially set to zero.
Each thread computes a new value for each element; then,
it compares the computed new value to the existing value stored in the array,
and writes the new value only if it is greater than the stored value.
For example, if a thread computes for a[0] a new value 5, but
a[0] is already 10, then the thread should not update a[0].
But if the thread computes a new value 10, and a[0] is 5,
then the thread must update a[0].

The computation of the new values involves some shared read-only data;
it does not involve the array at all.

While the above-mentioned threads are running, no other thread accesses the array.
The array is consumed later, after all the threads are guaranteed to finish their updates.

The implementation uses a compare-and-swap loop, wrapping the elements
into atomic_ref (either from Boost or from C++20):

```<code>for (int k = 0; k != n; ++k) // For each element of the array
{
    // Locally in this thread, compute the new value for a[k].
    int new_value = ComputeTheNewValue(k);

    // Establish atomic access to a[k].
    atomic_ref<int> memory(a[k]);

    // [Barrier_0]: Read the existing value.
    int existing_value = memory.load(memory_order_relaxed);

    while (true) // The compare-and-swap loop.
    {
        // Overwrite only with higher values.
        if (new_value <= existing_value)
            break;

        // Need to update a[k] with the higher value "new_value", but
        // only if a[k] still stores the "existing_value".
        if (memory.compare_exchange_weak(existing_value, new_value,
                   /*Barrier_1*/         memory_order_relaxed,
                   /*Barrier_2*/         memory_order_relaxed))
        {
            // a[k] was still storing "existing_value", and it has been
            // successfully updated with the higher "new_value".
            // We're done, and we may exit the compare-and-swap loop.
            break;
        }
        else
        {
            // We get here in two cases:
            //  1. a[k] was found to store a value different from "existing_value", or
            //  2. the compare-and-swap operation has failed spuriously.
            // In the first case, the new value stored in a[k] has been loaded
            // by compare_exchange_weak() function into the "existing_value" variable.
            // Then, we need to compare the "new_value" produced by this thread
            // with the newly loaded "existing_value". This is achieved by simply continuing the loop.
            // The second case (the spurious failure) is also handled by continuing the loop,
            // although in that case the "new_value <= existing_value" comparison is redundant.
            continue;
        }
    }

}
</code>```

This code involves three memory barriers:

Barrier_0 in memory.load().

Barrier_1, to use in read-modify-write when compare_exchange_weak() succeeds.

Barrier_2, to use in load operation when compare_exchange_weak() fails.

In this scenario, is the code guaranteed to update only with higher values
when all three bariers are set to relaxed?
If not, what minimal barriers are needed to guarantee the corrrect behavior?

答:
Relaxed is fine, you don't need any ordering wrt. access to any other elements during the process of updating.  And for accesses to the same location, ISO C++ guarantees that a "modification order" exists for each location separately, and that even relaxed operations will only see the same or later values in the modification order of the location between loaded or RMWed.

You're just building an atomic fetch_max primitive out of a CAS retry loop.  Since the other writers are doing the same thing, the value of each location is monotonically increasing.  So it's totally safe to bail out any time you see a value greater than the new_value.

For the main thread to collect the results at the end, you do need release/acquire synchronization like thread.join or some kind of flag.  (e.g. maybe fetch_sub(1, release) of a counter of how many threads still have work left to do, or an array of done flags so you can just do a pure store.)

BTW, this seems likely to be slow, with lots of time spent waiting for cache lines to bounce between cores. (Lots of false-sharing.)  Ideally you you can efficiently change this to have each thread work on different parts of the array (e.g. computing multiple candidates for the same index so it doesn't need any atomic stuff).

I cannot guarantee that the computed indices do not overlap. In practice, the overlapping is usually small, but it cannot be eliminated.

So apparently that's a no.  And if the indices touched by different threads are in different cache lines (chunk of 16 int32_t) then there won't be too much false sharing.  (Also, if computation is expensive so you aren't producing values very fast, that's good so atomic updates aren't what your code is spending most of its time on.)

But if there is significant contention and the array isn't huge, you could give each thread its own output array, and collect the results at the end.  e.g. have one thread do a[i] = max(a[i], b[i], c[i], d[i]) for 4 to 8 arrays per loop.  (Not too many read streams at once, and not a variable number of inputs because that probably couldn't compile efficiently).  This should benefit from SIMD, e.g. SSE4.1 pmaxsd doing 4 parallel max operations, so this should be limited mostly by L3 cache bandwidth.

Or divide the max work between threads as a second parallel phase, with each thread doing the above over part of the output array.  Or have the thread_id % 4 == 0 reduce results from itself and the next 3 threads, so you have a tree of reductions if you have a system with many threads.

Body:
What would be the minimally needed memory barriers in the following scenario?

Several threads update the elements of an array int a[n] in parallel.
All elements are initially set to zero.
Each thread computes a new value for each element; then,
it compares the computed new value to the existing value stored in the array,
and writes the new value only if it is greater than the stored value.
For example, if a thread computes for a[0] a new value 5, but
a[0] is already 10, then the thread should not update a[0].
But if the thread computes a new value 10, and a[0] is 5,
then the thread must update a[0].

The computation of the new values involves some shared read-only data;
it does not involve the array at all.

While the above-mentioned threads are running, no other thread accesses the array.
The array is consumed later, after all the threads are guaranteed to finish their updates.

The implementation uses a compare-and-swap loop, wrapping the elements
into atomic_ref (either from Boost or from C++20):

for (int k = 0; k != n; ++k) // For each element of the array
{
    // Locally in this thread, compute the new value for a[k].
    int new_value = ComputeTheNewValue(k);

    // Establish atomic access to a[k].
    atomic_ref<int> memory(a[k]);

    // [Barrier_0]: Read the existing value.
    int existing_value = memory.load(memory_order_relaxed);

    while (true) // The compare-and-swap loop.
    {
        // Overwrite only with higher values.
        if (new_value <= existing_value)
            break;

        // Need to update a[k] with the higher value "new_value", but
        // only if a[k] still stores the "existing_value".
        if (memory.compare_exchange_weak(existing_value, new_value,
                   /*Barrier_1*/         memory_order_relaxed,
                   /*Barrier_2*/         memory_order_relaxed))
        {
            // a[k] was still storing "existing_value", and it has been
            // successfully updated with the higher "new_value".
            // We're done, and we may exit the compare-and-swap loop.
            break;
        }
        else
        {
            // We get here in two cases:
            //  1. a[k] was found to store a value different from "existing_value", or
            //  2. the compare-and-swap operation has failed spuriously.
            // In the first case, the new value stored in a[k] has been loaded
            // by compare_exchange_weak() function into the "existing_value" variable.
            // Then, we need to compare the "new_value" produced by this thread
            // with the newly loaded "existing_value". This is achieved by simply continuing the loop.
            // The second case (the spurious failure) is also handled by continuing the loop,
            // although in that case the "new_value <= existing_value" comparison is redundant.
            continue;
        }
    }

}

This code involves three memory barriers:

Barrier_0 in memory.load().

Barrier_1, to use in read-modify-write when compare_exchange_weak() succeeds.

Barrier_2, to use in load operation when compare_exchange_weak() fails.

In this scenario, is the code guaranteed to update only with higher values
when all three bariers are set to relaxed?
If not, what minimal barriers are needed to guarantee the corrrect behavior?


问:
Catch timeout with HttpException
We have an image upload page that will timeout if the user's upload is taking longer than 15 minutes.

We're catching the HttpException that occurs with a timeout. But how can we know that the exception occurred because of a timeout, so we can return a specific message?

Our code:

```<code>try
{
    // do stuff here
}
catch (HttpException ex)
{
    // What can we check to know if this is a timeout exception?
    // if (ex == TimeOutError)
    // {
    //      return "Took too long. Please upload a smaller image.";
    // }
    return "Error with image. Try again.";
}
catch (Exception ex)
{
    return "Error with image. Try again.";
}
</code>```

And what the timeout error looks like:

```<code>System.Web.HttpException (0x80004005): Request timed out.
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.GetMultipartContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.EnsureForm()
at System.Web.HttpRequest.get_Form()
at MyStore.upload.ProcessRequest(HttpContext context)

ex.ErrorCode=-2147467259
ex.GetHttpCode=500
ex.WebEventCode=0
</code>```

I'm hesitant to simply do an if statement that compares the error codes above.

HttpCode 500 seems to be a generic Internal Server Error code that could happen for more than just a timeout exception.

ErrorCode -2147467259 is something I'm unfamiliar with. If that number will remain constant for timeout errors, and will never occur with non-timeout exceptions, then I could do an if comparison on this number.

I'm thinking there has to be a simple way to know if the HttpException is a timeout exception, ala something like:

```<code>if (ex == TimeoutError) // what should this be?
</code>```

UPDATE:

I just now tried catching TimeoutException, like the following, but it still is only caught by the HttpException.

```<code>try
{
    // do stuff here
}
catch (TimeoutException ex)
{
    // Timeout doesn't get caught. Must be a different type of timeout.
    // So far, timeout is only caught by HttpException.
    return "Took too long. Please upload a smaller image.";
}
catch (HttpException ex)
{
    // What can we check to know if this is a timeout exception?
    // if (ex == TimeOutError)
    // {
    //      return "Took too long. Please upload a smaller image.";
    // }
    return "Error with image. Try again.";
}
catch (Exception ex)
{
    return "Error with image. Try again.";
}
</code>```

答:
You can catch a couple timeout conditions with:</p>
```<code>    bool IsTimeout(HttpException httpex)
    {

        switch ((HttpStatusCode)httpex.GetHttpCode())
        {
            case HttpStatusCode.RequestTimeout:    //408
            case HttpStatusCode.GatewayTimeout:   //504
                return true;
            default: return false;
        }
    }
</code>```

Title: Catch timeout with HttpException

Body:
We have an image upload page that will timeout if the user's upload is taking longer than 15 minutes.

We're catching the HttpException that occurs with a timeout. But how can we know that the exception occurred because of a timeout, so we can return a specific message?

Our code:

try
{
    // do stuff here
}
catch (HttpException ex)
{
    // What can we check to know if this is a timeout exception?
    // if (ex == TimeOutError)
    // {
    //      return "Took too long. Please upload a smaller image.";
    // }
    return "Error with image. Try again.";
}
catch (Exception ex)
{
    return "Error with image. Try again.";
}

And what the timeout error looks like:

System.Web.HttpException (0x80004005): Request timed out.
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.GetMultipartContent()
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.EnsureForm()
at System.Web.HttpRequest.get_Form()
at MyStore.upload.ProcessRequest(HttpContext context)

ex.ErrorCode=-2147467259
ex.GetHttpCode=500
ex.WebEventCode=0

I'm hesitant to simply do an if statement that compares the error codes above.

HttpCode 500 seems to be a generic Internal Server Error code that could happen for more than just a timeout exception.

ErrorCode -2147467259 is something I'm unfamiliar with. If that number will remain constant for timeout errors, and will never occur with non-timeout exceptions, then I could do an if comparison on this number.

I'm thinking there has to be a simple way to know if the HttpException is a timeout exception, ala something like:

if (ex == TimeoutError) // what should this be?

UPDATE:

I just now tried catching TimeoutException, like the following, but it still is only caught by the HttpException.

try
{
    // do stuff here
}
catch (TimeoutException ex)
{
    // Timeout doesn't get caught. Must be a different type of timeout.
    // So far, timeout is only caught by HttpException.
    return "Took too long. Please upload a smaller image.";
}
catch (HttpException ex)
{
    // What can we check to know if this is a timeout exception?
    // if (ex == TimeOutError)
    // {
    //      return "Took too long. Please upload a smaller image.";
    // }
    return "Error with image. Try again.";
}
catch (Exception ex)
{
    return "Error with image. Try again.";
}

Body:
You can catch a couple timeout conditions with:

    bool IsTimeout(HttpException httpex)
    {

        switch ((HttpStatusCode)httpex.GetHttpCode())
        {
            case HttpStatusCode.RequestTimeout:    //408
            case HttpStatusCode.GatewayTimeout:   //504
                return true;
            default: return false;
        }
    }


问:
Change CRLF to LF for all files in a PyCharm project
I want to change CRLF to LF for all files in a project that I have opened in PyCharm. I have updated project settings to use LF line separator from
"File -> Settings -> Editor -> Code Style" It does not change existing files without opening these.

Is there any way to change CRLF to LF for all existing files in PyCharm?

答:
Step 1

Select root node in project view

Step 2

Click File menu like the following:

Note: If there are many files the process seems stuck, don't worry, just wait.


问:
Should a internal C# app be compiled with business logic?
[background]

So, I've got a C# application that was written before I got here.  I'm not in the dev org, at this time, but I am the tech lead in my sub-group within the internet marketing org.  My responsibility is process automation, minimal desktop support, and custom apps that make our lives easier.

[/background]

[app details]

We've got an app that creates a custom database file from a list of URLs.  It was designed to have one input file, and two output files for the two applications that use these sort of db files.  The rule for the difference between the two output files is compiled into the code.

[/app details]

Should an internal C# app be compiled with business logic that can't be changed without it being re-built?

答: Sure, if you know that the utility will only be used within your organization and for a single purpose there is nothing wrong with mixing your business rules with the logic.  Over-designing (in this case making code reusable when it will never be reused) would not be an efficient use of resources.</p>

OwnerDisplayName: Sean Ochoa

ContentLicense: CC BY-SA 2.5

OwnerDisplayName: Adam Alexander


问:
100% width of input with customization
Can anyone have a solution (something like link or working example) for rounded corners input with width 100% and customizable right border of it.

Now I have this structure:

```<code>    <span class="rounded left-corner">
        <span class="rounded right-corner">
            <span class="rounded bg ">
                <input id="expoName" name="expoName" type="text" />
            </span>
        </span>
    </span>
</code>```

and this styles:

```<code>.rounded.left-corner {
    background: url('/resources/images/base/input-left-border.png') no-repeat;
    height: 31px;
    display: inline-block;
    margin: 15px 0px;
}

.rounded.bg {
    background: url('/resources/images/base/input-bg.png') repeat-x;
    height: 31px;
    display: inline-block;
    margin: 0 19px;
}

.rounded.right-corner {
    background: right url('/resources/images/base/input-right-border.png') no-repeat;
    height: 31px;
    display: inline-block;
}

.rounded input[type="text"] {
    height: 30px;
    outline: none;
    border: 0px;
    background-color: transparent;
    font-size: 18px;
    display: block;
}
</code>```

Where input-right-border.png and input-left-border.png are 19*31 images for borders and input-bg.png is 19*1 image. Images gas round corners and shadows.

So if I want to customize right border for datepicker for example I do:

```<code>.rounded.startDate .right-corner {
    background: right url('/resources/images/base/input-startdate-right-border.png') no-repeat;
}

.rounded.startDate .bg {
    margin-right: 33px;
}
</code>```

And if I set width of #expoName with absolute value all just fine. But now I want to 100% width of input field. So I try to find the other solution for this, but not succeded on it yet. So, any solutions or advice?

Here on stackoverflow I found this: http://jsfiddle.net/aP2Ju/3/ But this is not really what I want. Because of IE. You know -_-"

答:
You could try that jsfiddle ( http://jsfiddle.net/aP2Ju/3/ )

with css3 pie ( http://www.css3pie.com )

And see if that works for you.

Title: 100% width of input with customization

Body:
Can anyone have a solution (something like link or working example) for rounded corners input with width 100% and customizable right border of it.

Now I have this structure:

                <input id="expoName" name="expoName" type="text" />

and this styles:

.rounded.left-corner {
    background: url('/resources/images/base/input-left-border.png') no-repeat;
    height: 31px;
    display: inline-block;
    margin: 15px 0px;
}

.rounded.bg {
    background: url('/resources/images/base/input-bg.png') repeat-x;
    height: 31px;
    display: inline-block;
    margin: 0 19px;
}

.rounded.right-corner {
    background: right url('/resources/images/base/input-right-border.png') no-repeat;
    height: 31px;
    display: inline-block;
}

.rounded input[type="text"] {
    height: 30px;
    outline: none;
    border: 0px;
    background-color: transparent;
    font-size: 18px;
    display: block;
}

Where input-right-border.png and input-left-border.png are 19*31 images for borders and input-bg.png is 19*1 image. Images gas round corners and shadows.

So if I want to customize right border for datepicker for example I do:

.rounded.startDate .right-corner {
    background: right url('/resources/images/base/input-startdate-right-border.png') no-repeat;
}

.rounded.startDate .bg {
    margin-right: 33px;
}

And if I set width of #expoName with absolute value all just fine. But now I want to 100% width of input field. So I try to find the other solution for this, but not succeded on it yet. So, any solutions or advice?

Here on stackoverflow I found this: http://jsfiddle.net/aP2Ju/3/ But this is not really what I want. Because of IE. You know -_-"


问:
Docker standard_init_linux.go:228: exec user process caused: no such file or directory
Whenever I am trying to run the docker images, it is exiting in immediately.

```<code>CONTAINER ID   IMAGE                      COMMAND                CREATED          STATUS                      PORTS     NAMES
ae327a2bdba3   k8s-for-beginners:v0.0.1   "/k8s-for-beginners"   11 seconds ago   Exited (1) 10 seconds ago             focused_booth
</code>```

As per Container Logs

```<code>standard_init_linux.go:228: exec user process caused: no such file or directory
</code>```

I have created all the files in linux itself:

```<code>FROM alpine:3.10
COPY k8s-for-beginners /
CMD ["/k8s-for-beginners"]
</code>```

GO Code:

```<code>package main

import (
    "fmt"
    "log"
    "net/http"
)

func main() {
    http.HandleFunc("/", handler)
    log.Fatal(http.ListenAndServe("0.0.0.0:8080", nil))
}

func handler(w http.ResponseWriter, r *http.Request) {
    log.Printf("Ping from %s", r.RemoteAddr)
    fmt.Fprintln(w, "Hello Kubernetes Beginners!")
}
</code>```

This is the first exercise from THE KUBERNETES WORKSHOP book.

Commands I have used in this Process:

```<code>CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o k8s-for-beginners
sudo docker build -t k8s-for-beginners:v0.0.1 .
sudo docker run -p 8080:8080 -d k8s-for-beginners:v0.0.1
</code>```

Output of the command:

sudo docker run k8s-for-beginners:v0.0.1 ldd /k8s-for-beginners
```
```        /lib64/ld-linux-x86-64.so.2 (0x7f9ab5778000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f9ab5778000)
Error loading shared library libgo.so.16: No such file or directory (needed by /k8s-for-beginners)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /k8s-for-beginners)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /k8s-for-beginners)
Error relocating /k8s-for-beginners: crypto..z2frsa..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..import: symbol not found
Error relocating /k8s-for-beginners: log..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fmd5..import: symbol not found
Error relocating /k8s-for-beginners: crypto..import: symbol not found
Error relocating /k8s-for-beginners: bytes..import: symbol not found
Error relocating /k8s-for-beginners: fmt.Fprintln: symbol not found
Error relocating /k8s-for-beginners: crypto..z2felliptic..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..z2fpkix..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frand..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20poly1305..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcurve25519..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fidna..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2foserror..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fecdsa..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp.HandleFunc: symbol not found
Error relocating /k8s-for-beginners: io..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp2..z2fhpack..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fcipher..import: symbol not found
Error relocating /k8s-for-beginners: log.Fatal: symbol not found
Error relocating /k8s-for-beginners: math..z2fbig..import: symbol not found
Error relocating /k8s-for-beginners: runtime..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..import: symbol not found
Error relocating /k8s-for-beginners: hash..z2fcrc32..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp.ListenAndServe: symbol not found
Error relocating /k8s-for-beginners: context..import: symbol not found
Error relocating /k8s-for-beginners: fmt..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2ftls..import: symbol not found
Error relocating /k8s-for-beginners: errors..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2ftestlog..import: symbol not found
Error relocating /k8s-for-beginners: runtime.setIsCgo: symbol not found
Error relocating /k8s-for-beginners: runtime_m: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fhex..import: symbol not found
Error relocating /k8s-for-beginners: mime..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fbidi..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2freflectlite..import: symbol not found
Error relocating /k8s-for-beginners: compress..z2fgzip..import: symbol not found
Error relocating /k8s-for-beginners: sync..import: symbol not found
Error relocating /k8s-for-beginners: compress..z2fflate..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbinary..import: symbol not found
Error relocating /k8s-for-beginners: math..z2frand..import: symbol not found
Error relocating /k8s-for-beginners: runtime_cpuinit: symbol not found
Error relocating /k8s-for-beginners: internal..z2fpoll..import: symbol not found
Error relocating /k8s-for-beginners: mime..z2fmultipart..import: symbol not found
Error relocating /k8s-for-beginners: runtime.check: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha512..import: symbol not found
Error relocating /k8s-for-beginners: runtime.registerTypeDescriptors: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20..import: symbol not found
Error relocating /k8s-for-beginners: runtime.setmodinfo: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2ftransform..import: symbol not found
Error relocating /k8s-for-beginners: time..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbase64..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha256..import: symbol not found
Error relocating /k8s-for-beginners: __go_go: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpguts..import: symbol not found
Error relocating /k8s-for-beginners: path..z2ffilepath..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2fsecure..z2fbidirule..import: symbol not found
Error relocating /k8s-for-beginners: os..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpproxy..import: symbol not found
Error relocating /k8s-for-beginners: net..z2ftextproto..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fasn1..import: symbol not found
Error relocating /k8s-for-beginners: runtime.requireitab: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fdns..z2fdnsmessage..import: symbol not found
Error relocating /k8s-for-beginners: path..import: symbol not found
Error relocating /k8s-for-beginners: io..z2fioutil..import: symbol not found
Error relocating /k8s-for-beginners: sort..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fnorm..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2fcpu..import: symbol not found
Error relocating /k8s-for-beginners: runtime.ginit: symbol not found
Error relocating /k8s-for-beginners: runtime.osinit: symbol not found
Error relocating /k8s-for-beginners: runtime.schedinit: symbol not found
Error relocating /k8s-for-beginners: bufio..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2frandutil..import: symbol not found
Error relocating /k8s-for-beginners: runtime_mstart: symbol not found
Error relocating /k8s-for-beginners: net..import: symbol not found
Error relocating /k8s-for-beginners: strconv..import: symbol not found
Error relocating /k8s-for-beginners: runtime.args: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fsys..import: symbol not found
Error relocating /k8s-for-beginners: runtime.newobject: symbol not found
Error relocating /k8s-for-beginners: syscall..import: symbol not found
Error relocating /k8s-for-beginners: unicode..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2finternal..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fpem..import: symbol not found
Error relocating /k8s-for-beginners: _Unwind_Resume: symbol not found
Error relocating /k8s-for-beginners: reflect..import: symbol not found
Error relocating /k8s-for-beginners: mime..z2fquotedprintable..import: symbol not found
Error relocating /k8s-for-beginners: log.Printf: symbol not found
Error relocating /k8s-for-beginners: runtime.typedmemmove: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdsa..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha1..import: symbol not found
Error relocating /k8s-for-beginners: bufio..types: symbol not found
Error relocating /k8s-for-beginners: bytes..types: symbol not found
Error relocating /k8s-for-beginners: compress..z2fflate..types: symbol not found
Error relocating /k8s-for-beginners: compress..z2fgzip..types: symbol not found
Error relocating /k8s-for-beginners: context..types: symbol not found
Error relocating /k8s-for-beginners: crypto..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fcipher..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fecdsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2felliptic..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2frandutil..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fmd5..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frand..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha1..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha256..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha512..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2ftls..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..z2fpkix..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fasn1..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbase64..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbinary..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fhex..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fpem..types: symbol not found
Error relocating /k8s-for-beginners: errors..types: symbol not found
Error relocating /k8s-for-beginners: fmt..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20poly1305..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcurve25519..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fdns..z2fdnsmessage..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpguts..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpproxy..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp2..z2fhpack..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fidna..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2fsecure..z2fbidirule..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2ftransform..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fbidi..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fnorm..types: symbol not found
Error relocating /k8s-for-beginners: hash..z2fcrc32..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fcpu..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2foserror..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fpoll..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2freflectlite..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2ftestlog..types: symbol not found
Error relocating /k8s-for-beginners: io..types: symbol not found
Error relocating /k8s-for-beginners: io..z2fioutil..types: symbol not found
Error relocating /k8s-for-beginners: log..types: symbol not found
Error relocating /k8s-for-beginners: math..z2fbig..types: symbol not found
Error relocating /k8s-for-beginners: math..z2frand..types: symbol not found
Error relocating /k8s-for-beginners: mime..types: symbol not found
Error relocating /k8s-for-beginners: mime..z2fmultipart..types: symbol not found
Error relocating /k8s-for-beginners: mime..z2fquotedprintable..types: symbol not found
Error relocating /k8s-for-beginners: net..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2finternal..types: symbol not found
Error relocating /k8s-for-beginners: net..z2ftextproto..types: symbol not found
Error relocating /k8s-for-beginners: os..types: symbol not found
Error relocating /k8s-for-beginners: path..types: symbol not found
Error relocating /k8s-for-beginners: path..z2ffilepath..types: symbol not found
Error relocating /k8s-for-beginners: reflect..types: symbol not found
Error relocating /k8s-for-beginners: runtime..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fsys..types: symbol not found
Error relocating /k8s-for-beginners: sort..types: symbol not found
Error relocating /k8s-for-beginners: strconv..types: symbol not found
Error relocating /k8s-for-beginners: sync..types: symbol not found
Error relocating /k8s-for-beginners: syscall..types: symbol not found
Error relocating /k8s-for-beginners: time..types: symbol not found
Error relocating /k8s-for-beginners: unicode..types: symbol not found
Error relocating /k8s-for-beginners: container..z2flist..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2faes..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdes..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fed25519..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fed25519..z2finternal..z2fedwards25519..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fhmac..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frc4..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..z2fasn1..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fhkdf..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2finternal..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fpoly1305..types: symbol not found
Error relocating /k8s-for-beginners: hash..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fbytealg..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2ffmtsort..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fnettrace..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2frace..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsingleflight..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsyscall..z2fexecenv..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsyscall..z2funix..types: symbol not found
Error relocating /k8s-for-beginners: math..types: symbol not found
Error relocating /k8s-for-beginners: math..z2fbits..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2fhttptrace..types: symbol not found
Error relocating /k8s-for-beginners: net..z2furl..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fatomic..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fmath..types: symbol not found
Error relocating /k8s-for-beginners: strings..types: symbol not found
Error relocating /k8s-for-beginners: sync..z2fatomic..types: symbol not found
Error relocating /k8s-for-beginners: unicode..z2futf16..types: symbol not found
Error relocating /k8s-for-beginners: unicode..z2futf8..types: symbol not found
Error relocating /k8s-for-beginners: runtime.strequal..f: symbol not found
Error relocating /k8s-for-beginners: runtime.memequal64..f: symbol not found
Error relocating /k8s-for-beginners: type...1reflect.rtype: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Align: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Align: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.AssignableTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.AssignableTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Bits: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Bits: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ChanDir: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ChanDir: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Comparable: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Comparable: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ConvertibleTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ConvertibleTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Elem: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Elem: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Field: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Field: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldAlign: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldAlign: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByIndex: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByIndex: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByNameFunc: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByNameFunc: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Implements: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Implements: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.In: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.In: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.IsVariadic: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.IsVariadic: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Key: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Key: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Kind: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Kind: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Len: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Len: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Method: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Method: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.MethodByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.MethodByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Name: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Name: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumField: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumField: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumIn: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumIn: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumMethod: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumMethod: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumOut: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumOut: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Out: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Out: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.PkgPath: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.PkgPath: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Size: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Size: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.String: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.String: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.common: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.common: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.rawString: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.rawString: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.uncommon..stub: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.uncommon..stub: symbol not found
Error relocating /k8s-for-beginners: reflect..reflect.rtype..d: symbol not found
Error relocating /k8s-for-beginners: type...1net.IPAddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.Network: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.Network: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.String: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.String: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.family: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.family: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.isWildcard: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.isWildcard: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.sockaddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.sockaddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.toLocal: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.toLocal: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr..d: symbol not found
Error relocating /k8s-for-beginners: runtime.main: symbol not found
Error relocating /k8s-for-beginners: runtime_iscgo: symbol not found
Error relocating /k8s-for-beginners: runtime_isstarted: symbol not found
Error relocating /k8s-for-beginners: runtime_isarchive: symbol not found
Error relocating /k8s-for-beginners: __gcc_personality_v0: symbol not found
Error relocating /k8s-for-beginners: io.Writer..d: symbol not found
Error relocating /k8s-for-beginners: runtime.writeBarrier: symbol not found

```

答:
check your startup.sh file ending character LF not CRLF

enter image description here

Body:
Whenever I am trying to run the docker images, it is exiting in immediately.

CONTAINER ID   IMAGE                      COMMAND                CREATED          STATUS                      PORTS     NAMES
ae327a2bdba3   k8s-for-beginners:v0.0.1   "/k8s-for-beginners"   11 seconds ago   Exited (1) 10 seconds ago             focused_booth

As per Container Logs

standard_init_linux.go:228: exec user process caused: no such file or directory

I have created all the files in linux itself:

FROM alpine:3.10
COPY k8s-for-beginners /
CMD ["/k8s-for-beginners"]

GO Code:

package main

import (
    "fmt"
    "log"
    "net/http"
)

func main() {
    http.HandleFunc("/", handler)
    log.Fatal(http.ListenAndServe("0.0.0.0:8080", nil))
}

func handler(w http.ResponseWriter, r *http.Request) {
    log.Printf("Ping from %s", r.RemoteAddr)
    fmt.Fprintln(w, "Hello Kubernetes Beginners!")
}

This is the first exercise from THE KUBERNETES WORKSHOP book.

Commands I have used in this Process:

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o k8s-for-beginners
sudo docker build -t k8s-for-beginners:v0.0.1 .
sudo docker run -p 8080:8080 -d k8s-for-beginners:v0.0.1

Output of the command:

sudo docker run k8s-for-beginners:v0.0.1 ldd /k8s-for-beginners

        /lib64/ld-linux-x86-64.so.2 (0x7f9ab5778000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f9ab5778000)
Error loading shared library libgo.so.16: No such file or directory (needed by /k8s-for-beginners)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /k8s-for-beginners)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /k8s-for-beginners)
Error relocating /k8s-for-beginners: crypto..z2frsa..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..import: symbol not found
Error relocating /k8s-for-beginners: log..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fmd5..import: symbol not found
Error relocating /k8s-for-beginners: crypto..import: symbol not found
Error relocating /k8s-for-beginners: bytes..import: symbol not found
Error relocating /k8s-for-beginners: fmt.Fprintln: symbol not found
Error relocating /k8s-for-beginners: crypto..z2felliptic..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..z2fpkix..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frand..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20poly1305..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcurve25519..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fidna..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2foserror..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fecdsa..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp.HandleFunc: symbol not found
Error relocating /k8s-for-beginners: io..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp2..z2fhpack..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fcipher..import: symbol not found
Error relocating /k8s-for-beginners: log.Fatal: symbol not found
Error relocating /k8s-for-beginners: math..z2fbig..import: symbol not found
Error relocating /k8s-for-beginners: runtime..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..import: symbol not found
Error relocating /k8s-for-beginners: hash..z2fcrc32..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp.ListenAndServe: symbol not found
Error relocating /k8s-for-beginners: context..import: symbol not found
Error relocating /k8s-for-beginners: fmt..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2ftls..import: symbol not found
Error relocating /k8s-for-beginners: errors..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2ftestlog..import: symbol not found
Error relocating /k8s-for-beginners: runtime.setIsCgo: symbol not found
Error relocating /k8s-for-beginners: runtime_m: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fhex..import: symbol not found
Error relocating /k8s-for-beginners: mime..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fbidi..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2freflectlite..import: symbol not found
Error relocating /k8s-for-beginners: compress..z2fgzip..import: symbol not found
Error relocating /k8s-for-beginners: sync..import: symbol not found
Error relocating /k8s-for-beginners: compress..z2fflate..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbinary..import: symbol not found
Error relocating /k8s-for-beginners: math..z2frand..import: symbol not found
Error relocating /k8s-for-beginners: runtime_cpuinit: symbol not found
Error relocating /k8s-for-beginners: internal..z2fpoll..import: symbol not found
Error relocating /k8s-for-beginners: mime..z2fmultipart..import: symbol not found
Error relocating /k8s-for-beginners: runtime.check: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha512..import: symbol not found
Error relocating /k8s-for-beginners: runtime.registerTypeDescriptors: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20..import: symbol not found
Error relocating /k8s-for-beginners: runtime.setmodinfo: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2ftransform..import: symbol not found
Error relocating /k8s-for-beginners: time..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbase64..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha256..import: symbol not found
Error relocating /k8s-for-beginners: __go_go: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpguts..import: symbol not found
Error relocating /k8s-for-beginners: path..z2ffilepath..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2fsecure..z2fbidirule..import: symbol not found
Error relocating /k8s-for-beginners: os..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpproxy..import: symbol not found
Error relocating /k8s-for-beginners: net..z2ftextproto..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fasn1..import: symbol not found
Error relocating /k8s-for-beginners: runtime.requireitab: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fdns..z2fdnsmessage..import: symbol not found
Error relocating /k8s-for-beginners: path..import: symbol not found
Error relocating /k8s-for-beginners: io..z2fioutil..import: symbol not found
Error relocating /k8s-for-beginners: sort..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fnorm..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2fcpu..import: symbol not found
Error relocating /k8s-for-beginners: runtime.ginit: symbol not found
Error relocating /k8s-for-beginners: runtime.osinit: symbol not found
Error relocating /k8s-for-beginners: runtime.schedinit: symbol not found
Error relocating /k8s-for-beginners: bufio..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2frandutil..import: symbol not found
Error relocating /k8s-for-beginners: runtime_mstart: symbol not found
Error relocating /k8s-for-beginners: net..import: symbol not found
Error relocating /k8s-for-beginners: strconv..import: symbol not found
Error relocating /k8s-for-beginners: runtime.args: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fsys..import: symbol not found
Error relocating /k8s-for-beginners: runtime.newobject: symbol not found
Error relocating /k8s-for-beginners: syscall..import: symbol not found
Error relocating /k8s-for-beginners: unicode..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2finternal..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fpem..import: symbol not found
Error relocating /k8s-for-beginners: _Unwind_Resume: symbol not found
Error relocating /k8s-for-beginners: reflect..import: symbol not found
Error relocating /k8s-for-beginners: mime..z2fquotedprintable..import: symbol not found
Error relocating /k8s-for-beginners: log.Printf: symbol not found
Error relocating /k8s-for-beginners: runtime.typedmemmove: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdsa..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha1..import: symbol not found
Error relocating /k8s-for-beginners: bufio..types: symbol not found
Error relocating /k8s-for-beginners: bytes..types: symbol not found
Error relocating /k8s-for-beginners: compress..z2fflate..types: symbol not found
Error relocating /k8s-for-beginners: compress..z2fgzip..types: symbol not found
Error relocating /k8s-for-beginners: context..types: symbol not found
Error relocating /k8s-for-beginners: crypto..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fcipher..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fecdsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2felliptic..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2frandutil..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fmd5..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frand..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha1..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha256..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha512..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2ftls..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..z2fpkix..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fasn1..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbase64..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbinary..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fhex..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fpem..types: symbol not found
Error relocating /k8s-for-beginners: errors..types: symbol not found
Error relocating /k8s-for-beginners: fmt..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20poly1305..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcurve25519..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fdns..z2fdnsmessage..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpguts..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpproxy..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp2..z2fhpack..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fidna..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2fsecure..z2fbidirule..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2ftransform..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fbidi..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fnorm..types: symbol not found
Error relocating /k8s-for-beginners: hash..z2fcrc32..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fcpu..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2foserror..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fpoll..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2freflectlite..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2ftestlog..types: symbol not found
Error relocating /k8s-for-beginners: io..types: symbol not found
Error relocating /k8s-for-beginners: io..z2fioutil..types: symbol not found
Error relocating /k8s-for-beginners: log..types: symbol not found
Error relocating /k8s-for-beginners: math..z2fbig..types: symbol not found
Error relocating /k8s-for-beginners: math..z2frand..types: symbol not found
Error relocating /k8s-for-beginners: mime..types: symbol not found
Error relocating /k8s-for-beginners: mime..z2fmultipart..types: symbol not found
Error relocating /k8s-for-beginners: mime..z2fquotedprintable..types: symbol not found
Error relocating /k8s-for-beginners: net..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2finternal..types: symbol not found
Error relocating /k8s-for-beginners: net..z2ftextproto..types: symbol not found
Error relocating /k8s-for-beginners: os..types: symbol not found
Error relocating /k8s-for-beginners: path..types: symbol not found
Error relocating /k8s-for-beginners: path..z2ffilepath..types: symbol not found
Error relocating /k8s-for-beginners: reflect..types: symbol not found
Error relocating /k8s-for-beginners: runtime..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fsys..types: symbol not found
Error relocating /k8s-for-beginners: sort..types: symbol not found
Error relocating /k8s-for-beginners: strconv..types: symbol not found
Error relocating /k8s-for-beginners: sync..types: symbol not found
Error relocating /k8s-for-beginners: syscall..types: symbol not found
Error relocating /k8s-for-beginners: time..types: symbol not found
Error relocating /k8s-for-beginners: unicode..types: symbol not found
Error relocating /k8s-for-beginners: container..z2flist..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2faes..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdes..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fed25519..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fed25519..z2finternal..z2fedwards25519..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fhmac..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frc4..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..z2fasn1..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fhkdf..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2finternal..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fpoly1305..types: symbol not found
Error relocating /k8s-for-beginners: hash..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fbytealg..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2ffmtsort..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fnettrace..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2frace..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsingleflight..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsyscall..z2fexecenv..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsyscall..z2funix..types: symbol not found
Error relocating /k8s-for-beginners: math..types: symbol not found
Error relocating /k8s-for-beginners: math..z2fbits..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2fhttptrace..types: symbol not found
Error relocating /k8s-for-beginners: net..z2furl..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fatomic..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fmath..types: symbol not found
Error relocating /k8s-for-beginners: strings..types: symbol not found
Error relocating /k8s-for-beginners: sync..z2fatomic..types: symbol not found
Error relocating /k8s-for-beginners: unicode..z2futf16..types: symbol not found
Error relocating /k8s-for-beginners: unicode..z2futf8..types: symbol not found
Error relocating /k8s-for-beginners: runtime.strequal..f: symbol not found
Error relocating /k8s-for-beginners: runtime.memequal64..f: symbol not found
Error relocating /k8s-for-beginners: type...1reflect.rtype: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Align: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Align: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.AssignableTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.AssignableTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Bits: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Bits: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ChanDir: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ChanDir: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Comparable: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Comparable: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ConvertibleTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ConvertibleTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Elem: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Elem: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Field: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Field: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldAlign: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldAlign: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByIndex: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByIndex: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByNameFunc: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByNameFunc: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Implements: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Implements: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.In: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.In: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.IsVariadic: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.IsVariadic: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Key: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Key: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Kind: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Kind: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Len: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Len: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Method: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Method: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.MethodByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.MethodByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Name: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Name: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumField: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumField: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumIn: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumIn: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumMethod: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumMethod: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumOut: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumOut: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Out: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Out: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.PkgPath: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.PkgPath: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Size: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Size: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.String: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.String: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.common: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.common: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.rawString: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.rawString: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.uncommon..stub: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.uncommon..stub: symbol not found
Error relocating /k8s-for-beginners: reflect..reflect.rtype..d: symbol not found
Error relocating /k8s-for-beginners: type...1net.IPAddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.Network: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.Network: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.String: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.String: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.family: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.family: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.isWildcard: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.isWildcard: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.sockaddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.sockaddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.toLocal: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.toLocal: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr..d: symbol not found
Error relocating /k8s-for-beginners: runtime.main: symbol not found
Error relocating /k8s-for-beginners: runtime_iscgo: symbol not found
Error relocating /k8s-for-beginners: runtime_isstarted: symbol not found
Error relocating /k8s-for-beginners: runtime_isarchive: symbol not found
Error relocating /k8s-for-beginners: __gcc_personality_v0: symbol not found
Error relocating /k8s-for-beginners: io.Writer..d: symbol not found
Error relocating /k8s-for-beginners: runtime.writeBarrier: symbol not found


问:
Google Domains : create a custom domain based on a url path
I have a laravel projct deployed on a virtual machine on GCP and I need to create a subdomain for it based on its url , the url looks like this : 34.90.86.243/questions_bank/public/
but when I wanted to add the url to the data field on google domains I got confused on what type I should use to make this up to work.
see this image

so which type should I choose ? and if there is an other way to do it please tel me

答:
You cannot create subdomains based upon URL paths (/questions_bank/public/).

DNS servers manage subdomain resource records based upon IP addresses (A and AAAA) and CNAMES (which resolve to A and AAAA resource records.

If your goal is to create a subdomain questionsbank as in questionsbank.example.com from the IP address 34.90.86.243, create an A with the Host name questionsbank, Type A, TTL 86400, Value 34.90.86.243.

In your webserver (Apache, Nginx, etc.) you can use URL Rewrite to map subdomains to URL paths.


问:
C# HttpClient PostAsync 403 forbidden with SSL
since we switch to a server with SSL when i make a POST i always recieve a 403 forbidden error, but if i use WebClient it works fine, anyway i still want to make it work with HttpClient because i would have to change a lot of code and also there is a call that post a file using MultipartFormDataContent and i can´t do that with WebClient, in Webclient i have the option to POST data or Upload a file but i need to POST data and the file in one call.

here is a example of the HttpClient and the WebClient calls

HttpClient (403 forbidden error)

```<code> private async void Login_Click(object sender, RoutedEventArgs e)
    {
        Apic = CryptoEngine.DecryptAPI(Apic);
        if (API())
        {
            using (var content = new MultipartFormDataContent())
            {
                if (EmailText.Text.Contains("@") && EmailText.Text.Contains("."))
                {
                    content.Add(new StringContent(EmailText.Text), "\"email\"");
                }
                else
                {
                    content.Add(new StringContent(EmailText.Text), "\"username\"");
                }

                content.Add(new StringContent(PasswordText.Password), "\"password\"");
                using (var httpClient = new HttpClient())
                {
                    httpClient.DefaultRequestHeaders.Clear();
                    httpClient.DefaultRequestHeaders.Accept.ParseAdd("application/json");
                    httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36");
                    httpClient.DefaultRequestHeaders.Add("appName", "CloudMetaPrinter");
                    httpClient.DefaultRequestHeaders.Add("latitude", Apic.Latitude);
                    httpClient.DefaultRequestHeaders.Add("longitude", Apic.Longitude);
                    httpClient.DefaultRequestHeaders.Add("hostname", Apic.IP);
                    httpClient.DefaultRequestHeaders.Add("hostType", "PC");
                    var httpResponse = httpClient.PostAsync(url + "/" + api + "/auth/login", content);
                    responseContent = await httpResponse.Result.Content.ReadAsStringAsync();
                    Result result = JsonConvert.DeserializeObject<Result>(responseContent);
</code>```

WebClient (works fine)

```<code>private void Login_Click(object sender, RoutedEventArgs e)
    {
        Apic = CryptoEngine.DecryptAPI(Apic);
        if (API())
        {
            string data;
            if (EmailText.Text.Contains("@"))
            {
                data = JsonConvert.SerializeObject(new
                {
                    email = EmailText.Text,
                    password = PasswordText.Password
                });
            }
            else
            {
                data = JsonConvert.SerializeObject(new
                {
                    username = EmailText.Text,
                    password = PasswordText.Password
                });
            }
            using (var httpClient = new WebClient { UseDefaultCredentials = true })
            {
                httpClient.Headers.Add("appName", "CloudMetaPrinter");
                httpClient.Headers.Add("latitude", Apic.Latitude);
                httpClient.Headers.Add("longitude", Apic.Longitude);
                httpClient.Headers.Add("hostname", Apic.IP);
                httpClient.Headers.Add("hostType", "PC");
                httpClient.Headers.Add(HttpRequestHeader.ContentType, "application/json; charset=utf-8");
                var httpResponse = httpClient.UploadData(url + "/" + api + "/auth/login", "POST", Encoding.UTF8.GetBytes(data));
                var str = System.Text.Encoding.Default.GetString(httpResponse);
                Result result = JsonConvert.DeserializeObject<Result>(str);
</code>```

i tried to make changes in the header, UseDefaultCredentials = true, etc and nothing works.

Edit: im using .net core 3.0
Edit2: The GetAsync with HttpClient works fine, the problem is only with PostAsync.

Ok so i tried to compare with fiddler and change some thing so the httpclient call is more like the webclient but still im getting the 403
Left is WebClient and right is HttpClient
Compare image

答:
[Solution]
Add the below header section

Headers.Add("User-Agent: Other");

Body:
since we switch to a server with SSL when i make a POST i always recieve a 403 forbidden error, but if i use WebClient it works fine, anyway i still want to make it work with HttpClient because i would have to change a lot of code and also there is a call that post a file using MultipartFormDataContent and i can´t do that with WebClient, in Webclient i have the option to POST data or Upload a file but i need to POST data and the file in one call.

here is a example of the HttpClient and the WebClient calls

HttpClient (403 forbidden error)

 private async void Login_Click(object sender, RoutedEventArgs e)
    {
        Apic = CryptoEngine.DecryptAPI(Apic);
        if (API())
        {
            using (var content = new MultipartFormDataContent())
            {
                if (EmailText.Text.Contains("@") && EmailText.Text.Contains("."))
                {
                    content.Add(new StringContent(EmailText.Text), "\"email\"");
                }
                else
                {
                    content.Add(new StringContent(EmailText.Text), "\"username\"");
                }

                content.Add(new StringContent(PasswordText.Password), "\"password\"");
                using (var httpClient = new HttpClient())
                {
                    httpClient.DefaultRequestHeaders.Clear();
                    httpClient.DefaultRequestHeaders.Accept.ParseAdd("application/json");
                    httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36");
                    httpClient.DefaultRequestHeaders.Add("appName", "CloudMetaPrinter");
                    httpClient.DefaultRequestHeaders.Add("latitude", Apic.Latitude);
                    httpClient.DefaultRequestHeaders.Add("longitude", Apic.Longitude);
                    httpClient.DefaultRequestHeaders.Add("hostname", Apic.IP);
                    httpClient.DefaultRequestHeaders.Add("hostType", "PC");
                    var httpResponse = httpClient.PostAsync(url + "/" + api + "/auth/login", content);
                    responseContent = await httpResponse.Result.Content.ReadAsStringAsync();
                    Result result = JsonConvert.DeserializeObject<Result>(responseContent);

WebClient (works fine)

private void Login_Click(object sender, RoutedEventArgs e)
    {
        Apic = CryptoEngine.DecryptAPI(Apic);
        if (API())
        {
            string data;
            if (EmailText.Text.Contains("@"))
            {
                data = JsonConvert.SerializeObject(new
                {
                    email = EmailText.Text,
                    password = PasswordText.Password
                });
            }
            else
            {
                data = JsonConvert.SerializeObject(new
                {
                    username = EmailText.Text,
                    password = PasswordText.Password
                });
            }
            using (var httpClient = new WebClient { UseDefaultCredentials = true })
            {
                httpClient.Headers.Add("appName", "CloudMetaPrinter");
                httpClient.Headers.Add("latitude", Apic.Latitude);
                httpClient.Headers.Add("longitude", Apic.Longitude);
                httpClient.Headers.Add("hostname", Apic.IP);
                httpClient.Headers.Add("hostType", "PC");
                httpClient.Headers.Add(HttpRequestHeader.ContentType, "application/json; charset=utf-8");
                var httpResponse = httpClient.UploadData(url + "/" + api + "/auth/login", "POST", Encoding.UTF8.GetBytes(data));
                var str = System.Text.Encoding.Default.GetString(httpResponse);
                Result result = JsonConvert.DeserializeObject<Result>(str);

i tried to make changes in the header, UseDefaultCredentials = true, etc and nothing works.

Edit: im using .net core 3.0
Edit2: The GetAsync with HttpClient works fine, the problem is only with PostAsync.

Ok so i tried to compare with fiddler and change some thing so the httpclient call is more like the webclient but still im getting the 403
Left is WebClient and right is HttpClient
Compare image