问:
are django querysets fastest?
models.py

```<code>class Comments(UUID):
    user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
    post = models.ForeignKey(Posts, on_delete=models.CASCADE)
    comment = models.ForeignKey(
        "self", on_delete=models.CASCADE, blank=True, null=True
    )
    text = models.TextField()
    files = models.ImageField()
</code>```

serializers.py

```<code>class CommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Comments
        fields = "__all__"
        extra_kwargs = {
            "user": {"read_only": True},
            "text": {"required": False},
            "files": {"required": False}
        }

    def create(self, validated_data):
        user = self.context["request"].user
        return Comments.objects.create(user=user, **validated_data)
</code>```

views.py

```<code>class PostCommentsRetrieveAPIView(generics.RetrieveAPIView):
    serializer_class = CommentSerializer

    def get(self, request, *args, **kwargs):
        replies_count = Subquery(Comments.objects.filter(
            comment=OuterRef("pk")
        ).values("comment").annotate(count=Count("pk")).values("count"))
        comment_remarks = Subquery(Remarks.objects.filter(
            comment=OuterRef("pk")
        ).values("comment").annotate(count=Count("pk")).annotate(
            popularities=popularities
        ).values("popularities"))

        # https://stackoverflow.com/questions/63020407/return-multiple-values-in-subquery-in-django-orm
        replies = Subquery(Comments.objects.filter(
            comment=OuterRef("pk")
        ).values("comment", "created_at", "updated_at").annotate(
            created=Now() - F("created_at"), created_=created_,
            updated=Now() - F("updated_at"), updated_=updated_
        ).annotate(
            details=ArrayAgg(
                JSONObject(
                    id="id",
                    user_id="user_id",
                    username="user__profile__username",
                    text="text",
                    files="files",
                    created="created_",
                    updated="updated_",
                    profile_link=profile_link,
                    profile_image=profile_picture,
                    comment_remarks=comment_remarks,
                    replies_count=replies_count
                )
            )
        ).values("details"))

        comment = Subquery(Comments.objects.filter(
            post=OuterRef("pk"), comment=None
        ).values("post", "created_at", "updated_at").annotate(
            created=Now() - F("created_at"), created_=created_,
            updated=Now() - F("updated_at"), updated_=updated_
        ).values("created_").annotate(
            details=ArrayAgg(
                JSONObject(
                    id="id",
                    user_id="user_id",
                    username="user__profile__username",
                    text="text",
                    files="files",
                    created="created_",
                    updated="updated_",
                    profile_link=profile_link,
                    profile_image=profile_picture,
                    comment_remarks=comment_remarks,
                    comment_replies=replies
                )
            )
        ).values("details"))

        post = Posts.objects.filter(id=kwargs["post_id"]).annotate(
            comment=comment,
        ).values("comment")
        return Response(post, status=status.HTTP_200_OK)
</code>```

Now I just want to ask is that a best way show comments on post with nested replies, I create another files to calculate datetime, profile link, profile image, remarks on comment

this query is hitting database only one time my question is will it be fastest query to get data from database?

how to can I check that my query is fastest or not

Title: are django querysets fastest?

Body:
models.py

class Comments(UUID):
    user = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
    post = models.ForeignKey(Posts, on_delete=models.CASCADE)
    comment = models.ForeignKey(
        "self", on_delete=models.CASCADE, blank=True, null=True
    )
    text = models.TextField()
    files = models.ImageField()

serializers.py

class CommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Comments
        fields = "__all__"
        extra_kwargs = {
            "user": {"read_only": True},
            "text": {"required": False},
            "files": {"required": False}
        }

    def create(self, validated_data):
        user = self.context["request"].user
        return Comments.objects.create(user=user, **validated_data)

views.py

class PostCommentsRetrieveAPIView(generics.RetrieveAPIView):
    serializer_class = CommentSerializer

    def get(self, request, *args, **kwargs):
        replies_count = Subquery(Comments.objects.filter(
            comment=OuterRef("pk")
        ).values("comment").annotate(count=Count("pk")).values("count"))
        comment_remarks = Subquery(Remarks.objects.filter(
            comment=OuterRef("pk")
        ).values("comment").annotate(count=Count("pk")).annotate(
            popularities=popularities
        ).values("popularities"))

        # https://stackoverflow.com/questions/63020407/return-multiple-values-in-subquery-in-django-orm
        replies = Subquery(Comments.objects.filter(
            comment=OuterRef("pk")
        ).values("comment", "created_at", "updated_at").annotate(
            created=Now() - F("created_at"), created_=created_,
            updated=Now() - F("updated_at"), updated_=updated_
        ).annotate(
            details=ArrayAgg(
                JSONObject(
                    id="id",
                    user_id="user_id",
                    username="user__profile__username",
                    text="text",
                    files="files",
                    created="created_",
                    updated="updated_",
                    profile_link=profile_link,
                    profile_image=profile_picture,
                    comment_remarks=comment_remarks,
                    replies_count=replies_count
                )
            )
        ).values("details"))

        comment = Subquery(Comments.objects.filter(
            post=OuterRef("pk"), comment=None
        ).values("post", "created_at", "updated_at").annotate(
            created=Now() - F("created_at"), created_=created_,
            updated=Now() - F("updated_at"), updated_=updated_
        ).values("created_").annotate(
            details=ArrayAgg(
                JSONObject(
                    id="id",
                    user_id="user_id",
                    username="user__profile__username",
                    text="text",
                    files="files",
                    created="created_",
                    updated="updated_",
                    profile_link=profile_link,
                    profile_image=profile_picture,
                    comment_remarks=comment_remarks,
                    comment_replies=replies
                )
            )
        ).values("details"))

        post = Posts.objects.filter(id=kwargs["post_id"]).annotate(
            comment=comment,
        ).values("comment")
        return Response(post, status=status.HTTP_200_OK)

Now I just want to ask is that a best way show comments on post with nested replies, I create another files to calculate datetime, profile link, profile image, remarks on comment

this query is hitting database only one time my question is will it be fastest query to get data from database?

how to can I check that my query is fastest or not


来源: stackexchange

问:
How to prevent an author to delete their post?
I am trying to limit the author capability in WordPress like prevent from delete any post.

<?php

// Modify the capabilities of authors
function modify_author_caps( $caps, $cap, $user_id, $args ) {
    // Check if the user is an author
    if ( user_can( $user_id, 'author' ) ) {
        // Prevent authors from deleting their own posts
        if ( 'delete_post' === $cap ) {
            $caps[] = 'do_not_allow';
        }
    }
    return $caps;
}
add_filter( 'map_meta_cap', 'modify_author_caps', 10, 4 );
?>```

But its throwing error-

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in E:\XAMPP\htdocs\newwpsite\wp-includes\class-wp-user.php on line 778

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in E:\XAMPP\htdocs\newwpsite\wp-includes\class-wp-hook.php on line 292

How to solve this error and prevent author to delete post. I am aware about contributor capability. Just want to limit the capability of author.

ContentLicense: CC BY-SA 4.0

Body:
I am trying to limit the author capability in WordPress like prevent from delete any post.

<?php

// Modify the capabilities of authors
function modify_author_caps( $caps, $cap, $user_id, $args ) {
    // Check if the user is an author
    if ( user_can( $user_id, 'author' ) ) {
        // Prevent authors from deleting their own posts
        if ( 'delete_post' === $cap ) {
            $caps[] = 'do_not_allow';
        }
    }
    return $caps;
}
add_filter( 'map_meta_cap', 'modify_author_caps', 10, 4 );
?>

But its throwing error-

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in E:\XAMPP\htdocs\newwpsite\wp-includes\class-wp-user.php on line 778

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in E:\XAMPP\htdocs\newwpsite\wp-includes\class-wp-hook.php on line 292

How to solve this error and prevent author to delete post. I am aware about contributor capability. Just want to limit the capability of author.


问:
Having trouble with Flask in python, either says render_template doesn't exist, or that my template doesn't exist
I am doing an assignment to integrate a python script with HTML templates, and while the IDE is giving me no errors, when I try to actually run the website it gives me an "internal server error" and in the debug menu it says either that it doesn't recognize the Flask command "render_template" or doesn't recognize the HTML file it's supposed to render. The HTML file is stored both in the same folder as the python file and a copy is stored in a seperate "templates" folder located in the same folder as the python file. I really have no idea what's going on, the teacher has been no help.

I tried renaming the files, spell checked the imports repeated, checked all the commands, made copies of the python and Html files to see if the directorry was the problem. I really am not sure what else to try

```<code>

