问:
How to loop over string data type & iterate over it using javascript for displaying the data as list item in html?
I am learning JS by self kindly assist here I am trying to  iterate over the below data which is of type string & want to display it in  a html file as list items ,  I am able to get the whole data displayed the problem i am facing is  this data I need to display  as list items but with the current code it is coming all in a single list item

JS code below

data = Host Name: COMPUTERHOPE
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0 .10586 N / A Build 10586
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: Computerhope
Registered Organization: Computer Hope
Product ID: 00000 - 00000 - 00000 - AAAAA
Original Install Date: 12 / 17 / 2015, 7: 09: 50 PM
System Boot Time: 3 / 28 / 2016, 6: 57: 39 AM
System Manufacturer: Dell Inc.
System Model: XPS 8300
System Type: x64 - based PC
Processor(s): 1 Processor(s) Installed.
  [01]: Intel64 Family 6 Model 42 Stepping 7 Genuine Intel~3401 Mhz
BIOS Version: Dell Inc.A06, 10 / 17 / 2011
Windows Directory: C: \WINDOWS
System Directory: C: \WINDOWS\ system32
Boot Device: \Device\ HarddiskVolume1
System Locale: en - us;
English(United States)
Input Locale: en - us;
English(United States)
Time Zone: (UTC - 07: 00) Mountain Time(US & Canada)
Total Physical Memory: 8, 174 MB
Available Physical Memory: 2, 955 MB
Virtual Memory: Max Size: 16, 366 MB
Virtual Memory: Available: 6, 455 MB
Virtual Memory: In Use: 9, 911 MB
Page File Location(s): C: \pagefile.sys
Domain: WORKGROUP
Logon Server: \\MicrosoftAccount
Hotfix(s): 10 Hotfix(s) Installed.
  [01]: KB3116900[02]: KB3124200[03]: KB3124262[04]: KB3124263[05]: KB3135173[06]: KB3139907[07]: KB3140741[08]: KB3140743[09]: KB3140768[10]: KB3144756
Network Card(s): 2 NIC(s) Installed.
  [01]: DW1501 Wireless - N WLAN Half - Mini Card
Connection Name: Wi - Fi
Status: Media disconnected[02]: Broadcom NetLink(TM) Gigabit Ethernet
Connection Name: Ethernet
DHCP Enabled: Yes
DHCP Server: 192.168 .1 .1
IP address(es)[01]: 192.168 .1 .52[02]: fe00::b0b0: 0000: 0000: 0000
Hyper - V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes

 document.getElementById("one").innerText = data  # need assistance here```
</div>
</div>
</p>
<p><strong>Html code below</strong></p>
<pre class="lang-html prettyprint-override"><code><ol>
  <li id="one"></li>
</ol>
</code>```

答:
You are looking for something like this:

```<code>data.split("\n").forEach(e => { // split data string at line terminator (\n)
  const li = document.createElement("li"); // create entry
  li.innerText = e; // set text to row data
  list.appendChild(li); // append list item node to list
});
</code>```

See a small example below.

const data = `Host Name: COMPUTERHOPE\nOS Name: Microsoft Windows 10 Pro\nOS Version: 10.0 .10586 N / A Build 10586\nOS Manufacturer: Microsoft Corporation\nOS Configuration: Standalone Workstation\nOS Build Type: Multiprocessor Free\nRegistered Owner: Computerhope\nRegistered Organization: Computer Hope\nProduct ID: 00000 - 00000 - 00000 - AAAAA\nOriginal Install Date: 12 / 17 / 2015, 7: 09: 50 PM\nSystem Boot Time: 3 / 28 / 2016, 6: 57: 39 AM\nSystem Manufacturer: Dell Inc.\nSystem Model: XPS 8300\nSystem Type: x64 - based PC\nProcessor(s): 1 Processor(s) Installed.\n  [01]: Intel64 Family 6 Model 42 Stepping 7 Genuine Intel~3401 Mhz\nBIOS Version: Dell Inc.A06, 10 / 17 / 2011\nWindows Directory: C: WINDOWS\nSystem Directory: C: WINDOWS system32\nBoot Device: Device HarddiskVolume1\nSystem Locale: en - us;\nEnglish(United States)\nInput Locale: en - us;\nEnglish(United States)\nTime Zone: (UTC - 07: 00) Mountain Time(US & Canada)\nTotal Physical Memory: 8, 174 MB\nAvailable Physical Memory: 2, 955 MB\nVirtual Memory: Max Size: 16, 366 MB\nVirtual Memory: Available: 6, 455 MB\nVirtual Memory: In Use: 9, 911 MB\nPage File Location(s): C: pagefile.sys\nDomain: WORKGROUP\nLogon Server: \\MicrosoftAccount\nHotfix(s): 10 Hotfix(s) Installed.\n  [01]: KB3116900[02]: KB3124200[03]: KB3124262[04]: KB3124263[05]: KB3135173[06]: KB3139907[07]: KB3140741[08]: KB3140743[09]: KB3140768[10]: KB3144756\nNetwork Card(s): 2 NIC(s) Installed.\n  [01]: DW1501 Wireless - N WLAN Half - Mini Card\nConnection Name: Wi - Fi\nStatus: Media disconnected[02]: Broadcom NetLink(TM) Gigabit Ethernet\nConnection Name: Ethernet\nDHCP Enabled: Yes\nDHCP Server: 192.168 .1 .1\nIP address(es)[01]: 192.168 .1 .52[02]: fe00::b0b0: 0000: 0000: 0000\nHyper - V Requirements: VM Monitor Mode Extensions: Yes\nVirtualization Enabled In Firmware: Yes\nSecond Level Address Translation: Yes\nData Execution Prevention Available: Yes";`;