...from flask import Flask
...from flask import render_template
...from flask import request
...from flask import flash
...import datetime

...app = Flask(__name__)

```@app.route('/')
...#the home page
...def home():
   ... return render_template('home_page.html')

```@app.route('/clock/')
...#the clock site
...def time_site():
   ... return date_and_time()
...def date_and_time():
   ... cur_time = str(datetime.now())
    ...return render_template('clock.html', cur_time)

```if __name__ == "__main__":
    ...app.run()

```
```

```
``````

Body:
I am doing an assignment to integrate a python script with HTML templates, and while the IDE is giving me no errors, when I try to actually run the website it gives me an "internal server error" and in the debug menu it says either that it doesn't recognize the Flask command "render_template" or doesn't recognize the HTML file it's supposed to render. The HTML file is stored both in the same folder as the python file and a copy is stored in a seperate "templates" folder located in the same folder as the python file. I really have no idea what's going on, the teacher has been no help.

I tried renaming the files, spell checked the imports repeated, checked all the commands, made copies of the python and Html files to see if the directorry was the problem. I really am not sure what else to try

...from flask import Flask
...from flask import render_template
...from flask import request
...from flask import flash
...import datetime

...app = Flask(__name__)

```@app.route('/')
...#the home page
...def home():
   ... return render_template('home_page.html')

```@app.route('/clock/')
...#the clock site
...def time_site():
   ... return date_and_time()
...def date_and_time():
   ... cur_time = str(datetime.now())
    ...return render_template('clock.html', cur_time)

```if __name__ == "__main__":
    ...app.run()


问:
python-kafka asyncio is blocking
I am trying to create a websocket server that receives input from user, and at the same time read from kafka and continuously send data to user. I am having trouble getting both to run concurrently.

```<code>async def sender(websocket):
    consumer = KafkaConsumer(...) # read from kafka
    for message in consumer:
        msg = json.loads(message.value.decode())
        await websocket.send(msg)

async def handle_client(websocket):
    asyncio.create_task(sender(websocket))

    while True:
        print("Waiting for client input")
        try:
            msg = await websocket.recv()
            # do something with msg

async def main():
    async with websockets.serve(handle_client, "localhost", 8765):
        await asyncio.Future()  # run forever

if __name__ == "__main__":
    asyncio.run(main())

</code>```

They seem to be blocking. I think the issuer is because sender() blocks it, it never sleeps?

Title: python-kafka asyncio is blocking

Body:
I am trying to create a websocket server that receives input from user, and at the same time read from kafka and continuously send data to user. I am having trouble getting both to run concurrently.

async def sender(websocket):
    consumer = KafkaConsumer(...) # read from kafka
    for message in consumer:
        msg = json.loads(message.value.decode())
        await websocket.send(msg)

async def handle_client(websocket):
    asyncio.create_task(sender(websocket))

    while True:
        print("Waiting for client input")
        try:
            msg = await websocket.recv()
            # do something with msg

async def main():
    async with websockets.serve(handle_client, "localhost", 8765):
        await asyncio.Future()  # run forever

if __name__ == "__main__":
    asyncio.run(main())

They seem to be blocking. I think the issuer is because sender() blocks it, it never sleeps?


问:
Key Error 6 while trying to access a matrix/array
```<code>import pandas as pd
import numpy as np

df = pd.read_csv("ia-infect-dublin.csv", header = None)
df.columns = ['Person_ID', 'Contacted']

df = df.sort_values(by=['Person_ID', 'Contacted'])

unique = df['Person_ID'].unique()
unique = np.append(unique, ["Start"])

matrix = pd.DataFrame(0, columns=unique, index=unique, dtype=int)

l_group = df.groupby('Person_ID')

for name, group in l_group:
    i = 0
    for index, rows in group.iterrows():
        if i ==0:
            matrix.loc[['Start'], rows['Person_ID']] += 1
            previous_state = rows['Person_ID']
            i = 1
        else:
            matrix.loc[previous_state, rows['Person_ID']] += 1
print(matrix.head())

</code>```

I am making a transition matrix of where it goes through the csv file and find the frequency of changes from one person to another. A -> B -> C -> D and adds the total count. However, I receive an error:

```<code>Traceback (most recent call last):
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3621, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 6

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/vydang/Documents/FA22/BMI5007/Homeworks/hw10/testing", line 23, in <module>
    matrix.loc[['Start'], rows['Person_ID']] += 1
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 961, in __getitem__
    return self._getitem_tuple(key)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 1140, in _getitem_tuple
    return self._getitem_lowerdim(tup)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 867, in _getitem_lowerdim
    section = self._getitem_axis(key, axis=i)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 1202, in _getitem_axis
    return self._get_label(key, axis=axis)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 1153, in _get_label
    return self.obj.xs(label, axis=axis)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py", line 3849, in xs
    return self[key]
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/frame.py", line 3505, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3623, in get_loc
    raise KeyError(key) from err
KeyError: 6
</code>```

I have tried to see where the error is by:

```<code>value = '6'
if value in matrix.index:
    print(matrix.loc[value])
else:
    print("Not in index")
</code>```

And it does populate and I have also tried:

```<code>matrix['6']
matrix.loc['6']
</code>```

and no error occurs. Is there any other possible reasons that this may be occuring?

I have tried to check if the index has the 'Start' and it did.

Body:
import pandas as pd
import numpy as np

df = pd.read_csv("ia-infect-dublin.csv", header = None)
df.columns = ['Person_ID', 'Contacted']

df = df.sort_values(by=['Person_ID', 'Contacted'])

unique = df['Person_ID'].unique()
unique = np.append(unique, ["Start"])

matrix = pd.DataFrame(0, columns=unique, index=unique, dtype=int)

l_group = df.groupby('Person_ID')

for name, group in l_group:
    i = 0
    for index, rows in group.iterrows():
        if i ==0:
            matrix.loc[['Start'], rows['Person_ID']] += 1
            previous_state = rows['Person_ID']
            i = 1
        else:
            matrix.loc[previous_state, rows['Person_ID']] += 1
print(matrix.head())

I am making a transition matrix of where it goes through the csv file and find the frequency of changes from one person to another. A -> B -> C -> D and adds the total count. However, I receive an error:

Traceback (most recent call last):
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3621, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 6

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/vydang/Documents/FA22/BMI5007/Homeworks/hw10/testing", line 23, in <module>
    matrix.loc[['Start'], rows['Person_ID']] += 1
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 961, in __getitem__
    return self._getitem_tuple(key)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 1140, in _getitem_tuple
    return self._getitem_lowerdim(tup)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 867, in _getitem_lowerdim
    section = self._getitem_axis(key, axis=i)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 1202, in _getitem_axis
    return self._get_label(key, axis=axis)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexing.py", line 1153, in _get_label
    return self.obj.xs(label, axis=axis)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py", line 3849, in xs
    return self[key]
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/frame.py", line 3505, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/vydang/opt/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3623, in get_loc
    raise KeyError(key) from err
KeyError: 6

I have tried to see where the error is by:

value = '6'
if value in matrix.index:
    print(matrix.loc[value])
else:
    print("Not in index")

And it does populate and I have also tried:

matrix['6']
matrix.loc['6']

and no error occurs. Is there any other possible reasons that this may be occuring?

I have tried to check if the index has the 'Start' and it did.


问:
Error while loading rust contract while creating sawtooth network
I was trying to load the hyperledger grid smart contract to sawtooth network

after successfully running the docker-compose file with 4 active validator, i am getting following error

I have just logs one contract details rest 5 is giving me same error
I have also created a issue on sawtooth git repo click HERE

```<code>➜  ~ docker logs tnt-contract-builder
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=958c6a9e7577f16c812a66fbdf0d860b74c36237808cfaabc7910548fb5c8c81451d6ad41a59a50d14af9a81b7569511443dd4dab6067a262a43a3517f52b270" }
Response Body:
StatusResponse {"data":[{"id": "958c6a9e7577f16c812a66fbdf0d860b74c36237808cfaabc7910548fb5c8c81451d6ad41a59a50d14af9a81b7569511443dd4dab6067a262a43a3517f52b270", "status": "PENDING", "invalid_transactions": []}], "link": "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=958c6a9e7577f16c812a66fbdf0d860b74c36237808cfaabc7910548fb5c8c81451d6ad41a59a50d14af9a81b7569511443dd4dab6067a262a43a3517f52b270&wait=30"}
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=dc410ca4b86c35a7ce37f5b82a0c3c7a8209b980ad4638e6120b47703ba0fe9f6b02f717b68c89fb640b6cfda0d3f2e81f80f8750163d417e61141c09fa5bd53" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=eb421c54bb740a278fbd65ef37879a2fa193b897828cac1f250c8b8060899ce516b19c13fa63b1f081222402f2563dba7d707aace5c33594f587e7c8d5a051d9" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=a6d84ff7056902908026264bc224c046290f99337770d2b6913a5f76fe8ed5814e5277dc5244b9564d4d12823dc56a2ae1f7c4986f6ac7344a19a20fc382e639" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=a33bd2e40a34aac8399a8c39bfe073129a8abcaf23575247a521106af8eba43104aff6743efe26300a8ff3854dac20ec74492722d1f321aa02cf320131e83ef2" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=9e6140c04c1bd0cf39e281754bf4f8508fc07ab40887250f75e2dd13f9eab3cd4bf7ccacb8d3de88e0f52258627adc709dceaa501d80a18268b9fac8c869fcfb" }
</code>```

this is my docker-compose file for creating sawtooth network and to load grid smart contract

```version: "3.6"

volumes:
  contracts-shared:
  grid-shared:
  pbft-shared:
  gridd-alpha:
  templates-shared:
  cache-shared:

services:
  # ---== shared services ==---

  sabre-cli:
    image: hyperledger/sawtooth-sabre-cli:latest
    volumes:
      - contracts-shared:/usr/share/scar
      - pbft-shared:/pbft-shared
    container_name: sabre-cli
    stop_signal: SIGKILL

  tnt-contract-builder:
    image: piashtanjin/tnt-contract-builder:latest
    container_name: tnt-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_track_and_trace --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/track_and_trace.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create a43b46  --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm a43b46 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid schema contract is loaded =========---------'
      "

  schema-contract-builder:
    image: piashtanjin/schema-contract-builder:latest
    container_name: schema-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_schema --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/schema.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee01 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_schema --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_schema --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid schema contract is loaded =========---------'
      "

  # pike-contract-builder:
  pike-contract-builder:
    image: piashtanjin/pike-contract-builder:latest
    container_name: pike-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_pike --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/pike.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee05 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_pike --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= pike contract is loaded =========---------'
      "

  product-contract-builder:
    image: piashtanjin/product-contract-builder:latest
    container_name: product-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_product --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/product.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee05 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee01 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee02 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_product --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_product --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee02 grid_product --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid_product contract is loaded =========---------'
      "

  location-contract-builder:
    image: piashtanjin/location-contract-builder:latest
    container_name: location-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_location --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/location.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee04 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_location --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_location --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee04 grid_location --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid_location contract is loaded =========---------'
      "
  purchase-order-contract-builder:
    image: piashtanjin/purchase-order-contract-builder:latest
    container_name: purchase-order-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_purchase_order --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/purchase_order.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee06 --key /pbft-shared/validators/validator --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_purchase_order --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee06 grid_purchase_order --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid_purchase_order contract is loaded =========---------'
      "
  # if [ ! -e sabre-admin.batch ]; then
  #     sawset proposal create \
  #         -k /root/.sawtooth/keys/my_key.priv \
  #         sawtooth.swa.administrators=$$(cat /pbft-shared/validators/validator-0.pub) \
  #         -o sabre-admin.batch
  #       sawadm genesis sabre-admin.batch
  validator-0:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-0
    expose:
      - 4004
      - 5050
      - 8800
    ports:
      - "4004:4004"
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-0.priv ]; then
          cp /pbft-shared/validators/validator-0.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-0.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-0.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-0.priv
        fi &&
        if [ ! -e config-genesis.batch ]; then
          sawset genesis -k /etc/sawtooth/keys/validator.priv -o config-genesis.batch
        fi &&
        while [[ ! -f /pbft-shared/validators/validator-1.pub || \
                 ! -f /pbft-shared/validators/validator-2.pub || \
                 ! -f /pbft-shared/validators/validator-3.pub || \
                 ! -f /pbft-shared/validators/validator-4.pub ]];
        do sleep 1; done
        echo sawtooth.consensus.pbft.members=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] &&
        if [ ! -e /root/.sawtooth/keys/my_key.priv ]; then
          sawtooth keygen my_key
        fi &&
        if [ ! -e config.batch ]; then
         sawset proposal create \
            -k /etc/sawtooth/keys/validator.priv \
            sawtooth.consensus.algorithm.name=pbft \
            sawtooth.consensus.algorithm.version=1.0 \
            sawtooth.validator.transaction_families='[{"family": "sabre", "version": "0.5"}, {"family":"sawtoo", "version":"1.0"}, {"family":"xo", "version":"1.0"}]' \
            sawtooth.identity.allowed_keys=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] \
            sawtooth.swa.administrators=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] \
            sawtooth.consensus.pbft.members=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] \
            sawtooth.publisher.max_batches_per_block=1200 \
            -o config.batch
        fi &&
        if [ ! -e /var/lib/sawtooth/genesis.batch ]; then
          sawadm genesis config-genesis.batch config.batch
        fi &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-0:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000
      "
  validator-1:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-1
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-1.priv ]; then
          cp /pbft-shared/validators/validator-1.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-1.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-1.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-1.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-1:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800
      "
  validator-2:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-2
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-2.priv ]; then
          cp /pbft-shared/validators/validator-2.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-2.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-2.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-2.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-2:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800 \
          --peers tcp://validator-1:8800
      "
  validator-3:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-3
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-3.priv ]; then
         cp /pbft-shared/validators/validator-3.pub /etc/sawtooth/keys/validator.pub
         cp /pbft-shared/validators/validator-3.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
         sawadm keygen
         mkdir -p /pbft-shared/validators || true
         cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-3.pub
         cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-3.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-3:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800 \
          --peers tcp://validator-1:8800 \
          --peers tcp://validator-2:8800
      "
  validator-4:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-4
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-4.priv ]; then
          cp /pbft-shared/validators/validator-4.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-4.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-4.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-4.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-4:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800 \
          --peers tcp://validator-1:8800 \
          --peers tcp://validator-2:8800 \
          --peers tcp://validator-3:8800
      "
  sawtooth-rest-api:
    image: hyperledger/sawtooth-rest-api:latest
    container_name: sawtooth-rest-api-default-0
    expose:
      - 8008
    ports:
      - "8008:8008"
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api \
          --connect tcp://validator-0:4004 \
          --bind sawtooth-rest-api:8008
      "
    stop_signal: SIGKILL

  sawtooth-rest-api1:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-1
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-1:4004 --bind sawtooth-rest-api1:8008
      "
    stop_signal: SIGKILL

  sawtooth-rest-api2:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-2
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-2:4004 --bind sawtooth-rest-api2:8008
      "
    stop_signal: SIGKILL
  sawtooth-rest-api3:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-3
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-3:4004 --bind sawtooth-rest-api3:8008
      "
    stop_signal: SIGKILL

  sawtooth-rest-api4:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-4
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-4:4004 --bind sawtooth-rest-api4:8008
      "
    stop_signal: SIGKILL

  sawtooth-settings-tp:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-0:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-1:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-1
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-1:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-2:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-2
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-2:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-3:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-3
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-3:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-4:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-4
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-4:4004
    stop_signal: SIGKILL

  sabre-tp:
    image: hyperledger/sawtooth-sabre-tp:0.8
    container_name: sawtooth-sabre-tp
    depends_on:
      - validator-0
    entrypoint: sawtooth-sabre -vv --connect tcp://validator-0:4004

  sawtooth-client:
    image: hyperledger/sawtooth-shell:nightly
    container_name: sawtooth-shell
    volumes:
      - pbft-shared:/pbft-shared
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth keygen &&
        tail -f /dev/null
      "
    stop_signal: SIGKILL
  pbft-0:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-0
    command: pbft-engine -vv --connect tcp://validator-0:5050
    stop_signal: SIGKILL

  pbft-1:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-1
    command: pbft-engine -vv --connect tcp://validator-1:5050
    stop_signal: SIGKILL

  pbft-2:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-2
    command: pbft-engine -vv --connect tcp://validator-2:5050
    stop_signal: SIGKILL

  pbft-3:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-3
    command: pbft-engine -vv --connect tcp://validator-3:5050
    stop_signal: SIGKILL

  pbft-4:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-4
    command: pbft-engine -vv --connect tcp://validator-4:5050
    stop_signal: SIGKILL

  # ---== alpha node ==---

  db-alpha:
    image: postgres
    container_name: db-alpha
    hostname: db-alpha
    restart: always
    expose:
      - 5432
    environment:
      POSTGRES_USER: grid
      POSTGRES_PASSWORD: grid_example
      POSTGRES_DB: grid

  gridd-alpha:
    image: gridd
    container_name: gridd-alpha
    hostname: gridd-alpha
    build:
      context: ../..
      dockerfile: daemon/Dockerfile
      args:
        - REPO_VERSION=${REPO_VERSION}
        - CARGO_ARGS= --features experimental
    volumes:
      - contracts-shared:/usr/share/scar
      - pbft-shared:/pbft-shared
      - gridd-alpha:/etc/grid/keys
      - cache-shared:/var/cache/grid
    expose:
      - 8080
    ports:
      - "8080:8080"
    environment:
      GRID_DAEMON_KEY: "alpha-agent"
      GRID_DAEMON_ENDPOINT: "http://gridd-alpha:8080"
    entrypoint: |
      bash -c "
        # we need to wait for the db to have started.
        until PGPASSWORD=grid_example psql -h db-alpha -U grid -c '\q' > /dev/null 2>&1; do
            >&2 echo \"Database is unavailable - sleeping\"
            sleep 1
        done
        grid keygen --skip && \
        grid keygen --system --skip && \
        grid -vv database migrate \
            -C postgres://grid:grid_example@db-alpha/grid &&
        gridd -vv -b 0.0.0.0:8080 -k root -C tcp://validator-0:4004 \
            --database-url postgres://grid:grid_example@db-alpha/grid
      "