data.split("\n").forEach(e => {
  const li = document.createElement("li");
  li.innerText = e;
  list.appendChild(li);
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><ul id="list"></ul></code>```

Body:
I am learning JS by self kindly assist here I am trying to  iterate over the below data which is of type string & want to display it in  a html file as list items ,  I am able to get the whole data displayed the problem i am facing is  this data I need to display  as list items but with the current code it is coming all in a single list item

JS code below

data = Host Name: COMPUTERHOPE
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0 .10586 N / A Build 10586
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: Computerhope
Registered Organization: Computer Hope
Product ID: 00000 - 00000 - 00000 - AAAAA
Original Install Date: 12 / 17 / 2015, 7: 09: 50 PM
System Boot Time: 3 / 28 / 2016, 6: 57: 39 AM
System Manufacturer: Dell Inc.
System Model: XPS 8300
System Type: x64 - based PC
Processor(s): 1 Processor(s) Installed.
  [01]: Intel64 Family 6 Model 42 Stepping 7 Genuine Intel~3401 Mhz
BIOS Version: Dell Inc.A06, 10 / 17 / 2011
Windows Directory: C: \WINDOWS
System Directory: C: \WINDOWS\ system32
Boot Device: \Device\ HarddiskVolume1
System Locale: en - us;
English(United States)
Input Locale: en - us;
English(United States)
Time Zone: (UTC - 07: 00) Mountain Time(US & Canada)
Total Physical Memory: 8, 174 MB
Available Physical Memory: 2, 955 MB
Virtual Memory: Max Size: 16, 366 MB
Virtual Memory: Available: 6, 455 MB
Virtual Memory: In Use: 9, 911 MB
Page File Location(s): C: \pagefile.sys
Domain: WORKGROUP
Logon Server: \\MicrosoftAccount
Hotfix(s): 10 Hotfix(s) Installed.
  [01]: KB3116900[02]: KB3124200[03]: KB3124262[04]: KB3124263[05]: KB3135173[06]: KB3139907[07]: KB3140741[08]: KB3140743[09]: KB3140768[10]: KB3144756
Network Card(s): 2 NIC(s) Installed.
  [01]: DW1501 Wireless - N WLAN Half - Mini Card
Connection Name: Wi - Fi
Status: Media disconnected[02]: Broadcom NetLink(TM) Gigabit Ethernet
Connection Name: Ethernet
DHCP Enabled: Yes
DHCP Server: 192.168 .1 .1
IP address(es)[01]: 192.168 .1 .52[02]: fe00::b0b0: 0000: 0000: 0000
Hyper - V Requirements: VM Monitor Mode Extensions: Yes
Virtualization Enabled In Firmware: Yes
Second Level Address Translation: Yes
Data Execution Prevention Available: Yes

 document.getElementById("one").innerText = data  # need assistance here

Html code below

Body:
You are looking for something like this:

data.split("\n").forEach(e => { // split data string at line terminator (\n)
  const li = document.createElement("li"); // create entry
  li.innerText = e; // set text to row data
  list.appendChild(li); // append list item node to list
});

See a small example below.

const data = `Host Name: COMPUTERHOPE\nOS Name: Microsoft Windows 10 Pro\nOS Version: 10.0 .10586 N / A Build 10586\nOS Manufacturer: Microsoft Corporation\nOS Configuration: Standalone Workstation\nOS Build Type: Multiprocessor Free\nRegistered Owner: Computerhope\nRegistered Organization: Computer Hope\nProduct ID: 00000 - 00000 - 00000 - AAAAA\nOriginal Install Date: 12 / 17 / 2015, 7: 09: 50 PM\nSystem Boot Time: 3 / 28 / 2016, 6: 57: 39 AM\nSystem Manufacturer: Dell Inc.\nSystem Model: XPS 8300\nSystem Type: x64 - based PC\nProcessor(s): 1 Processor(s) Installed.\n  [01]: Intel64 Family 6 Model 42 Stepping 7 Genuine Intel~3401 Mhz\nBIOS Version: Dell Inc.A06, 10 / 17 / 2011\nWindows Directory: C: WINDOWS\nSystem Directory: C: WINDOWS system32\nBoot Device: Device HarddiskVolume1\nSystem Locale: en - us;\nEnglish(United States)\nInput Locale: en - us;\nEnglish(United States)\nTime Zone: (UTC - 07: 00) Mountain Time(US & Canada)\nTotal Physical Memory: 8, 174 MB\nAvailable Physical Memory: 2, 955 MB\nVirtual Memory: Max Size: 16, 366 MB\nVirtual Memory: Available: 6, 455 MB\nVirtual Memory: In Use: 9, 911 MB\nPage File Location(s): C: pagefile.sys\nDomain: WORKGROUP\nLogon Server: \\MicrosoftAccount\nHotfix(s): 10 Hotfix(s) Installed.\n  [01]: KB3116900[02]: KB3124200[03]: KB3124262[04]: KB3124263[05]: KB3135173[06]: KB3139907[07]: KB3140741[08]: KB3140743[09]: KB3140768[10]: KB3144756\nNetwork Card(s): 2 NIC(s) Installed.\n  [01]: DW1501 Wireless - N WLAN Half - Mini Card\nConnection Name: Wi - Fi\nStatus: Media disconnected[02]: Broadcom NetLink(TM) Gigabit Ethernet\nConnection Name: Ethernet\nDHCP Enabled: Yes\nDHCP Server: 192.168 .1 .1\nIP address(es)[01]: 192.168 .1 .52[02]: fe00::b0b0: 0000: 0000: 0000\nHyper - V Requirements: VM Monitor Mode Extensions: Yes\nVirtualization Enabled In Firmware: Yes\nSecond Level Address Translation: Yes\nData Execution Prevention Available: Yes";`;

data.split("\n").forEach(e => {
  const li = document.createElement("li");
  li.innerText = e;
  list.appendChild(li);
});

<ul id="list"></ul>


来源: stackexchange

问:
Axios forcing "any" type on response type
I am trying to fetch data with Axios in my typescript react project, and I set the response type in axios to be of my CartItemType, however axios forces the response type to be of CartItemType and any, which breaks my code. Why does it force the "any" type? How to get rid of it?

```<code>export type CartItemType = {
    id: number;
    category: string;
    description: string;
    image: string;
    price: number;
    title: string;
    amount: number;
};

const App = () => {
    const [data, setData] = useState<CartItemType[]>([]);
    const [loading, setLoading] = useState(true);

    useEffect(() => {
        axios.get<CartItemType[]>("https://fakestoreapi.com/products")
        .then(products => {
            setData(products);
            setLoading(false);
        })
    }, [])
</code>```

the error appears at the products argument in the then function. When I hover over the error it reads:
Argument of type 'AxiosResponse<CartItemType[], any>' is not assignable to parameter of type 'SetStateAction<CartItemType[]>'.
Type 'AxiosResponse<CartItemType[], any>' is not assignable to type '(prevState: CartItemType[]) => CartItemType[]'.
Type 'AxiosResponse<CartItemType[], any>' provides no match for the signature '(prevState: CartItemType[]): CartItemType[]'.ts(2345)

why is there this ",any" type?

答:
axios is returning response rather than the type itself, so it should be</p>
```<code>        axios.get<CartItemType[]>("https://fakestoreapi.com/products")
        .then(response=> {
            setData(response.data); // <-- response.data should be CartItemType[]
            setLoading(false);
        })
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to fetch data with Axios in my typescript react project, and I set the response type in axios to be of my CartItemType, however axios forces the response type to be of CartItemType and any, which breaks my code. Why does it force the "any" type? How to get rid of it?

export type CartItemType = {
    id: number;
    category: string;
    description: string;
    image: string;
    price: number;
    title: string;
    amount: number;
};

const App = () => {
    const [data, setData] = useState<CartItemType[]>([]);
    const [loading, setLoading] = useState(true);

    useEffect(() => {
        axios.get<CartItemType[]>("https://fakestoreapi.com/products")
        .then(products => {
            setData(products);
            setLoading(false);
        })
    }, [])

the error appears at the products argument in the then function. When I hover over the error it reads:
Argument of type 'AxiosResponse<CartItemType[], any>' is not assignable to parameter of type 'SetStateAction<CartItemType[]>'.
Type 'AxiosResponse<CartItemType[], any>' is not assignable to type '(prevState: CartItemType[]) => CartItemType[]'.
Type 'AxiosResponse<CartItemType[], any>' provides no match for the signature '(prevState: CartItemType[]): CartItemType[]'.ts(2345)

why is there this ",any" type?

Body:
axios is returning response rather than the type itself, so it should be

        axios.get<CartItemType[]>("https://fakestoreapi.com/products")
        .then(response=> {
            setData(response.data); // <-- response.data should be CartItemType[]
            setLoading(false);
        })


问:
Best way to accept multiple tcp clients?
I have a client/server infrastructure. At present they use a TcpClient and TcpListener to send a receive data between all the clients and server.

What I currently do is when data is received (on it's own thread), it is put in a queue for another thread to process in order to free the socket so it is ready and open to receive new data.

```<code>                // Enter the listening loop.
                while (true)
                {
                    Debug.WriteLine("Waiting for a connection... ");

                    // Perform a blocking call to accept requests.
                    using (client = server.AcceptTcpClient())
                    {
                        data = new List<byte>();

                        // Get a stream object for reading and writing
                        using (NetworkStream stream = client.GetStream())
                        {
                            // Loop to receive all the data sent by the client.
                            int length;

                            while ((length = stream.Read(bytes, 0, bytes.Length)) != 0)
                            {
                                var copy = new byte[length];
                                Array.Copy(bytes, 0, copy, 0, length);
                                data.AddRange(copy);
                            }
                        }
                    }

                    receivedQueue.Add(data);
                }
</code>```

However I wanted to find out if there is a better way to do this. For example if there are 10 clients and they all want to send data to the server at the same time, one will get through while all the others will fail.Or if one client has a slow connection and hogs the socket all other communication will halt.

Is there not some way to be able to receive data from all clients at the same time and add the received data in the queue for processing when it has finished downloading?

答:
So here is an answer that will get you started - which is more beginner level than my blog post.

.Net has an async pattern that revolves around a Begin* and End* call. For instance - BeginReceive and EndReceive. They nearly always have their non-async counterpart (in this case Receive); and achieve the exact same goal.

The most important thing to remember is that the socket ones do more than just make the call async - they expose something called IOCP (IO Completion Ports, Linux/Mono has these two but I forget the name) which is extremely important to use on a server; the crux of what IOCP does is that your application doesn't consume a thread while it waits for data.

How to Use The Begin/End Pattern

Every Begin* method will have exactly 2 more arguments in comparisson to it's non-async counterpart. The first is an AsyncCallback, the second is an object. What these two mean is, "here is a method to call when you are done" and "here is some data I need inside that method." The method that gets called always has the same signature, inside this method you call the End* counterpart to get what would have been the result if you had done it synchronously. So for example:

```<code>private void BeginReceiveBuffer()
{
   _socket.BeginReceive(buffer, 0, buffer.Length, BufferEndReceive, buffer);
}

private void EndReceiveBuffer(IAsyncResult state)
{
   var buffer = (byte[])state.AsyncState; // This is the last parameter.
   var length = _socket.EndReceive(state); // This is the return value of the method call.
   DataReceived(buffer, 0, length); // Do something with the data.
}
</code>```

What happens here is .Net starts waiting for data from the socket, as soon as it gets data it calls EndReceiveBuffer and passes through the 'custom data' (in this case buffer) to it via state.AsyncResult. When you call EndReceive it will give you back the length of the data that was received (or throw an exception if something failed).

Better Pattern for Sockets

This form will give you central error handling - it can be used anywhere where the async pattern wraps a stream-like 'thing' (e.g. TCP arrives in the order it was sent, so it could be seen as a Stream object).

```<code>private Socket _socket;
private ArraySegment<byte> _buffer;
public void StartReceive()
{
    ReceiveAsyncLoop(null);
}

// Note that this method is not guaranteed (in fact
// unlikely) to remain on a single thread across
// async invocations.
private void ReceiveAsyncLoop(IAsyncResult result)
{
    try
    {
        // This only gets called once - via StartReceive()
        if (result != null)
        {
            int numberOfBytesRead = _socket.EndReceive(result);
            if(numberOfBytesRead == 0)
            {
                OnDisconnected(null); // 'null' being the exception. The client disconnected normally in this case.
                return;
            }

            var newSegment = new ArraySegment<byte>(_buffer.Array, _buffer.Offset, numberOfBytesRead);
            // This method needs its own error handling. Don't let it throw exceptions unless you
            // want to disconnect the client.
            OnDataReceived(newSegment);
        }

        // Because of this method call, it's as though we are creating a 'while' loop.
        // However this is called an async loop, but you can see it the same way.
        _socket.BeginReceive(_buffer.Array, _buffer.Offset, _buffer.Count, SocketFlags.None, ReceiveAsyncLoop, null);
    }
    catch (Exception ex)
    {
        // Socket error handling here.
    }
}
</code>```

Accepting Multiple Connections

What you generally do is write a class that contains your socket etc. (as well as your async loop) and create one for each client. So for instance:

```<code>public class InboundConnection
{
    private Socket _socket;
    private ArraySegment<byte> _buffer;

    public InboundConnection(Socket clientSocket)
    {
        _socket = clientSocket;
        _buffer = new ArraySegment<byte>(new byte[4096], 0, 4096);
        StartReceive(); // Start the read async loop.
    }

    private void StartReceive() ...
    private void ReceiveAsyncLoop() ...
    private void OnDataReceived() ...
}
</code>```

Each client connection should be tracked by your server class (so that you can disconnect them cleanly when the server shuts down, as well as search/look them up).

ContentLicense: CC BY-SA 3.0

Body:
I have a client/server infrastructure. At present they use a TcpClient and TcpListener to send a receive data between all the clients and server.

What I currently do is when data is received (on it's own thread), it is put in a queue for another thread to process in order to free the socket so it is ready and open to receive new data.

                // Enter the listening loop.
                while (true)
                {
                    Debug.WriteLine("Waiting for a connection... ");

                    // Perform a blocking call to accept requests.
                    using (client = server.AcceptTcpClient())
                    {
                        data = new List<byte>();

                        // Get a stream object for reading and writing
                        using (NetworkStream stream = client.GetStream())
                        {
                            // Loop to receive all the data sent by the client.
                            int length;

                            while ((length = stream.Read(bytes, 0, bytes.Length)) != 0)
                            {
                                var copy = new byte[length];
                                Array.Copy(bytes, 0, copy, 0, length);
                                data.AddRange(copy);
                            }
                        }
                    }

                    receivedQueue.Add(data);
                }

However I wanted to find out if there is a better way to do this. For example if there are 10 clients and they all want to send data to the server at the same time, one will get through while all the others will fail.Or if one client has a slow connection and hogs the socket all other communication will halt.

Is there not some way to be able to receive data from all clients at the same time and add the received data in the queue for processing when it has finished downloading?

Body:
So here is an answer that will get you started - which is more beginner level than my blog post.

.Net has an async pattern that revolves around a Begin* and End* call. For instance - BeginReceive and EndReceive. They nearly always have their non-async counterpart (in this case Receive); and achieve the exact same goal.

The most important thing to remember is that the socket ones do more than just make the call async - they expose something called IOCP (IO Completion Ports, Linux/Mono has these two but I forget the name) which is extremely important to use on a server; the crux of what IOCP does is that your application doesn't consume a thread while it waits for data.

How to Use The Begin/End Pattern

Every Begin* method will have exactly 2 more arguments in comparisson to it's non-async counterpart. The first is an AsyncCallback, the second is an object. What these two mean is, "here is a method to call when you are done" and "here is some data I need inside that method." The method that gets called always has the same signature, inside this method you call the End* counterpart to get what would have been the result if you had done it synchronously. So for example:

private void BeginReceiveBuffer()
{
   _socket.BeginReceive(buffer, 0, buffer.Length, BufferEndReceive, buffer);
}

private void EndReceiveBuffer(IAsyncResult state)
{
   var buffer = (byte[])state.AsyncState; // This is the last parameter.
   var length = _socket.EndReceive(state); // This is the return value of the method call.
   DataReceived(buffer, 0, length); // Do something with the data.
}

What happens here is .Net starts waiting for data from the socket, as soon as it gets data it calls EndReceiveBuffer and passes through the 'custom data' (in this case buffer) to it via state.AsyncResult. When you call EndReceive it will give you back the length of the data that was received (or throw an exception if something failed).

Better Pattern for Sockets

This form will give you central error handling - it can be used anywhere where the async pattern wraps a stream-like 'thing' (e.g. TCP arrives in the order it was sent, so it could be seen as a Stream object).

private Socket _socket;
private ArraySegment<byte> _buffer;
public void StartReceive()
{
    ReceiveAsyncLoop(null);
}

// Note that this method is not guaranteed (in fact
// unlikely) to remain on a single thread across
// async invocations.
private void ReceiveAsyncLoop(IAsyncResult result)
{
    try
    {
        // This only gets called once - via StartReceive()
        if (result != null)
        {
            int numberOfBytesRead = _socket.EndReceive(result);
            if(numberOfBytesRead == 0)
            {
                OnDisconnected(null); // 'null' being the exception. The client disconnected normally in this case.
                return;
            }

            var newSegment = new ArraySegment<byte>(_buffer.Array, _buffer.Offset, numberOfBytesRead);
            // This method needs its own error handling. Don't let it throw exceptions unless you
            // want to disconnect the client.
            OnDataReceived(newSegment);
        }

        // Because of this method call, it's as though we are creating a 'while' loop.
        // However this is called an async loop, but you can see it the same way.
        _socket.BeginReceive(_buffer.Array, _buffer.Offset, _buffer.Count, SocketFlags.None, ReceiveAsyncLoop, null);
    }
    catch (Exception ex)
    {
        // Socket error handling here.
    }
}

Accepting Multiple Connections

What you generally do is write a class that contains your socket etc. (as well as your async loop) and create one for each client. So for instance:

public class InboundConnection
{
    private Socket _socket;
    private ArraySegment<byte> _buffer;

    public InboundConnection(Socket clientSocket)
    {
        _socket = clientSocket;
        _buffer = new ArraySegment<byte>(new byte[4096], 0, 4096);
        StartReceive(); // Start the read async loop.
    }

    private void StartReceive() ...
    private void ReceiveAsyncLoop() ...
    private void OnDataReceived() ...
}

Each client connection should be tracked by your server class (so that you can disconnect them cleanly when the server shuts down, as well as search/look them up).


问:
Geomesa: why stat method not worked?
My scheme

```<code>/geomesa-accumulo describe-schema -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
INFO  Describing attributes of feature 'SignalBuilder'
geo           | Point   (Spatio-temporally indexed) (Spatially indexed)
time          | Date    (Spatio-temporally indexed) (Attribute indexed)
cam           | String  (Attribute indexed) (Attribute indexed)
imei          | String
dir           | Double
alt           | Double
vlc           | Double
sl            | Integer
ds            | Integer
dir_y         | Double
poi_azimuth_x | Double
poi_azimuth_y | Double

User data:
  geomesa.attr.splits     | 4
  geomesa.feature.expiry  | time(30 days)
  geomesa.index.dtg       | time
  geomesa.indices         | z3:7:3:geo:time,z2:5:3:geo,attr:8:3:time,attr:8:3:cam,attr:8:3:cam:time
  geomesa.stats.enable    | true
  geomesa.table.partition | time
  geomesa.z.splits        | 4
  geomesa.z3.interval     | week
</code>```

When I try to get count by stat methods it retuns 11:

```<code>./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='9f471340-dd70-4eca-a8dc-14553a4e708a'"
Estimated count: 11
</code>```

but without cache:

```<code>./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='9f471340-dd70-4eca-a8dc-14553a4e708a'" --no-cache
INFO  Running stat query...
Count: 1436
</code>```

Why stats methods not worked properly and return only estimated value?

In redis it's all ok. The problem is only in accumulo.

** Question update:

I try to recalculate statistics

```<code> ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-analyze -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
INFO  Running stat analysis for feature type SignalBuilder...
INFO  Stats analyzed:
  Total features: 11527
  Bounds for geo: [ 37.598007, 55.736623, 38.661036, 56.9189592 ] cardinality: 10634
  Bounds for time: [ 2022-01-30T15:13:58.706Z to 2022-02-09T14:16:03.000Z ] cardinality: 3779
  Bounds for cam: [ 3fe961e1-91dd-4931-b82e-d04fcaf24c3e to f767f0fa-dac5-4571-aa47-1ea6bf6e2c82 ] cardinality: 6
INFO  Use 'stats-histogram', 'stats-top-k' or 'stats-count' commands for more details
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='9f471340-dd70-4eca-a8dc-14553a4e708a'"
Estimated count: 14
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='3fe961e1-91dd-4931-b82e-d04fcaf24c3e'"
Estimated count: 0
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='3fe961e1-91dd-4931-b82e-d04fcaf24c3e'" --no-cache
INFO  Running stat query...
Count: 2675
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-analyze -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
INFO  Running stat analysis for feature type SignalBuilder...
INFO  Stats analyzed:
  Total features: 11767
  Bounds for geo: [ 37.598007, 55.736623, 38.661036, 56.9189592 ] cardinality: 10942
  Bounds for time: [ 2022-01-30T15:13:58.706Z to 2022-02-09T14:17:41.000Z ] cardinality: 3841
  Bounds for cam: [ 3fe961e1-91dd-4931-b82e-d04fcaf24c3e to f767f0fa-dac5-4571-aa47-1ea6bf6e2c82 ] cardinality: 6
INFO  Use 'stats-histogram', 'stats-top-k' or 'stats-count' commands for more details
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "1=1"
Estimated count: Unknown
Re-run with --no-cache to get an exact count
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "1=1" --no-cache
INFO  Running stat query...
Count: 11872
</code>```

But it does not help (((. The geo-events continue to arrive to geomesa. But stats does not worked.

May by I'm not using stats-count properly. Stats-top-k shows gathered statistics.

```<code> ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam like '3fe961e1-91dd-4931-b82e-d04fcaf24c3e'"
Estimated count: 0
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-top-k -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
Top values for 'geo':
  unavailable
Top values for 'time':
  unavailable
Top values for 'cam':
  7c0cf8bc-e7e3-4023-8a00-a5f17bda3001 (2925)
  9f471340-dd70-4eca-a8dc-14553a4e708a (2924)
  f767f0fa-dac5-4571-aa47-1ea6bf6e2c82 (2922)
  bfe55ad1-5b0a-405d-9ca9-3bed6aca9313 (2921)
  3fe961e1-91dd-4931-b82e-d04fcaf24c3e (2920)
  5798a065-d51e-47a1-b04b-ab48df9f1324 (2)
Top values for 'imei':
  unavailable
Top values for 'dir':
  unavailable
Top values for 'alt':
  unavailable
Top values for 'vlc':
  unavailable
Top values for 'sl':
  unavailable
Top values for 'ds':
  unavailable
Top values for 'dir_y':
  unavailable
Top values for 'poi_azimuth_x':
  unavailable
Top values for 'poi_azimuth_y':
  unavailable
</code>```

Or maybe the reason was in accumulo. When I try to get data from accumulo table. It returns

```<code>root@accumulo> scan -t myNamespace.geomesa_SignalBuilder_z3_geo_time_v7_02717
2022-02-09 17:55:12,909 [commands.ShellPluginConfigurationCommand] ERROR: Error: Could not determine the type of file "hdfs://10.200.217.27:9000/accumulo/classpath/myNamespace/[^.].*.jar".
2022-02-09 17:55:12,909 [shell.Shell] ERROR: Could not load the specified formatter. Using the DefaultFormatter
2022-02-09 17:55:12,929 [commands.ShellPluginConfigurationCommand] ERROR: Error: Could not determine the type of file "hdfs://10.200.217.27:9000/accumulo/classpath/myNamespace/[^.].*.jar".
\x01\x0A\x9Dt\x19\x84\xEF\xDD\xAF "5798a065-d51e-47a1-b04b-ab48df9f1324-1643555638706 d: []    \x03\x00\x0C\x02\x00\x1E\x000\x008\x00\\\x00g\x00o\x00w\x00\x7F\x00\x83\x00\x87\x00\x87\x00\x87\x00\x87\x00\x00\x0E\x00\x01\x01@CT\x9C\xD3\xE0\xBDE@Lu\xA0t\x7F-\xDE\x00\x00\x01~\xAB\x8C\xCD\xB25798a065-d51e-47a1-b04b-ab48df9f132\xB43333333333\xB1@f@\x00\x00\x00\x00\x00?\xF3\xAE\x14z\xE1G\xAE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x01
\x01\x0A\x9Dt\x19\x84\xEF\xDD\xBD!\x065798a065-d51e-47a1-b04b-ab48df9f1324-1643555648706 d: []    \x03\x00\x0C\x02\x00\x1E\x000\x008\x00\\\x00g\x00o\x00w\x00\x7F\x00\x83\x00\x87\x00\x87\x00\x87\x00\x87\x00\x00\x0E\x00\x01\x01@CT\x9C\xD3\xE0\xBDE@Lu\xA0t\x7F-\xDE\x00\x00\x01~\xAB\x8C\xF4\xC25798a065-d51e-47a1-b04b-ab48df9f132\xB43333333333\xB1@f@\x00\x00\x00\x00\x00?\xF3\xAE\x14z\xE1G\xAE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x01
</code>```

答:
Stats are gathered during ingestion, but are only written on a "best effort" basis (for example, if your ingest dies, stats may not be written). There are also code paths that don't update stats, for example if you disable them via system property or if you ingest through a bulk map/reduce job. In your particular case, it's hard to say why your stats don't match your data without a detailed description of everything you did to ingest it. However, if you want to re-calculate the cached statistics, you can always run the stats-analyze CLI command.

If you can re-create the issue, please feel free to file a ticket in the GeoMesa JIRA with the steps to re-create.

Title: Geomesa: why stat method not worked?

Body:
My scheme

/geomesa-accumulo describe-schema -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
INFO  Describing attributes of feature 'SignalBuilder'
geo           | Point   (Spatio-temporally indexed) (Spatially indexed)
time          | Date    (Spatio-temporally indexed) (Attribute indexed)
cam           | String  (Attribute indexed) (Attribute indexed)
imei          | String
dir           | Double
alt           | Double
vlc           | Double
sl            | Integer
ds            | Integer
dir_y         | Double
poi_azimuth_x | Double
poi_azimuth_y | Double

User data:
  geomesa.attr.splits     | 4
  geomesa.feature.expiry  | time(30 days)
  geomesa.index.dtg       | time
  geomesa.indices         | z3:7:3:geo:time,z2:5:3:geo,attr:8:3:time,attr:8:3:cam,attr:8:3:cam:time
  geomesa.stats.enable    | true
  geomesa.table.partition | time
  geomesa.z.splits        | 4
  geomesa.z3.interval     | week

When I try to get count by stat methods it retuns 11:

./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='9f471340-dd70-4eca-a8dc-14553a4e708a'"
Estimated count: 11

but without cache:

./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='9f471340-dd70-4eca-a8dc-14553a4e708a'" --no-cache
INFO  Running stat query...
Count: 1436

Why stats methods not worked properly and return only estimated value?

In redis it's all ok. The problem is only in accumulo.

** Question update:

I try to recalculate statistics

 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-analyze -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
INFO  Running stat analysis for feature type SignalBuilder...
INFO  Stats analyzed:
  Total features: 11527
  Bounds for geo: [ 37.598007, 55.736623, 38.661036, 56.9189592 ] cardinality: 10634
  Bounds for time: [ 2022-01-30T15:13:58.706Z to 2022-02-09T14:16:03.000Z ] cardinality: 3779
  Bounds for cam: [ 3fe961e1-91dd-4931-b82e-d04fcaf24c3e to f767f0fa-dac5-4571-aa47-1ea6bf6e2c82 ] cardinality: 6
INFO  Use 'stats-histogram', 'stats-top-k' or 'stats-count' commands for more details
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='9f471340-dd70-4eca-a8dc-14553a4e708a'"
Estimated count: 14
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='3fe961e1-91dd-4931-b82e-d04fcaf24c3e'"
Estimated count: 0
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam='3fe961e1-91dd-4931-b82e-d04fcaf24c3e'" --no-cache
INFO  Running stat query...
Count: 2675
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-analyze -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
INFO  Running stat analysis for feature type SignalBuilder...
INFO  Stats analyzed:
  Total features: 11767
  Bounds for geo: [ 37.598007, 55.736623, 38.661036, 56.9189592 ] cardinality: 10942
  Bounds for time: [ 2022-01-30T15:13:58.706Z to 2022-02-09T14:17:41.000Z ] cardinality: 3841
  Bounds for cam: [ 3fe961e1-91dd-4931-b82e-d04fcaf24c3e to f767f0fa-dac5-4571-aa47-1ea6bf6e2c82 ] cardinality: 6
INFO  Use 'stats-histogram', 'stats-top-k' or 'stats-count' commands for more details
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "1=1"
Estimated count: Unknown
Re-run with --no-cache to get an exact count
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "1=1" --no-cache
INFO  Running stat query...
Count: 11872

But it does not help (((. The geo-events continue to arrive to geomesa. But stats does not worked.

May by I'm not using stats-count properly. Stats-top-k shows gathered statistics.

 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-count -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder -q "cam like '3fe961e1-91dd-4931-b82e-d04fcaf24c3e'"
Estimated count: 0
 ~/bin/geomesa-accumulo_2.12-3.2.2/bin  ./geomesa-accumulo stats-top-k -c myNamespace.geomesa -z 10.200.217.27 -i accumulo -u root -p qweasd123 -f SignalBuilder
Top values for 'geo':
  unavailable
Top values for 'time':
  unavailable
Top values for 'cam':
  7c0cf8bc-e7e3-4023-8a00-a5f17bda3001 (2925)
  9f471340-dd70-4eca-a8dc-14553a4e708a (2924)
  f767f0fa-dac5-4571-aa47-1ea6bf6e2c82 (2922)
  bfe55ad1-5b0a-405d-9ca9-3bed6aca9313 (2921)
  3fe961e1-91dd-4931-b82e-d04fcaf24c3e (2920)
  5798a065-d51e-47a1-b04b-ab48df9f1324 (2)
Top values for 'imei':
  unavailable
Top values for 'dir':
  unavailable
Top values for 'alt':
  unavailable
Top values for 'vlc':
  unavailable
Top values for 'sl':
  unavailable
Top values for 'ds':
  unavailable
Top values for 'dir_y':
  unavailable
Top values for 'poi_azimuth_x':
  unavailable
Top values for 'poi_azimuth_y':
  unavailable

Or maybe the reason was in accumulo. When I try to get data from accumulo table. It returns

root@accumulo> scan -t myNamespace.geomesa_SignalBuilder_z3_geo_time_v7_02717
2022-02-09 17:55:12,909 [commands.ShellPluginConfigurationCommand] ERROR: Error: Could not determine the type of file "hdfs://10.200.217.27:9000/accumulo/classpath/myNamespace/[^.].*.jar".
2022-02-09 17:55:12,909 [shell.Shell] ERROR: Could not load the specified formatter. Using the DefaultFormatter
2022-02-09 17:55:12,929 [commands.ShellPluginConfigurationCommand] ERROR: Error: Could not determine the type of file "hdfs://10.200.217.27:9000/accumulo/classpath/myNamespace/[^.].*.jar".
\x01\x0A\x9Dt\x19\x84\xEF\xDD\xAF "5798a065-d51e-47a1-b04b-ab48df9f1324-1643555638706 d: []    \x03\x00\x0C\x02\x00\x1E\x000\x008\x00\\\x00g\x00o\x00w\x00\x7F\x00\x83\x00\x87\x00\x87\x00\x87\x00\x87\x00\x00\x0E\x00\x01\x01@CT\x9C\xD3\xE0\xBDE@Lu\xA0t\x7F-\xDE\x00\x00\x01~\xAB\x8C\xCD\xB25798a065-d51e-47a1-b04b-ab48df9f132\xB43333333333\xB1@f@\x00\x00\x00\x00\x00?\xF3\xAE\x14z\xE1G\xAE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x01
\x01\x0A\x9Dt\x19\x84\xEF\xDD\xBD!\x065798a065-d51e-47a1-b04b-ab48df9f1324-1643555648706 d: []    \x03\x00\x0C\x02\x00\x1E\x000\x008\x00\\\x00g\x00o\x00w\x00\x7F\x00\x83\x00\x87\x00\x87\x00\x87\x00\x87\x00\x00\x0E\x00\x01\x01@CT\x9C\xD3\xE0\xBDE@Lu\xA0t\x7F-\xDE\x00\x00\x01~\xAB\x8C\xF4\xC25798a065-d51e-47a1-b04b-ab48df9f132\xB43333333333\xB1@f@\x00\x00\x00\x00\x00?\xF3\xAE\x14z\xE1G\xAE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x01


问:
Handle retrofit 2 response object with a field with type String or type Array
I am trying to retrieve list of items using an api. The api is designed so that in the list of items, a field in one item is a String and the same field in another item is an Array. If I declare the field as an Array, retrofit throws an error because in some cases it returns String. How can I use one field for two situations. I tried declaring it as an Object and than casting it to the appropriate List of objects but it throws an exception because in this case the type is List of LinkedTreeMap. I am using Gson for deserialization.

Example:

```<code>{
    [
        {
            "field": ""
        },
        {
            "field": [{},{},{}]
        }
    ]
}
</code>```

答:
You could build a custom deserializer and react to any field based on any conditions, un your object that field could be of type "Any" but you may be loosing the point of map to an Object.

Here you can find some examples

Body:
I am trying to retrieve list of items using an api. The api is designed so that in the list of items, a field in one item is a String and the same field in another item is an Array. If I declare the field as an Array, retrofit throws an error because in some cases it returns String. How can I use one field for two situations. I tried declaring it as an Object and than casting it to the appropriate List of objects but it throws an exception because in this case the type is List of LinkedTreeMap. I am using Gson for deserialization.

Example:

{
    [
        {
            "field": ""
        },
        {
            "field": [{},{},{}]
        }
    ]
}


问:
"Add choice" button for respondents in Qualtrics
in my survey, people are asked to list tools they use and I chose form field as question type. Anyway, I would like my respondents to add as many text entrys as they need, currently the number of text entry is predetermined by me. I think of something like a "add choice" button.

So far, I've found this and it works: https://community.qualtrics.com/XMcommunity/discussion/4150/enable-respondent-to-add-extra-response-fields

```<code>var that=this.questionId;
    jQuery("#"+this.questionId+" tr.ChoiceRow:not(:lt(1))").hide();
    jQuery("<input type='button' id='add' value='Add field' name='+' />").insertAfter("#"+this.questionId+" tr.ChoiceRow:last");
    jQuery("#add").on('click',function(){
        var c= jQuery("tr.ChoiceRow:visible").length;
        jQuery("#"+that+" tr.ChoiceRow:eq("+c+")").show();
    });
</code>```

but you have to change the question type "to matrix table", which I would like to avoid. I don't know what and how to adjust the code in order to make it work for form field type of question.

Thanks!

答:
That code actually adds the button in the wrong place and it could be streamlined.

This will work for a form:

```<code>Qualtrics.SurveyEngine.addOnload(function() {
    var cs = jQuery("#"+this.questionId+" .ChoiceStructure");
    cs.find("tr:not(:lt(1))").hide();
    cs.append("<input type='button' id='add' value='Add field' name='+' />");
    jQuery("#add").on('click',function(){
        var c = cs.find("tr:visible").length;
        cs.find("tr:eq("+c+")").show();
    });
});
</code>```

Body:
in my survey, people are asked to list tools they use and I chose form field as question type. Anyway, I would like my respondents to add as many text entrys as they need, currently the number of text entry is predetermined by me. I think of something like a "add choice" button.

So far, I've found this and it works: https://community.qualtrics.com/XMcommunity/discussion/4150/enable-respondent-to-add-extra-response-fields

var that=this.questionId;
    jQuery("#"+this.questionId+" tr.ChoiceRow:not(:lt(1))").hide();
    jQuery("<input type='button' id='add' value='Add field' name='+' />").insertAfter("#"+this.questionId+" tr.ChoiceRow:last");
    jQuery("#add").on('click',function(){
        var c= jQuery("tr.ChoiceRow:visible").length;
        jQuery("#"+that+" tr.ChoiceRow:eq("+c+")").show();
    });

but you have to change the question type "to matrix table", which I would like to avoid. I don't know what and how to adjust the code in order to make it work for form field type of question.

Thanks!

Body:
That code actually adds the button in the wrong place and it could be streamlined.

This will work for a form:

Qualtrics.SurveyEngine.addOnload(function() {
    var cs = jQuery("#"+this.questionId+" .ChoiceStructure");
    cs.find("tr:not(:lt(1))").hide();
    cs.append("<input type='button' id='add' value='Add field' name='+' />");
    jQuery("#add").on('click',function(){
        var c = cs.find("tr:visible").length;
        cs.find("tr:eq("+c+")").show();
    });
});


问:
ld from other source cannot find a library
First of all by "other source" in title i mean not /usr/bin/ld

Then I am so sorry for this long thread of question. I also would like to say here that any help would be appreciated peacefully.

I have encountered an error during make test according to https://github.com/cliffordwolf/picorv32. I have opened an issue on github already.

I have searched thoroughly the issue and found the following Questions but none of the answers satisfied the issue.

gcc /usr/bin/ld: cannot find -lglut32, -lopengl32, -lglu32, -lfreegut, but these are installed

Linking failure [ld cannot find library]

ld cannot find .so libraries

ld cannot find -l

ld cannot find libjasper library

ld cannot find an existing library

OK! Now What is the issue. As I mentioned above while make test according to https://github.com/cliffordwolf/picorv32 i get the following error:

```<code>/opt/riscv32i/lib/gcc/riscv32-unknown-elf/8.2.0/../../../../riscv32-unknown-elf/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
Makefile:110: recipe for target 'firmware/firmware.elf' failed
make: *** [firmware/firmware.elf] Error 1
</code>```

before that in terminal is written:

```<code>/opt/riscv32i/bin/riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o firmware/firmware.elf \
    -Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
    firmware/start.o firmware/irq.o firmware/print.o firmware/hello.o firmware/sieve.o firmware/multest.o firmware/stats.o tests/or.o tests/xor.o tests/sh.o tests/andi.o tests/sub.o tests/sll.o tests/sra.o tests/lh.o tests/bge.o tests/srai.o tests/lb.o tests/mulh.o tests/slti.o tests/srli.o tests/rem.o tests/lw.o tests/div.o tests/beq.o tests/auipc.o tests/sw.o tests/jalr.o tests/bgeu.o tests/ori.o tests/divu.o tests/mulhu.o tests/add.o tests/slt.o tests/lbu.o tests/lhu.o tests/lui.o tests/bltu.o tests/simple.o tests/remu.o tests/xori.o tests/sb.o tests/jal.o tests/mul.o tests/addi.o tests/srl.o tests/slli.o tests/j.o tests/bne.o tests/and.o tests/blt.o tests/mulhsu.o -lgcc
</code>```

The line 110 in Makefile is:

```<code>firmware/firmware.elf: $(FIRMWARE_OBJS) $(TEST_OBJS) firmware/sections.lds
$(TOOLCHAIN_PREFIX)gcc -Os -ffreestanding -nostdlib -o $@ \
    -Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
    $(FIRMWARE_OBJS) $(TEST_OBJS) -lgcc
</code>```

WHAT IS MY MACHINE?

```<code>uname -a
Linux ahmad-pc 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a
LSB Version:    core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
</code>```

WHAT HAVE I DONE SO FAR:

```<code>locate libgcc_s.so
locate libgcc_s.so.1
locate libgcc.a
</code>```

returns many locations which i linked within the working directory but didn't work.

```<code>export LD_LIBRARY_PATH=/path/to/libgcc_s.so.1:$LD_LIBRARY_PATH
</code>```

Which again didn't work.

I Also installed the recommended packages in the mentioned links but again didn't work.

As i mentioned at the begining of my question, ANY HELP WOULD BE APPRECIATED PEACEFULLY.

Thank you for your attention this far.

答: I had riscv32-unknown-elf- but then i installed make -j$(nproc) build-riscv32i-tools and the issue went away. Thanks @KamilCuk</p>

Body:
First of all by "other source" in title i mean not /usr/bin/ld

Then I am so sorry for this long thread of question. I also would like to say here that any help would be appreciated peacefully.

I have encountered an error during make test according to https://github.com/cliffordwolf/picorv32. I have opened an issue on github already.

I have searched thoroughly the issue and found the following Questions but none of the answers satisfied the issue.

gcc /usr/bin/ld: cannot find -lglut32, -lopengl32, -lglu32, -lfreegut, but these are installed

Linking failure [ld cannot find library]

ld cannot find .so libraries

ld cannot find -l

ld cannot find libjasper library

ld cannot find an existing library

OK! Now What is the issue. As I mentioned above while make test according to https://github.com/cliffordwolf/picorv32 i get the following error:

/opt/riscv32i/lib/gcc/riscv32-unknown-elf/8.2.0/../../../../riscv32-unknown-elf/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
Makefile:110: recipe for target 'firmware/firmware.elf' failed
make: *** [firmware/firmware.elf] Error 1

before that in terminal is written:

/opt/riscv32i/bin/riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o firmware/firmware.elf \
    -Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
    firmware/start.o firmware/irq.o firmware/print.o firmware/hello.o firmware/sieve.o firmware/multest.o firmware/stats.o tests/or.o tests/xor.o tests/sh.o tests/andi.o tests/sub.o tests/sll.o tests/sra.o tests/lh.o tests/bge.o tests/srai.o tests/lb.o tests/mulh.o tests/slti.o tests/srli.o tests/rem.o tests/lw.o tests/div.o tests/beq.o tests/auipc.o tests/sw.o tests/jalr.o tests/bgeu.o tests/ori.o tests/divu.o tests/mulhu.o tests/add.o tests/slt.o tests/lbu.o tests/lhu.o tests/lui.o tests/bltu.o tests/simple.o tests/remu.o tests/xori.o tests/sb.o tests/jal.o tests/mul.o tests/addi.o tests/srl.o tests/slli.o tests/j.o tests/bne.o tests/and.o tests/blt.o tests/mulhsu.o -lgcc

The line 110 in Makefile is:

firmware/firmware.elf: $(FIRMWARE_OBJS) $(TEST_OBJS) firmware/sections.lds
$(TOOLCHAIN_PREFIX)gcc -Os -ffreestanding -nostdlib -o $@ \
    -Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
    $(FIRMWARE_OBJS) $(TEST_OBJS) -lgcc

WHAT IS MY MACHINE?

uname -a
Linux ahmad-pc 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a
LSB Version:    core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

WHAT HAVE I DONE SO FAR:

locate libgcc_s.so
locate libgcc_s.so.1
locate libgcc.a

returns many locations which i linked within the working directory but didn't work.

export LD_LIBRARY_PATH=/path/to/libgcc_s.so.1:$LD_LIBRARY_PATH

Which again didn't work.

I Also installed the recommended packages in the mentioned links but again didn't work.

As i mentioned at the begining of my question, ANY HELP WOULD BE APPRECIATED PEACEFULLY.

Thank you for your attention this far.


问:
Shuffle string using Arrays
can someone please explain why my solution is wrong in this case?
Q : You are given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string.

Return the shuffled string.
Input: s = "codeleet", indices = [4,5,6,7,0,2,1,3]
Output: "leetcode"
Explanation: As shown, "codeleet" becomes "leetcode" after shuffling.

Sol:

```<code>class Solution:
    def restoreString(self, s, indices):
            res = [''] * len(s)
            for i in range (len(s)):
                res.insert(indices[i],s[i])
            return "".join (res)
</code>```

答:
you can fix it with this code

```<code>for index, alph in enumerate(s):
        res[indices[index]] = alph
</code>```
```<code>
def restoreString( s, indices):
    res = [''] * len(s)
    for index, alph in enumerate(s):
        res[indices[index]] = alph
    return "".join (res)
restoreString("codeleet",[4,5,6,7,0,2,1,3])
</code>```

or dict option

```<code>    dicts = {}
    res = ''

    for i in range(len(indices)):
        dicts[indices[i]] = s[i]
    return ''.join(dicts.values())
</code>```

Title: Shuffle string using Arrays

Body:
can someone please explain why my solution is wrong in this case?
Q : You are given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string.

Return the shuffled string.
Input: s = "codeleet", indices = [4,5,6,7,0,2,1,3]
Output: "leetcode"
Explanation: As shown, "codeleet" becomes "leetcode" after shuffling.

Sol:

class Solution:
    def restoreString(self, s, indices):
            res = [''] * len(s)
            for i in range (len(s)):
                res.insert(indices[i],s[i])
            return "".join (res)

Body:
you can fix it with this code

for index, alph in enumerate(s):
        res[indices[index]] = alph

def restoreString( s, indices):
    res = [''] * len(s)
    for index, alph in enumerate(s):
        res[indices[index]] = alph
    return "".join (res)
restoreString("codeleet",[4,5,6,7,0,2,1,3])

or dict option

    dicts = {}
    res = ''

    for i in range(len(indices)):
        dicts[indices[i]] = s[i]
    return ''.join(dicts.values())


问:
Why can't I get two lists from one list comprehension?
So I have an array of the following form:

```<code>[(1, u'first_type', u'data_gid_1'),
 (2, u'first_type', u'data_gid_2'),
 (3, u'first_type', u'data_gid_3'),
 (4, u'first_type', u'data_gid_4')]
</code>```

Now I want to extract the first and the last element of each inside list into separate lists. So if I do:

```<code>>>> ids = [dat[0] for dat in all_data]
>>> gds = [dat[2] for dat in all_data]
</code>```

This works as I expect it to. However I was trying to merge these two into one call, something like:

```<code> (ids, gds) = [(dat[0], dat[2]) for dat in all_data]
</code>```

This however fails with an:
     ValueError: too many values to unpack

So could anyone explain why this is happening and if what I am trying to do is even possible.

Regards,
Bogdan

答:
Code below will also do the trick:</p>

```<code>data = [(1, u'first_type', u'data_gid_1'),
 (2, u'first_type', u'data_gid_2'),
 (3, u'first_type', u'data_gid_3'),
 (4, u'first_type', u'data_gid_4')]

ids, gds = ([row[i] for row in data] for i in [0,2])
</code>```

Body:
So I have an array of the following form:

[(1, u'first_type', u'data_gid_1'),
 (2, u'first_type', u'data_gid_2'),
 (3, u'first_type', u'data_gid_3'),
 (4, u'first_type', u'data_gid_4')]

Now I want to extract the first and the last element of each inside list into separate lists. So if I do:

>>> ids = [dat[0] for dat in all_data]
>>> gds = [dat[2] for dat in all_data]

This works as I expect it to. However I was trying to merge these two into one call, something like:

 (ids, gds) = [(dat[0], dat[2]) for dat in all_data]

This however fails with an:
     ValueError: too many values to unpack

So could anyone explain why this is happening and if what I am trying to do is even possible.

Regards,
Bogdan

Body:
Code below will also do the trick:

data = [(1, u'first_type', u'data_gid_1'),
 (2, u'first_type', u'data_gid_2'),
 (3, u'first_type', u'data_gid_3'),
 (4, u'first_type', u'data_gid_4')]

ids, gds = ([row[i] for row in data] for i in [0,2])


问:
The id I am trying to add to use navigation in Kotlin gives an error

Definitions included in the Build Gradle Module

```<code> plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-android-extensions'
    id("androidx.navigation.safeargs.kotlin")
    }

    android {
        compileSdk 32

    defaultConfig {
        applicationId "com.project.sunpanel"
        minSdk 23
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding = true
    }

    def  nav_version = "2.4.0"
    dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
    implementation("androidx.navigation:navigation-ui-ktx:$nav_version")
</code>```

Definitions included in the Build Gradle Project

```<code>buildscript {
    ext.kotlin_version = "1.6.10"
    repositories {
        google()
        mavenCentral()
    }
        dependencies {
        classpath "com.android.tools.build:gradle:7.1.1"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

            def nav_version = "2.4.0"
            classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
        }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

The error I get is as follows;

Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'androidx.navigation.safeargs.kotlin'] was not found in any of the following sources:

Gradle Core Plugins (plugin is not in 'org.gradle' namespace)

Plugin Repositories (plugin dependency must include a version number for this source

Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'. This is an unexpected error. Please file a bug containing the idea.log file.

答:
Your project level build file is missing the allprojects -> repositories block.

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}
```

Body:
Definitions included in the Build Gradle Module

 plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-android-extensions'
    id("androidx.navigation.safeargs.kotlin")
    }

    android {
        compileSdk 32

    defaultConfig {
        applicationId "com.project.sunpanel"
        minSdk 23
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding = true
    }

    def  nav_version = "2.4.0"
    dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.4.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
    implementation("androidx.navigation:navigation-ui-ktx:$nav_version")

Definitions included in the Build Gradle Project

buildscript {
    ext.kotlin_version = "1.6.10"
    repositories {
        google()
        mavenCentral()
    }
        dependencies {
        classpath "com.android.tools.build:gradle:7.1.1"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

            def nav_version = "2.4.0"
            classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
        }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

The error I get is as follows;

Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'androidx.navigation.safeargs.kotlin'] was not found in any of the following sources:

Gradle Core Plugins (plugin is not in 'org.gradle' namespace)

Plugin Repositories (plugin dependency must include a version number for this source

Unable to load class 'com.android.build.api.extension.AndroidComponentsExtension'. This is an unexpected error. Please file a bug containing the idea.log file.


问:
Set a http only cookie next API
I'm trying to set a cookie using my nextjs api.

I tried to do "res.cookie" (based off expressJS), but res.cookie is apparently undefined in my API. res itself is not undefined, just the cookie property is undefined.

Then i tried the following code:

```<code> import { serialize } from "cookie";
 res.setHeader(
            "Set-Cookie",
            serialize("jwt", `${response.data.access_token}`, {
                maxAge: 5000,
                expires: new Date("01 12 2021"),
                secure: true,
                httpOnly: true,
                sameSite: "lax",
            })
        );

        res.send("done");
</code>```

This is also not working, It is not setting the cookie on my frontend.

答:
If you want to use API in Next.js you must create a file in this path first:

```<code>./pages/api/file.js
</code>```

Then you must add your all api codes in this async function and add res,req to it. Dont forget to import your libs before the function:

```<code>import { serialize } from "cookie";

export default async (req, res) => {
    res.setHeader(
        "Set-Cookie",
        serialize("jwt", `${response.data.access_token}`, {
            maxAge: 5000,
            expires: new Date("01 12 2021"),
            secure: true,
            httpOnly: true,
            sameSite: "lax",
            path: '/thePath',
            domain: 'yourdomain.com'
        })
    );

    res.send("done");
}
</code>```

Title: Set a http only cookie next API

Body:
I'm trying to set a cookie using my nextjs api.

I tried to do "res.cookie" (based off expressJS), but res.cookie is apparently undefined in my API. res itself is not undefined, just the cookie property is undefined.

Then i tried the following code:

 import { serialize } from "cookie";
 res.setHeader(
            "Set-Cookie",
            serialize("jwt", `${response.data.access_token}`, {
                maxAge: 5000,
                expires: new Date("01 12 2021"),
                secure: true,
                httpOnly: true,
                sameSite: "lax",
            })
        );

        res.send("done");

This is also not working, It is not setting the cookie on my frontend.

Body:
If you want to use API in Next.js you must create a file in this path first:

./pages/api/file.js

Then you must add your all api codes in this async function and add res,req to it. Dont forget to import your libs before the function:

import { serialize } from "cookie";

export default async (req, res) => {
    res.setHeader(
        "Set-Cookie",
        serialize("jwt", `${response.data.access_token}`, {
            maxAge: 5000,
            expires: new Date("01 12 2021"),
            secure: true,
            httpOnly: true,
            sameSite: "lax",
            path: '/thePath',
            domain: 'yourdomain.com'
        })
    );

    res.send("done");
}


问:
Comma separated with/without spaces change behaviour. Spaces are skipped though
First of all, thanks a lot for your time.

Practicing a little bit more with antlr4, I made this grammar (below).

Input

The tested input is the following:

text to search query_on:fielda,fieldab fielda:"123" sort_by:+fielda,-fieldabc

This produces the next output starting to fail on the query_on-varname rule.

```<code>(start (query (expr (text_query text to search) (query_on query_on : (varname fielda,fieldab fielda)))) : "123" sort_by : + fielda, - fieldabc\n)
</code>```

If instead of this input I separate the commas with spaces:

text to search query_on:fielda , fieldab fielda:"123" sort_by:+fielda , -fieldabc

The output is much more similar to "my" expexted output:

```<code>(start (query (expr (text_query text to search) (query_on query_on : (varname fielda) , (varname fieldab)) (filters (binary_op (varname fielda) : (value "123"))) (sorting_fields sort_by : (sorting_field (sorting_order (asc +)) (varname fielda)) , (sorting_field (sorting_order (desc -)) (varname fieldabc\n))))) <EOF>)
</code>```

The only failing part is the last \n.

Expected

The expected results is the same as before but accepting the varname fieldabc and skipping the \n.

```<code>(start (query (expr (text_query text to search) (query_on query_on : (varname fielda) , (varname fieldab)) (filters (binary_op (varname fielda) : (value "123"))) (sorting_fields sort_by : (sorting_field (sorting_order (asc +)) (varname fielda)) , (sorting_field (sorting_order (desc -)) (varname fieldabc))))))
</code>```

Questions

Therefore:

Why the grammar is sensitive to the spaces around a comma ?

Similarly, why the \n char is not skipped at the end ?

Thanks!

GRAMMAR

```<code>grammar SearchEngine;

// Grammar
start: query EOF;

query
    : '(' query+ ')'
    | query (OR query)+
    | expr
    ;

expr: text_query query_on? filters* sorting_fields?;

text_query: STRING+;

query_on: QUERY_ON ':' varname (',' varname)*;

filters: binary_op+;

binary_op: varname ':' value;

sorting_fields: SORT_BY ':' sorting_field (',' sorting_field)*;

sorting_field: sorting_order varname;

sorting_order: (asc|desc);
asc: '+';
desc: '-';

varname
    : FIELDA
    | FIELDAB
    | FIELDABC
    ;

value: STRING;

// Lexer rules (tokens)
WHITE_SPACE: [ \t\r\n] -> skip;

OR: O R;
QUERY_ON: Q U E R Y '_' O N;
SORT_BY: S O R T '_' B Y;

FIELDA: F I E L D A;
FIELDAB: F I E L D A B;
FIELDABC: F I E L D A B C;

STRING: ~[ :()+-]+;

// Fragments (not tokens)
fragment A: [aA];
fragment B: [bB];
fragment C: [cC];
fragment D: [dD];
fragment E: [eE];
fragment F: [fF];
fragment G: [gG];
fragment H: [hH];
fragment I: [iI];
fragment J: [jJ];
fragment K: [kK];
fragment L: [lL];
fragment M: [mM];
fragment N: [nN];
fragment O: [oO];
fragment P: [pP];
fragment Q: [qQ];
fragment R: [rR];
fragment S: [sS];
fragment T: [tT];
fragment U: [uU];
fragment V: [vV];
fragment W: [wW];
fragment X: [xX];
fragment Y: [yY];
fragment Z: [zZ];
</code>```

答:
Your STRING Lexer rule accepts tabs and linefeeds.  Try:

```<code>STRING: ~[ :()+-,\t\r\n]+;
</code>```

(Having your WHITESPACE rule above it won't affect this, because ANTLRs Lexer rules will select the longest sequence of characters that match any Lexer rule).  This is also, why you'll usually see grammars require some sort of delimiter on strings.  (The delimiters also distinguish between identifiers and string literals in most languages)

Body:
First of all, thanks a lot for your time.

Practicing a little bit more with antlr4, I made this grammar (below).

Input

The tested input is the following:

text to search query_on:fielda,fieldab fielda:"123" sort_by:+fielda,-fieldabc

This produces the next output starting to fail on the query_on-varname rule.

(start (query (expr (text_query text to search) (query_on query_on : (varname fielda,fieldab fielda)))) : "123" sort_by : + fielda, - fieldabc\n)

If instead of this input I separate the commas with spaces:

text to search query_on:fielda , fieldab fielda:"123" sort_by:+fielda , -fieldabc

The output is much more similar to "my" expexted output:

(start (query (expr (text_query text to search) (query_on query_on : (varname fielda) , (varname fieldab)) (filters (binary_op (varname fielda) : (value "123"))) (sorting_fields sort_by : (sorting_field (sorting_order (asc +)) (varname fielda)) , (sorting_field (sorting_order (desc -)) (varname fieldabc\n))))) <EOF>)

The only failing part is the last \n.

Expected

The expected results is the same as before but accepting the varname fieldabc and skipping the \n.

(start (query (expr (text_query text to search) (query_on query_on : (varname fielda) , (varname fieldab)) (filters (binary_op (varname fielda) : (value "123"))) (sorting_fields sort_by : (sorting_field (sorting_order (asc +)) (varname fielda)) , (sorting_field (sorting_order (desc -)) (varname fieldabc))))))

Questions

Therefore:

Why the grammar is sensitive to the spaces around a comma ?

Similarly, why the \n char is not skipped at the end ?

Thanks!

GRAMMAR

grammar SearchEngine;

// Grammar
start: query EOF;

query
    : '(' query+ ')'
    | query (OR query)+
    | expr
    ;

expr: text_query query_on? filters* sorting_fields?;

text_query: STRING+;

query_on: QUERY_ON ':' varname (',' varname)*;

filters: binary_op+;

binary_op: varname ':' value;

sorting_fields: SORT_BY ':' sorting_field (',' sorting_field)*;

sorting_field: sorting_order varname;

sorting_order: (asc|desc);
asc: '+';
desc: '-';

varname
    : FIELDA
    | FIELDAB
    | FIELDABC
    ;

value: STRING;

// Lexer rules (tokens)
WHITE_SPACE: [ \t\r\n] -> skip;

OR: O R;
QUERY_ON: Q U E R Y '_' O N;
SORT_BY: S O R T '_' B Y;

FIELDA: F I E L D A;
FIELDAB: F I E L D A B;
FIELDABC: F I E L D A B C;

STRING: ~[ :()+-]+;

// Fragments (not tokens)
fragment A: [aA];
fragment B: [bB];
fragment C: [cC];
fragment D: [dD];
fragment E: [eE];
fragment F: [fF];
fragment G: [gG];
fragment H: [hH];
fragment I: [iI];
fragment J: [jJ];
fragment K: [kK];
fragment L: [lL];
fragment M: [mM];
fragment N: [nN];
fragment O: [oO];
fragment P: [pP];
fragment Q: [qQ];
fragment R: [rR];
fragment S: [sS];
fragment T: [tT];
fragment U: [uU];
fragment V: [vV];
fragment W: [wW];
fragment X: [xX];
fragment Y: [yY];
fragment Z: [zZ];

Body:
Your STRING Lexer rule accepts tabs and linefeeds.  Try:

STRING: ~[ :()+-,\t\r\n]+;

(Having your WHITESPACE rule above it won't affect this, because ANTLRs Lexer rules will select the longest sequence of characters that match any Lexer rule).  This is also, why you'll usually see grammars require some sort of delimiter on strings.  (The delimiters also distinguish between identifiers and string literals in most languages)


问:
How to not add every library inside Flutter project with Dartdoc
When I launch the command dartdoc --auto-include-dependencies, how can I do to not create documentation for every single library in the project? I use Melos in my project.

答:
As of dartdoc 0.35.0 you can define nodoc as option and pass array of path of dart files with wild card *.dart in dartdoc_options.yaml.
This will treat those files marked as ///@nodoc.
Basically saves us writing ///@nodoc in required files

Example:

```<code>    dartdoc:

      nodoc: [ 'lib/utils/*.dart','lib/views/**/*.dart','lib/constants/*.dart' ]
</code>```

Download file from here

Body:
As of dartdoc 0.35.0 you can define nodoc as option and pass array of path of dart files with wild card *.dart in dartdoc_options.yaml.
This will treat those files marked as ///@nodoc.
Basically saves us writing ///@nodoc in required files

Example:

    dartdoc:

      nodoc: [ 'lib/utils/*.dart','lib/views/**/*.dart','lib/constants/*.dart' ]

Download file from here


问:
Python WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
I'm trying to do pip install --upgrade pip and keep

getting this error:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B448C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B59148>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B596C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B595C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B5F2C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
ERROR: Could not find a version that satisfies the requirement pytest
ERROR: No matching distribution found for pytest
```

Also, I can't install any new package due to this error.

I tried to reinstall Pycharm but no luck there.

I tried some other suggested solutions online - still no luck.

I understand it has something to do with Proxy but I am not familiar with it, Anyone?

答:
First, reinstalling all python.
Secondly, once python is installed I went to find the host file and uncomment the section of the host.
Normally, the path in windows is located in C:\Windows\System32\drivers\etc

Uncomment this section:

localhost name resolution is handled within DNS itself.

```<code>127.0.0.1       localhost
::1             localhost
</code>```

Hope it serves!
cheers!

Body:
I'm trying to do pip install --upgrade pip and keep

getting this error:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B448C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B59148>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B596C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B595C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B5F2C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
 because the target machine actively refused it'))': /simple/pytest/
ERROR: Could not find a version that satisfies the requirement pytest
ERROR: No matching distribution found for pytest

Also, I can't install any new package due to this error.

I tried to reinstall Pycharm but no luck there.

I tried some other suggested solutions online - still no luck.

I understand it has something to do with Proxy but I am not familiar with it, Anyone?

Body:
First, reinstalling all python.
Secondly, once python is installed I went to find the host file and uncomment the section of the host.
Normally, the path in windows is located in C:\Windows\System32\drivers\etc

Uncomment this section:

localhost name resolution is handled within DNS itself.

127.0.0.1       localhost
::1             localhost

Hope it serves!
cheers!


问:
what sould be done to have same layout for diffrent android applications?
hiii everybody,

I have an important question regarding android. I build an application in android,which uses some layout.Supoose I tested on a real android device.
My question is:
Whether the layout and whole look and feel will be same when i run in different android device?
If not, what i have to do to ensure same layout and same look ans feel ie. layout must not distort while running in other android device ?

答: Check this post, it has lots of information about supporting multiple screens when developing for Android. Hope this helps.</p>


问:
Django channels - unable to subscribe to groups
I'm attempting to send consumers.py information to display on the client end outside of consumers.py.

I've referenced Send message using Django Channels from outside Consumer class this previous question, but the sub process .group_send or .group_add don't seem to exist, so I feel it's possible I'm missing something very easy.

Consumers.py

```<code>from channels.generic.websocket import WebsocketConsumer
from asgiref.sync import async_to_sync

class WSConsumer(WebsocketConsumer):
    def connect(self):
        async_to_sync(self.channel_layer.group_add)("appDel", self.channel_name)
        self.accept()

        self.render()
</code>```

appAlarm.py

```<code>def appFunc(csvUpload):
    #csvUpload=pd.read_csv(request.FILES['filename'])
    csvFile = pd.DataFrame(csvUpload)
    colUsernames = csvFile.usernames
    print(colUsernames)

    channel_layer = get_channel_layer()

    for user in colUsernames:
        req = r.get('https://reqres.in/api/users/2')
        print(req)
        t = req.json()
        data = t['data']['email']
        print(user + " " + data)

        message = user + " " + data
        async_to_sync(channel_layer.group_send)(
        'appDel',
        {'type': 'render', 'message': message}
    )
</code>```

It's throwing this error:

```<code>    async_to_sync(channel_layer.group_send)(
AttributeError: 'NoneType' object has no attribute 'group_send'
</code>```

and will throw the same error for group_add when stripping it back more to figure out what's going on, but per the documentation HERE I feel like this should be working.

答:
To anyone looking at this in the future, I was not able to use redis or even memurai in Windows OS due to cost. I ended up using server side events (SSE), specifically django-eventstream, and so far it's worked great as I didn't need the client to interact with the server, for a chat application this would not work.

Eventstream creates an endpoint at /events/ the client can connect to and receive a streaming http response.

Sending data from externalFunc.py:

```<code>send_event('test', 'message', {'text': 'Hello World'})
</code>```

Event listener in HTML page:

```<code>var es = new ReconnectingEventSource('/events/');

es.addEventListener('message', function (e) {
    console.log(e.data);

    var source = new EventSource("/events/")

    var para = document.createElement("P");
    const obj = JSON.parse(event.data)
    para.innerText = obj.text;
    document.body.appendChild(para)

}, false);

es.addEventListener('stream-reset', function (e) {
}, false);
</code>```

Body:
I'm attempting to send consumers.py information to display on the client end outside of consumers.py.

I've referenced Send message using Django Channels from outside Consumer class this previous question, but the sub process .group_send or .group_add don't seem to exist, so I feel it's possible I'm missing something very easy.

Consumers.py

from channels.generic.websocket import WebsocketConsumer
from asgiref.sync import async_to_sync

class WSConsumer(WebsocketConsumer):
    def connect(self):
        async_to_sync(self.channel_layer.group_add)("appDel", self.channel_name)
        self.accept()

        self.render()

appAlarm.py

def appFunc(csvUpload):
    #csvUpload=pd.read_csv(request.FILES['filename'])
    csvFile = pd.DataFrame(csvUpload)
    colUsernames = csvFile.usernames
    print(colUsernames)

    channel_layer = get_channel_layer()

    for user in colUsernames:
        req = r.get('https://reqres.in/api/users/2')
        print(req)
        t = req.json()
        data = t['data']['email']
        print(user + " " + data)

        message = user + " " + data
        async_to_sync(channel_layer.group_send)(
        'appDel',
        {'type': 'render', 'message': message}
    )

It's throwing this error:

    async_to_sync(channel_layer.group_send)(
AttributeError: 'NoneType' object has no attribute 'group_send'

and will throw the same error for group_add when stripping it back more to figure out what's going on, but per the documentation HERE I feel like this should be working.

Body:
To anyone looking at this in the future, I was not able to use redis or even memurai in Windows OS due to cost. I ended up using server side events (SSE), specifically django-eventstream, and so far it's worked great as I didn't need the client to interact with the server, for a chat application this would not work.

Eventstream creates an endpoint at /events/ the client can connect to and receive a streaming http response.

Sending data from externalFunc.py:

send_event('test', 'message', {'text': 'Hello World'})

Event listener in HTML page:

var es = new ReconnectingEventSource('/events/');

es.addEventListener('message', function (e) {
    console.log(e.data);

    var source = new EventSource("/events/")

    var para = document.createElement("P");
    const obj = JSON.parse(event.data)
    para.innerText = obj.text;
    document.body.appendChild(para)

}, false);

es.addEventListener('stream-reset', function (e) {
}, false);


问:
Using another connection instead of the default connection throughout the DAG
I'm using Airflow in Google Composer. By default all the tasks in a DAG use the default connection to communicate with Storage, BigQuery, etc. Obviously we can specify another connection configured in Airflow, ie:

task_custom = bigquery.BigQueryInsertJobOperator(
    task_id='task_custom_connection',
    gcp_conn_id='my_gcp_connection',
    configuration={
        "query": {
            "query": 'SELECT 1',
            "useLegacySql": False
        }
    }
)
```
<p>Is it possible to use a specific connection as the default for all tasks in the entire DAG?</p>
<p>Thanks in advance.</p>
<p><strong>UPDATE:</strong></p>
<p>Specify <em>gcp_conn_id</em> via <em>default_args</em> in DAG (as Javier Lopez Tomas recommended) doesn't work completely. The Operators that expect gcp_conn_id as parameter works fine, but in my case unfortunately most of interactions with GCP components do so via clients or hooks within PythonOperators.</p>
<p>For example: If I call DataflowHook (inside a function called by a PythonOperator) without specifying the connection, it internally uses "google_cloud_default" and not "gcp_conn_id" :(</p>
<pre class="lang-py prettyprint-override"><code>def _dummy_func(**context):
    df_hook = DataflowHook()

default_args = {
    'gcp_conn_id': 'my_gcp_connection'
}

with DAG(default_args=default_args) as dag:
    dummy = PythonOperator(python_callable=_dummy_func)
</code>```

答:
You can use default args:
https://airflow.apache.org/docs/apache-airflow/stable/tutorial.html#default-arguments

In your case it would be:

```<code>default_args = {
    "gcp_conn_id": "my_gcp_connection"
}

with DAG(blabla)...
</code>```

Body:
I'm using Airflow in Google Composer. By default all the tasks in a DAG use the default connection to communicate with Storage, BigQuery, etc. Obviously we can specify another connection configured in Airflow, ie:

task_custom = bigquery.BigQueryInsertJobOperator(
    task_id='task_custom_connection',
    gcp_conn_id='my_gcp_connection',
    configuration={
        "query": {
            "query": 'SELECT 1',
            "useLegacySql": False
        }
    }
)

Is it possible to use a specific connection as the default for all tasks in the entire DAG?

Thanks in advance.

UPDATE:

Specify gcp_conn_id via default_args in DAG (as Javier Lopez Tomas recommended) doesn't work completely. The Operators that expect gcp_conn_id as parameter works fine, but in my case unfortunately most of interactions with GCP components do so via clients or hooks within PythonOperators.

For example: If I call DataflowHook (inside a function called by a PythonOperator) without specifying the connection, it internally uses "google_cloud_default" and not "gcp_conn_id" :(

def _dummy_func(**context):
    df_hook = DataflowHook()

default_args = {
    'gcp_conn_id': 'my_gcp_connection'
}

with DAG(default_args=default_args) as dag:
    dummy = PythonOperator(python_callable=_dummy_func)

Body:
You can use default args:
https://airflow.apache.org/docs/apache-airflow/stable/tutorial.html#default-arguments

In your case it would be:

default_args = {
    "gcp_conn_id": "my_gcp_connection"
}

with DAG(blabla)...


问:
Retrieve calls using c# API from Twilio with a specific time range
Good day all,
I'm in the process of trying to retrieve call data from Twilio using their C# SDK. Using the StartTime seems to pull all records for that given date which is not what I want to achieve. Ultimately I want to only pull data within a time range of the given date. I have looked on the internet and have seen mention of using the StartTimeBefore and StartTimeAfter. This does not appear to work either. Any thoughts as to how I can achieve this? Below is some code that I have attempted that does not seem to work.

NOTE: I have also tried some different permutations with EndTimeAfter to put bounds on it that way as well, but again that did not work.

```<code>public class RetrieveTwilioCalls
{
    private readonly string _accountSid;

    private readonly string _authToken;

    public RetrieveTwilioCalls(IConfigurationRoot configuration)
    {
        _accountSid = configuration["TWILIO_ACCOUNT_SID"];
        _authToken = configuration["TWILIO_AUTH_TOKEN"];
    }

    public async Task ExecuteAsync()
    {
        TwilioClient.Init(_accountSid, _authToken);

        var startDateTimeUTC = new DateTime(2022, 2, 8, 15, 15, 00).ToUniversalTime();
        var endDateTimeUTC = new DateTime(2022, 2, 8, 16, 18, 01).ToUniversalTime();

        var call1 = await CallResource.ReadAsync(new ReadCallOptions { StartTimeBefore = startDateTimeUTC, EndTimeAfter = endDateTimeUTC, PageSize = 100 });

        Console.WriteLine(call1.ElementAt(0).To);
    }
}
</code>```

答:
If you want to get all calls between two dates, you need to use the StartTimeAfter and StartTimeBefore properties.

StartTimeAfter is the date and time you want to be the start of your time span.
StartTimeBefore is the date and time you want to be the end of your time span.

```<code>public async Task ExecuteAsync()
{
    TwilioClient.Init(_accountSid, _authToken);

    var startDateTimeUTC = new DateTime(2021, 11, 17, 15, 15, 00).ToUniversalTime();
    var endDateTimeUTC = new DateTime(2021, 11, 19, 16, 18, 01).ToUniversalTime();

    var call1 = await CallResource.ReadAsync(
        new ReadCallOptions
        {
            StartTimeAfter = startDateTimeUTC,
            StartTimeBefore = endDateTimeUTC,
            PageSize = 100
        });

    foreach (var cr in call1)
    {
        Console.WriteLine($"{cr.Direction} ${cr.DateCreated} ${cr.CallerName} ${cr.Duration}");

    }

}
</code>```

This will print out a list of all calls inbound or outbound between 2021-11-17 15:15:00 and 2021-11-19 16:18:01 UTC

Body:
Good day all,
I'm in the process of trying to retrieve call data from Twilio using their C# SDK. Using the StartTime seems to pull all records for that given date which is not what I want to achieve. Ultimately I want to only pull data within a time range of the given date. I have looked on the internet and have seen mention of using the StartTimeBefore and StartTimeAfter. This does not appear to work either. Any thoughts as to how I can achieve this? Below is some code that I have attempted that does not seem to work.

NOTE: I have also tried some different permutations with EndTimeAfter to put bounds on it that way as well, but again that did not work.

public class RetrieveTwilioCalls
{
    private readonly string _accountSid;

    private readonly string _authToken;

    public RetrieveTwilioCalls(IConfigurationRoot configuration)
    {
        _accountSid = configuration["TWILIO_ACCOUNT_SID"];
        _authToken = configuration["TWILIO_AUTH_TOKEN"];
    }

    public async Task ExecuteAsync()
    {
        TwilioClient.Init(_accountSid, _authToken);

        var startDateTimeUTC = new DateTime(2022, 2, 8, 15, 15, 00).ToUniversalTime();
        var endDateTimeUTC = new DateTime(2022, 2, 8, 16, 18, 01).ToUniversalTime();

        var call1 = await CallResource.ReadAsync(new ReadCallOptions { StartTimeBefore = startDateTimeUTC, EndTimeAfter = endDateTimeUTC, PageSize = 100 });

        Console.WriteLine(call1.ElementAt(0).To);
    }
}

Body:
If you want to get all calls between two dates, you need to use the StartTimeAfter and StartTimeBefore properties.

StartTimeAfter is the date and time you want to be the start of your time span.
StartTimeBefore is the date and time you want to be the end of your time span.

public async Task ExecuteAsync()
{
    TwilioClient.Init(_accountSid, _authToken);

    var startDateTimeUTC = new DateTime(2021, 11, 17, 15, 15, 00).ToUniversalTime();
    var endDateTimeUTC = new DateTime(2021, 11, 19, 16, 18, 01).ToUniversalTime();

    var call1 = await CallResource.ReadAsync(
        new ReadCallOptions
        {
            StartTimeAfter = startDateTimeUTC,
            StartTimeBefore = endDateTimeUTC,
            PageSize = 100
        });

    foreach (var cr in call1)
    {
        Console.WriteLine($"{cr.Direction} ${cr.DateCreated} ${cr.CallerName} ${cr.Duration}");

    }

}

This will print out a list of all calls inbound or outbound between 2021-11-17 15:15:00 and 2021-11-19 16:18:01 UTC


问:
How to move background with keys in pygame
I am trying to make a game with pygame where the player is fixed in the center of the map. When you press a key, the background moves instead of the player, but I've only managed to do that on the x-axis. When implementing it on the y-axis, the background goes crazy.

```<code>for event in pygame.event.get():

            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        pulsar = pygame.key.get_pressed()
        if pulsar[pygame.K_a] or pulsar[pygame.K_LEFT]:

            x += 2
        if pulsar[pygame.K_d] or pulsar[pygame.K_RIGHT]:

            x -= 2

        x_relativa = x % bg.get_rect().width
        screen.blit(bg, (x_relativa - bg.get_rect().width, y))

        if x_relativa < width:
            screen.blit(bg, (x_relativa, 0))
</code>```

This code shows how I make the background scroll on the x-axis with the A and D keys. Changing these values to the y-axis also works independently but not at the same time

答:
I don't exactly understand how your code works, but I do know that the following works:

for event in pygame.event.get():
    if event.type==QUIT:
        running=False
presseds=pygame.key.get_pressed()
if presseds[K_UP] or presseds[K_w]:
    bgrect.y+=5
if presseds[K_DOWN] or presseds[K_s]:
    bgrect.y-=5
if presseds[K_RIGHT] or presseds[K_d]:
    bgrect.x-=5
if presseds[K_LEFT] or presseds[K_a]:
    bgrect.x+=5
screen.fill((0,0,0))
screen.blit(bg,bgrect)
```

In this code, bgrect is the rect of your background's surface.

Body:
I am trying to make a game with pygame where the player is fixed in the center of the map. When you press a key, the background moves instead of the player, but I've only managed to do that on the x-axis. When implementing it on the y-axis, the background goes crazy.

for event in pygame.event.get():

            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        pulsar = pygame.key.get_pressed()
        if pulsar[pygame.K_a] or pulsar[pygame.K_LEFT]:

            x += 2
        if pulsar[pygame.K_d] or pulsar[pygame.K_RIGHT]:

            x -= 2

        x_relativa = x % bg.get_rect().width
        screen.blit(bg, (x_relativa - bg.get_rect().width, y))

        if x_relativa < width:
            screen.blit(bg, (x_relativa, 0))

This code shows how I make the background scroll on the x-axis with the A and D keys. Changing these values to the y-axis also works independently but not at the same time

Body:
I don't exactly understand how your code works, but I do know that the following works:

for event in pygame.event.get():
    if event.type==QUIT:
        running=False
presseds=pygame.key.get_pressed()
if presseds[K_UP] or presseds[K_w]:
    bgrect.y+=5
if presseds[K_DOWN] or presseds[K_s]:
    bgrect.y-=5
if presseds[K_RIGHT] or presseds[K_d]:
    bgrect.x-=5
if presseds[K_LEFT] or presseds[K_a]:
    bgrect.x+=5
screen.fill((0,0,0))
screen.blit(bg,bgrect)

In this code, bgrect is the rect of your background's surface.


问:
objc[14025]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib

objc[14025]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1efb7ac10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x12c2b82b8). One of the two will be used. Which one is undefined. objc[14025]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1efb7ac60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x12c2b8308). One of the two will be used. Which one is undefined. ** BUILD FAILED **

Solutions i tried:

flutter clean inside the project directory.

Flutter pub get Pod update

Pod update

Pod repo update

Restarted Xcode and Mac

pod install

flutter build ios

I tried flutter clean, pod update, install, i couldn't run the app on ios emulator,. every time i get the same error again and again. Its not an issue with info plist or but i couldn't find the exact problem,. Tried almost all the possible solution from various sources, I have been sitting n this one issue for the past 3 days.. Please if any body could help... It will be really helpful. Please.

答:
After stumbling around trying a menagerie of solutions from the web, I reinstalled Xcode and the CommandLineTools clean and then also made sure to gem uninstall cocoapods from any ruby environment.  That, at long last, seems to have cleared the errors for me.

macOS 12.3 Beta (21E5206e)
M1 MacBook Pro 2021 M1 Max
Apple clang version 13.0.0 (clang-1300.0.29.30)

Works in either i386 or amd64 arch under /bin/zsh.

UPDATE

After doing more testing, I can see that it very much is related to your arch, as it mentioned below and elsewhere.  With a completely clean command line tools, xcode, arm64 brew, rbenv and cocoapods, the error appears under an arm64 shell and /NOT/ under an i386 shell.  It is fine to run it as an -x86_64 command under the default arm64 shell directly as well: arch -x86_64 xcrun xcodebuild

What is still needed to be diagnosed/fixed now is that flutter (where I started this journey) explicitly runs all these commands as an arm64 arch now, so things break/hang unexpectedly...

FWIW, knowing what I have now learned, I can point you to the well written and maintained cocoapods troubleshooting guide as it is really well done.