```

Body:
I was trying to load the hyperledger grid smart contract to sawtooth network

after successfully running the docker-compose file with 4 active validator, i am getting following error

I have just logs one contract details rest 5 is giving me same error
I have also created a issue on sawtooth git repo click HERE

➜  ~ docker logs tnt-contract-builder
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=958c6a9e7577f16c812a66fbdf0d860b74c36237808cfaabc7910548fb5c8c81451d6ad41a59a50d14af9a81b7569511443dd4dab6067a262a43a3517f52b270" }
Response Body:
StatusResponse {"data":[{"id": "958c6a9e7577f16c812a66fbdf0d860b74c36237808cfaabc7910548fb5c8c81451d6ad41a59a50d14af9a81b7569511443dd4dab6067a262a43a3517f52b270", "status": "PENDING", "invalid_transactions": []}], "link": "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=958c6a9e7577f16c812a66fbdf0d860b74c36237808cfaabc7910548fb5c8c81451d6ad41a59a50d14af9a81b7569511443dd4dab6067a262a43a3517f52b270&wait=30"}
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=dc410ca4b86c35a7ce37f5b82a0c3c7a8209b980ad4638e6120b47703ba0fe9f6b02f717b68c89fb640b6cfda0d3f2e81f80f8750163d417e61141c09fa5bd53" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=eb421c54bb740a278fbd65ef37879a2fa193b897828cac1f250c8b8060899ce516b19c13fa63b1f081222402f2563dba7d707aace5c33594f587e7c8d5a051d9" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=a6d84ff7056902908026264bc224c046290f99337770d2b6913a5f76fe8ed5814e5277dc5244b9564d4d12823dc56a2ae1f7c4986f6ac7344a19a20fc382e639" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=a33bd2e40a34aac8399a8c39bfe073129a8abcaf23575247a521106af8eba43104aff6743efe26300a8ff3854dac20ec74492722d1f321aa02cf320131e83ef2" }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Response Body:
Link { link: "http://sawtooth-rest-api-default-0:8008/batch_statuses?id=9e6140c04c1bd0cf39e281754bf4f8508fc07ab40887250f75e2dd13f9eab3cd4bf7ccacb8d3de88e0f52258627adc709dceaa501d80a18268b9fac8c869fcfb" }

this is my docker-compose file for creating sawtooth network and to load grid smart contract

version: "3.6"

volumes:
  contracts-shared:
  grid-shared:
  pbft-shared:
  gridd-alpha:
  templates-shared:
  cache-shared:

services:
  # ---== shared services ==---

  sabre-cli:
    image: hyperledger/sawtooth-sabre-cli:latest
    volumes:
      - contracts-shared:/usr/share/scar
      - pbft-shared:/pbft-shared
    container_name: sabre-cli
    stop_signal: SIGKILL

  tnt-contract-builder:
    image: piashtanjin/tnt-contract-builder:latest
    container_name: tnt-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_track_and_trace --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/track_and_trace.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create a43b46  --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm a43b46 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_track_and_trace --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid schema contract is loaded =========---------'
      "

  schema-contract-builder:
    image: piashtanjin/schema-contract-builder:latest
    container_name: schema-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_schema --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/schema.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee01 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_schema --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_schema --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid schema contract is loaded =========---------'
      "

  # pike-contract-builder:
  pike-contract-builder:
    image: piashtanjin/pike-contract-builder:latest
    container_name: pike-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_pike --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/pike.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee05 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_pike --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= pike contract is loaded =========---------'
      "

  product-contract-builder:
    image: piashtanjin/product-contract-builder:latest
    container_name: product-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_product --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/product.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee05 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee01 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee02 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_product --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_product --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee02 grid_product --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid_product contract is loaded =========---------'
      "

  location-contract-builder:
    image: piashtanjin/location-contract-builder:latest
    container_name: location-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_location --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/location.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee04 --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_location --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee01 grid_location --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee04 grid_location --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid_location contract is loaded =========---------'
      "
  purchase-order-contract-builder:
    image: piashtanjin/purchase-order-contract-builder:latest
    container_name: purchase-order-contract-builder
    volumes:
      - pbft-shared:/pbft-shared
    entrypoint: |
      bash -c "
        while true; do curl -s http://sawtooth-rest-api-default-0:8008/state | grep -q head; if [ $$? -eq 0 ]; then break; fi; sleep 0.5; done;
        sabre cr --create grid_purchase_order --key /pbft-shared/validators/validator-0 --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre upload --filename /tmp/purchase_order.yaml --key /pbft-shared/validators/validator-0 --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre ns --create 621dee06 --key /pbft-shared/validators/validator --owner $$(cat /pbft-shared/validators/validator-0.pub) --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee05 grid_purchase_order --key /pbft-shared/validators/validator-0 --read --url http://sawtooth-rest-api-default-0:8008 --wait 30
        sabre perm 621dee06 grid_purchase_order --key /pbft-shared/validators/validator-0 --read --write --url http://sawtooth-rest-api-default-0:8008 --wait 30
        echo '---------========= grid_purchase_order contract is loaded =========---------'
      "
  # if [ ! -e sabre-admin.batch ]; then
  #     sawset proposal create \
  #         -k /root/.sawtooth/keys/my_key.priv \
  #         sawtooth.swa.administrators=$$(cat /pbft-shared/validators/validator-0.pub) \
  #         -o sabre-admin.batch
  #       sawadm genesis sabre-admin.batch
  validator-0:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-0
    expose:
      - 4004
      - 5050
      - 8800
    ports:
      - "4004:4004"
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-0.priv ]; then
          cp /pbft-shared/validators/validator-0.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-0.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-0.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-0.priv
        fi &&
        if [ ! -e config-genesis.batch ]; then
          sawset genesis -k /etc/sawtooth/keys/validator.priv -o config-genesis.batch
        fi &&
        while [[ ! -f /pbft-shared/validators/validator-1.pub || \
                 ! -f /pbft-shared/validators/validator-2.pub || \
                 ! -f /pbft-shared/validators/validator-3.pub || \
                 ! -f /pbft-shared/validators/validator-4.pub ]];
        do sleep 1; done
        echo sawtooth.consensus.pbft.members=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] &&
        if [ ! -e /root/.sawtooth/keys/my_key.priv ]; then
          sawtooth keygen my_key
        fi &&
        if [ ! -e config.batch ]; then
         sawset proposal create \
            -k /etc/sawtooth/keys/validator.priv \
            sawtooth.consensus.algorithm.name=pbft \
            sawtooth.consensus.algorithm.version=1.0 \
            sawtooth.validator.transaction_families='[{"family": "sabre", "version": "0.5"}, {"family":"sawtoo", "version":"1.0"}, {"family":"xo", "version":"1.0"}]' \
            sawtooth.identity.allowed_keys=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] \
            sawtooth.swa.administrators=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] \
            sawtooth.consensus.pbft.members=\\['\"'$$(cat /pbft-shared/validators/validator-0.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-1.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-2.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-3.pub)'\"','\"'$$(cat /pbft-shared/validators/validator-4.pub)'\"'\\] \
            sawtooth.publisher.max_batches_per_block=1200 \
            -o config.batch
        fi &&
        if [ ! -e /var/lib/sawtooth/genesis.batch ]; then
          sawadm genesis config-genesis.batch config.batch
        fi &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-0:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000
      "
  validator-1:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-1
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-1.priv ]; then
          cp /pbft-shared/validators/validator-1.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-1.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-1.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-1.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-1:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800
      "
  validator-2:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-2
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-2.priv ]; then
          cp /pbft-shared/validators/validator-2.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-2.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-2.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-2.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-2:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800 \
          --peers tcp://validator-1:8800
      "
  validator-3:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-3
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-3.priv ]; then
         cp /pbft-shared/validators/validator-3.pub /etc/sawtooth/keys/validator.pub
         cp /pbft-shared/validators/validator-3.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
         sawadm keygen
         mkdir -p /pbft-shared/validators || true
         cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-3.pub
         cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-3.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-3:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800 \
          --peers tcp://validator-1:8800 \
          --peers tcp://validator-2:8800
      "
  validator-4:
    image: hyperledger/sawtooth-validator:nightly
    container_name: sawtooth-validator-default-4
    expose:
      - 4004
      - 5050
      - 8800
    volumes:
      - pbft-shared:/pbft-shared
    command: |
      bash -c "
        if [ -e /pbft-shared/validators/validator-4.priv ]; then
          cp /pbft-shared/validators/validator-4.pub /etc/sawtooth/keys/validator.pub
          cp /pbft-shared/validators/validator-4.priv /etc/sawtooth/keys/validator.priv
        fi &&
        if [ ! -e /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          mkdir -p /pbft-shared/validators || true
          cp /etc/sawtooth/keys/validator.pub /pbft-shared/validators/validator-4.pub
          cp /etc/sawtooth/keys/validator.priv /pbft-shared/validators/validator-4.priv
        fi &&
        sawtooth keygen my_key &&
        sawtooth-validator -vv \
          --endpoint tcp://validator-4:8800 \
          --bind component:tcp://eth0:4004 \
          --bind consensus:tcp://eth0:5050 \
          --bind network:tcp://eth0:8800 \
          --scheduler parallel \
          --peering static \
          --maximum-peer-connectivity 10000 \
          --peers tcp://validator-0:8800 \
          --peers tcp://validator-1:8800 \
          --peers tcp://validator-2:8800 \
          --peers tcp://validator-3:8800
      "
  sawtooth-rest-api:
    image: hyperledger/sawtooth-rest-api:latest
    container_name: sawtooth-rest-api-default-0
    expose:
      - 8008
    ports:
      - "8008:8008"
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api \
          --connect tcp://validator-0:4004 \
          --bind sawtooth-rest-api:8008
      "
    stop_signal: SIGKILL

  sawtooth-rest-api1:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-1
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-1:4004 --bind sawtooth-rest-api1:8008
      "
    stop_signal: SIGKILL

  sawtooth-rest-api2:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-2
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-2:4004 --bind sawtooth-rest-api2:8008
      "
    stop_signal: SIGKILL
  sawtooth-rest-api3:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-3
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-3:4004 --bind sawtooth-rest-api3:8008
      "
    stop_signal: SIGKILL

  sawtooth-rest-api4:
    image: hyperledger/sawtooth-rest-api:nightly
    container_name: sawtooth-rest-api-4
    expose:
      - 8008
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth-rest-api -v --connect tcp://validator-4:4004 --bind sawtooth-rest-api4:8008
      "
    stop_signal: SIGKILL

  sawtooth-settings-tp:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-0:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-1:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-1
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-1:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-2:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-2
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-2:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-3:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-3
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-3:4004
    stop_signal: SIGKILL

  sawtooth-settings-tp-4:
    image: hyperledger/sawtooth-settings-tp:latest
    container_name: sawtooth-settings-tp-4
    expose:
      - 4004
    command: settings-tp -v -C tcp://validator-4:4004
    stop_signal: SIGKILL

  sabre-tp:
    image: hyperledger/sawtooth-sabre-tp:0.8
    container_name: sawtooth-sabre-tp
    depends_on:
      - validator-0
    entrypoint: sawtooth-sabre -vv --connect tcp://validator-0:4004

  sawtooth-client:
    image: hyperledger/sawtooth-shell:nightly
    container_name: sawtooth-shell
    volumes:
      - pbft-shared:/pbft-shared
    depends_on:
      - validator-0
    command: |
      bash -c "
        sawtooth keygen &&
        tail -f /dev/null
      "
    stop_signal: SIGKILL
  pbft-0:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-0
    command: pbft-engine -vv --connect tcp://validator-0:5050
    stop_signal: SIGKILL

  pbft-1:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-1
    command: pbft-engine -vv --connect tcp://validator-1:5050
    stop_signal: SIGKILL

  pbft-2:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-2
    command: pbft-engine -vv --connect tcp://validator-2:5050
    stop_signal: SIGKILL

  pbft-3:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-3
    command: pbft-engine -vv --connect tcp://validator-3:5050
    stop_signal: SIGKILL

  pbft-4:
    image: hyperledger/sawtooth-pbft-engine:nightly
    container_name: sawtooth-pbft-engine-default-4
    command: pbft-engine -vv --connect tcp://validator-4:5050
    stop_signal: SIGKILL

  # ---== alpha node ==---

  db-alpha:
    image: postgres
    container_name: db-alpha
    hostname: db-alpha
    restart: always
    expose:
      - 5432
    environment:
      POSTGRES_USER: grid
      POSTGRES_PASSWORD: grid_example
      POSTGRES_DB: grid

  gridd-alpha:
    image: gridd
    container_name: gridd-alpha
    hostname: gridd-alpha
    build:
      context: ../..
      dockerfile: daemon/Dockerfile
      args:
        - REPO_VERSION=${REPO_VERSION}
        - CARGO_ARGS= --features experimental
    volumes:
      - contracts-shared:/usr/share/scar
      - pbft-shared:/pbft-shared
      - gridd-alpha:/etc/grid/keys
      - cache-shared:/var/cache/grid
    expose:
      - 8080
    ports:
      - "8080:8080"
    environment:
      GRID_DAEMON_KEY: "alpha-agent"
      GRID_DAEMON_ENDPOINT: "http://gridd-alpha:8080"
    entrypoint: |
      bash -c "
        # we need to wait for the db to have started.
        until PGPASSWORD=grid_example psql -h db-alpha -U grid -c '\q' > /dev/null 2>&1; do
            >&2 echo \"Database is unavailable - sleeping\"
            sleep 1
        done
        grid keygen --skip && \
        grid keygen --system --skip && \
        grid -vv database migrate \
            -C postgres://grid:grid_example@db-alpha/grid &&
        gridd -vv -b 0.0.0.0:8080 -k root -C tcp://validator-0:4004 \
            --database-url postgres://grid:grid_example@db-alpha/grid
      "


问:
Get object data out of this databaseReference.addValueEventListener in java android
here is the samplae code what I want to do is, get json object or string out of this data databaseReference.addValueEventListener(new ValueEventListener() thing and use it anywhere I want not only inside this database thing

```<code>
import android.os.Build;
import android.os.Bundle;

import android.util.Log;
import android.widget.Button;

import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.gson.Gson;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Objects;

public class MainActivity extends AppCompatActivity {
    FirebaseDatabase firebaseDatabase;
    DatabaseReference databaseReference;

    Button photo;
    public String da;
    public String fx;
    Object databaseValues;

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        photo = findViewById(R.id.light);
        firebaseDatabase = FirebaseDatabase.getInstance();
        databaseReference = firebaseDatabase.getReference();
        databaseReference.addValueEventListener(new ValueEventListener() {
            @RequiresApi(api = Build.VERSION_CODES.S)
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                databaseValues = snapshot.getValue(Object.class);
                String value = new Gson().toJson(databaseValues);
                JSONObject jsonObj;

                try {
                    jsonObj = new JSONObject(value);
                    da = jsonObj.getString("test");
                    Log.i("databaseValue inside: ", da);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {
                Toast.makeText(MainActivity.this, "Fail to get data.", Toast.LENGTH_SHORT).show();
            }
        });

        try {
            String value = new Gson().toJson(databaseValues);
            JSONObject jsonObj;
            jsonObj = new JSONObject(value);
            fx = jsonObj.getString("test");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (Objects.equals(da, "found")) {
            photo.setBackgroundColor(getResources().getColor(R.color.white));
        }
        if (da == null){
            Log.i("databaseValue: ", "null");
        } else {
            Log.i("databaseValue: ", da);
        }
        if (fx == null){
            Log.i("fx: ", "null");
        } else {
            Log.i("fx: ", fx);
        }
    }
}
</code>```

I'm getting databaseValue null and fx null but databaseVale inside is found, i want this data to be outside.

Body:
here is the samplae code what I want to do is, get json object or string out of this data databaseReference.addValueEventListener(new ValueEventListener() thing and use it anywhere I want not only inside this database thing

import android.os.Build;
import android.os.Bundle;

import android.util.Log;
import android.widget.Button;

import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.gson.Gson;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Objects;

public class MainActivity extends AppCompatActivity {
    FirebaseDatabase firebaseDatabase;
    DatabaseReference databaseReference;

    Button photo;
    public String da;
    public String fx;
    Object databaseValues;

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        photo = findViewById(R.id.light);
        firebaseDatabase = FirebaseDatabase.getInstance();
        databaseReference = firebaseDatabase.getReference();
        databaseReference.addValueEventListener(new ValueEventListener() {
            @RequiresApi(api = Build.VERSION_CODES.S)
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                databaseValues = snapshot.getValue(Object.class);
                String value = new Gson().toJson(databaseValues);
                JSONObject jsonObj;

                try {
                    jsonObj = new JSONObject(value);
                    da = jsonObj.getString("test");
                    Log.i("databaseValue inside: ", da);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onCancelled(@NonNull DatabaseError error) {
                Toast.makeText(MainActivity.this, "Fail to get data.", Toast.LENGTH_SHORT).show();
            }
        });

        try {
            String value = new Gson().toJson(databaseValues);
            JSONObject jsonObj;
            jsonObj = new JSONObject(value);
            fx = jsonObj.getString("test");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (Objects.equals(da, "found")) {
            photo.setBackgroundColor(getResources().getColor(R.color.white));
        }
        if (da == null){
            Log.i("databaseValue: ", "null");
        } else {
            Log.i("databaseValue: ", da);
        }
        if (fx == null){
            Log.i("fx: ", "null");
        } else {
            Log.i("fx: ", fx);
        }
    }
}

I'm getting databaseValue null and fx null but databaseVale inside is found, i want this data to be outside.


问:
How to pass data to std430 alignment buffer object
I defined these two structs in glsl:

```<code>struct Triangle{
    vec3[3] vertices;
    vec3 norm;
    vec3 color;
    mat4 model;
};
struct Sphere{
    vec3 centre;
    float radius;
    vec3 color;
    mat4 model;
};
</code>```

correspondingly,I defined these two structs in client like this:

```<code>struct Triangle {
    glm::vec3 vertices[3];
    glm::vec3 norm;
    glm::vec3 color;
    glm::mat4 model;
};
struct Sphere {
    glm::vec3 centre;
    float radius;
    glm::vec3 color;
    glm::mat4 model;
};
</code>```

Now, I want to pass my data to glsl through buffer object:

```<code>layout(binding = 0, std430) buffer Triangles{
    Triangle[] triangles;
};
layout(binding = 1,std430) buffer Spheres{
    Sphere[] spheres;
};
</code>```

but I don't know clearly how to do it with regard to alignment. I calculate the space and paddding in this way:

for Triangle, the members of it can be splitted like this:

```<code>struct Triangle{
    vec3[3] vertices; // because it's an array, so vec3 will not be rounded up to vec4, so it is 3 * 4 = 12 bytes,starts at 0
    vec3 norm; //4 * 4 = 16,starts at 12*3=36. (4*4 not 3*4 because norm is not a member of an array)
    vec3 color; // 4 * 4 = 16, starts at 36+16=52
    vec4[4] mat; // 4 * 4 = 16,starts at 52+16=68
};// whole size is 68+64 = 132, ignoring end padding.
</code>```

the max size member's size is 16, so each triangle in an array should start at 16x position, and a 16x9 - 132 = 12 bytes will be added to the end of each of them.
And for Sphere, it is similar.
After mapping the buffer's address to pointer p (Triangle*), I can pass my data to glsl through this way:

```<code>for(int i=0;i<triangle_count;i++){
    memcpy(p,triangles + i,144);//triangles[n]
    p++;
}
</code>```

C/C++ has layout rules for members of a struct, but as Pods for glm::vec3, glm::mat4 are both float, so there will be no padding between members in Triangle storage, so that why I can copy a whole triangle to p instead of doing it member by member.
I don'w know whether my analysis is correct. I just share my understanding here and hope some one can point out my errors and other readers can gain something from my analysis.

Body:
I defined these two structs in glsl:

struct Triangle{
    vec3[3] vertices;
    vec3 norm;
    vec3 color;
    mat4 model;
};
struct Sphere{
    vec3 centre;
    float radius;
    vec3 color;
    mat4 model;
};

correspondingly,I defined these two structs in client like this:

struct Triangle {
    glm::vec3 vertices[3];
    glm::vec3 norm;
    glm::vec3 color;
    glm::mat4 model;
};
struct Sphere {
    glm::vec3 centre;
    float radius;
    glm::vec3 color;
    glm::mat4 model;
};

Now, I want to pass my data to glsl through buffer object:

layout(binding = 0, std430) buffer Triangles{
    Triangle[] triangles;
};
layout(binding = 1,std430) buffer Spheres{
    Sphere[] spheres;
};

but I don't know clearly how to do it with regard to alignment. I calculate the space and paddding in this way:

for Triangle, the members of it can be splitted like this:

struct Triangle{
    vec3[3] vertices; // because it's an array, so vec3 will not be rounded up to vec4, so it is 3 * 4 = 12 bytes,starts at 0
    vec3 norm; //4 * 4 = 16,starts at 12*3=36. (4*4 not 3*4 because norm is not a member of an array)
    vec3 color; // 4 * 4 = 16, starts at 36+16=52
    vec4[4] mat; // 4 * 4 = 16,starts at 52+16=68
};// whole size is 68+64 = 132, ignoring end padding.

the max size member's size is 16, so each triangle in an array should start at 16x position, and a 16x9 - 132 = 12 bytes will be added to the end of each of them.
And for Sphere, it is similar.
After mapping the buffer's address to pointer p (Triangle*), I can pass my data to glsl through this way:

for(int i=0;i<triangle_count;i++){
    memcpy(p,triangles + i,144);//triangles[n]
    p++;
}

C/C++ has layout rules for members of a struct, but as Pods for glm::vec3, glm::mat4 are both float, so there will be no padding between members in Triangle storage, so that why I can copy a whole triangle to p instead of doing it member by member.
I don'w know whether my analysis is correct. I just share my understanding here and hope some one can point out my errors and other readers can gain something from my analysis.


问:
Getting no answer in Inverse Laplace Transform using Jupyter
I'm using Jupyter online notebook and I'm trying to get the inverse laplace transform the function and I got no answer. I executed the code below:

```<code>from sympy import *

s=symbols('s')
t=symbols('t')
u=symbols('u')
o=symbols('o')
x=symbols('x')

f3=exp((1/o**2)*(u - sqrt(2*s*o**2+u**2))*x)

inverse_laplace_transform(f3,s,t)
</code>```

However, i got this answer:

Can you help me how to find the closed form of this answer? Any idea why this happened?

Body:
I'm using Jupyter online notebook and I'm trying to get the inverse laplace transform the function and I got no answer. I executed the code below:

from sympy import *

s=symbols('s')
t=symbols('t')
u=symbols('u')
o=symbols('o')
x=symbols('x')

f3=exp((1/o**2)*(u - sqrt(2*s*o**2+u**2))*x)

inverse_laplace_transform(f3,s,t)

However, i got this answer:

Can you help me how to find the closed form of this answer? Any idea why this happened?


问:
apple script- email transmission containing groups of 20 attachments taken from a folder containing 1000 files
sorry I didn't paste my piece of code but I don't know where to start... I'm talking about apple script. I've found some code to send emails and I would like to implement a script that does what I'm about to write.
I have a folder that contains about 1000 pdf files that I have to send in groups of 20 at a time via email.
I have a bit of confusion in my head but conceptually I think it can be done by counting all the files in the folder, then every 20 files I take the respective file names and set a variable with these names, including the path and I send the first email, then I proceed with the other 20 and so on until it has completed the number of files in the folder. Is there someone who can help me? A thousand thanks!!
I am attaching the portion of code relating to sending via email...

I tried the given code and it works. it sends the email but i didn't check if it sends attachment

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

tell application "Mail"

```<code>set theFrom to ""
set theTos to {""}
set theCcs to {}
set theBccs to {}

set theSubject to ""
set theContent to ""
set theSignature to ""
set theAttachments to {}
set theDelay to 1

set theMessage to make new outgoing message with properties {sender:theFrom, subject:theSubject, content:theContent, visible:false}
tell theMessage
    repeat with theTo in theTos
        make new recipient at end of to recipients with properties {address:theTo}
    end repeat
    repeat with theCc in theCcs
        make new cc recipient at end of cc recipients with properties {address:theCc}
    end repeat
    repeat with theBcc in theBccs
        make new bcc recipient at end of bcc recipients with properties {address:theBcc}
    end repeat
    repeat with theAttachment in theAttachments
        make new attachment with properties {file name:theAttachment as alias} at after last paragraph
        delay theDelay
    end repeat
end tell

# macOS 10.12+ know bug
# https://stackoverflow.com/questions/39860859/setting-message-signature-of-outgoing-message-using-applescript
# set message signature of theMessage to signature theSignature

send theMessage
</code>```

end tell

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

Body:
sorry I didn't paste my piece of code but I don't know where to start... I'm talking about apple script. I've found some code to send emails and I would like to implement a script that does what I'm about to write.
I have a folder that contains about 1000 pdf files that I have to send in groups of 20 at a time via email.
I have a bit of confusion in my head but conceptually I think it can be done by counting all the files in the folder, then every 20 files I take the respective file names and set a variable with these names, including the path and I send the first email, then I proceed with the other 20 and so on until it has completed the number of files in the folder. Is there someone who can help me? A thousand thanks!!
I am attaching the portion of code relating to sending via email...

I tried the given code and it works. it sends the email but i didn't check if it sends attachment

`

tell application "Mail"

set theFrom to ""
set theTos to {""}
set theCcs to {}
set theBccs to {}

set theSubject to ""
set theContent to ""
set theSignature to ""
set theAttachments to {}
set theDelay to 1

set theMessage to make new outgoing message with properties {sender:theFrom, subject:theSubject, content:theContent, visible:false}
tell theMessage
    repeat with theTo in theTos
        make new recipient at end of to recipients with properties {address:theTo}
    end repeat
    repeat with theCc in theCcs
        make new cc recipient at end of cc recipients with properties {address:theCc}
    end repeat
    repeat with theBcc in theBccs
        make new bcc recipient at end of bcc recipients with properties {address:theBcc}
    end repeat
    repeat with theAttachment in theAttachments
        make new attachment with properties {file name:theAttachment as alias} at after last paragraph
        delay theDelay
    end repeat
end tell

# macOS 10.12+ know bug
# https://stackoverflow.com/questions/39860859/setting-message-signature-of-outgoing-message-using-applescript
# set message signature of theMessage to signature theSignature

send theMessage

end tell

`


问:
Laravel PHPWord "Method loadfile is not defined." (.../vendor/phpoffice/phpword/src/PhpWord/PhpWord.php:148)
Trying this to load a .docx file for eventual conversion to pdf,
and PhpWord can't seem to find the loadFile function.

```<code>use PhpOffice\PhpWord\PhpWord;

...

$phpWord = new PhpWord();
$document = $phpWord->loadFile($filePath);
</code>```

Tried reinstalling PhpWord with composer & using Settings:: methods from PhpWord.

The __call function in PhpWord.php which is throwing the error:

```<code> public function __call($function, $args)
    {
        $function = strtolower($function);

        $getCollection = [];
        $addCollection = [];
        $addStyle = [];

        $collections = ['Bookmark', 'Title', 'Footnote', 'Endnote', 'Chart', 'Comment'];
        foreach ($collections as $collection) {
            $getCollection[] = strtolower("get{$collection}s");
            $addCollection[] = strtolower("add{$collection}");
        }

        $styles = ['Paragraph', 'Font', 'Table', 'Numbering', 'Link', 'Title'];
        foreach ($styles as $style) {
            $addStyle[] = strtolower("add{$style}Style");
        }

        // Run get collection method
        if (in_array($function, $getCollection)) {
            $key = ucfirst(str_replace('get', '', $function));

            return $this->collections[$key];
        }

        // Run add collection item method
        if (in_array($function, $addCollection)) {
            $key = ucfirst(str_replace('add', '', $function) . 's');

            /** @var \PhpOffice\PhpWord\Collection\AbstractCollection $collectionObject */
            $collectionObject = $this->collections[$key];

            return $collectionObject->addItem($args[0] ?? null);
        }

        // Run add style method
        if (in_array($function, $addStyle)) {
            return forward_static_call_array(['PhpOffice\\PhpWord\\Style', $function], $args);
        }

        // Exception
        throw new BadMethodCallException("Method $function is not defined.");
    }
</code>```

Body:
Trying this to load a .docx file for eventual conversion to pdf,
and PhpWord can't seem to find the loadFile function.

use PhpOffice\PhpWord\PhpWord;

...

$phpWord = new PhpWord();
$document = $phpWord->loadFile($filePath);

Tried reinstalling PhpWord with composer & using Settings:: methods from PhpWord.

The __call function in PhpWord.php which is throwing the error:

 public function __call($function, $args)
    {
        $function = strtolower($function);

        $getCollection = [];
        $addCollection = [];
        $addStyle = [];

        $collections = ['Bookmark', 'Title', 'Footnote', 'Endnote', 'Chart', 'Comment'];
        foreach ($collections as $collection) {
            $getCollection[] = strtolower("get{$collection}s");
            $addCollection[] = strtolower("add{$collection}");
        }

        $styles = ['Paragraph', 'Font', 'Table', 'Numbering', 'Link', 'Title'];
        foreach ($styles as $style) {
            $addStyle[] = strtolower("add{$style}Style");
        }

        // Run get collection method
        if (in_array($function, $getCollection)) {
            $key = ucfirst(str_replace('get', '', $function));

            return $this->collections[$key];
        }

        // Run add collection item method
        if (in_array($function, $addCollection)) {
            $key = ucfirst(str_replace('add', '', $function) . 's');

            /** @var \PhpOffice\PhpWord\Collection\AbstractCollection $collectionObject */
            $collectionObject = $this->collections[$key];

            return $collectionObject->addItem($args[0] ?? null);
        }

        // Run add style method
        if (in_array($function, $addStyle)) {
            return forward_static_call_array(['PhpOffice\\PhpWord\\Style', $function], $args);
        }

        // Exception
        throw new BadMethodCallException("Method $function is not defined.");
    }


问:
discord.py "leaderboard" with mysql database I end up with KeyError
Im getting KeyError and im so lost what to do to resolve it,
code that I currently have is this and it gets KeyError at user = table[0] as well at dist = table[1]

In my point of view it should work, but obviously my point of view is not good then.

```<code>
</code>```
```<code>@commands.command()
async def test(self, ctx):
    mydb = mysql.connector.connect(host = Config.host, user = Config.user, password = Config.password, database = Config.database)
    cursor = mydb.cursor(dictionary=True)

    cursor.execute("SELECT name, longest FROM members ORDER BY longest DESC LIMIT 5")
    data = cursor.fetchall()
    if data:
        embed = discord.Embed(
            title=f"test",
            description=f"lb",
            color=0xff0000
        )
        rank = 0
        for table in data:
            rank += 1
            user = table[0]
            dist = table[1]
            embed.add_field(name = f"{rank}. {user}", value = f"{dist}", inline = False )
        embed.set_footer(text="Custom Economy System")
        await ctx.send(embed=embed)
    else:
        await ctx.send("No data!")

    cursor.close()
    mydb.close()
</code>```
```<code>
</code>```

I have tried to use different sql execution even tried to use

```<code>enumerate()
</code>```

There are so many examples with .json file and I don't want .json data management, for me thats broken deal.

Body:
Im getting KeyError and im so lost what to do to resolve it,
code that I currently have is this and it gets KeyError at user = table[0] as well at dist = table[1]

In my point of view it should work, but obviously my point of view is not good then.

@commands.command()
async def test(self, ctx):
    mydb = mysql.connector.connect(host = Config.host, user = Config.user, password = Config.password, database = Config.database)
    cursor = mydb.cursor(dictionary=True)

    cursor.execute("SELECT name, longest FROM members ORDER BY longest DESC LIMIT 5")
    data = cursor.fetchall()
    if data:
        embed = discord.Embed(
            title=f"test",
            description=f"lb",
            color=0xff0000
        )
        rank = 0
        for table in data:
            rank += 1
            user = table[0]
            dist = table[1]
            embed.add_field(name = f"{rank}. {user}", value = f"{dist}", inline = False )
        embed.set_footer(text="Custom Economy System")
        await ctx.send(embed=embed)
    else:
        await ctx.send("No data!")

    cursor.close()
    mydb.close()

I have tried to use different sql execution even tried to use

enumerate()

There are so many examples with .json file and I don't want .json data management, for me thats broken deal.


问:
How to display every other character in a string starting with the first character in NASM assembly?
I am very new to NASM assembly programming find it very confusing, so I was wondering if I could ask for help in creating a NASM program which displays every other character in a preset string (starting with the first character)?

Input: helloworld

Output: hlool

I know that in higher programming languages like C, you would need to create a variable index = 0, and then increment the value of the index by 2 in order to skip the next character.

```<code>for (int index = 0; index < len; index +=2){
printf("%c", str[index]);
}
</code>```

But I am quite lost trying to figure out how to translate this logic into NASM assembly language. Thank you very much in advanced for any help regarding this!

Body:
I am very new to NASM assembly programming find it very confusing, so I was wondering if I could ask for help in creating a NASM program which displays every other character in a preset string (starting with the first character)?

Input: helloworld

Output: hlool

I know that in higher programming languages like C, you would need to create a variable index = 0, and then increment the value of the index by 2 in order to skip the next character.

for (int index = 0; index < len; index +=2){
printf("%c", str[index]);
}

But I am quite lost trying to figure out how to translate this logic into NASM assembly language. Thank you very much in advanced for any help regarding this!