问:
Live data returning old values , onChanged is triggering multiple times
I am using live data to update some view of the activity. the view contain question numbers both total question number and answered question number
 eg: 2/10 (answered/total)
the questions can be filtered using actors, if no actor is selected then it will list all questions (consider the total questions number as 100) then if I am selecting any actor(like a developer, HR) then the questions total number is reduced to another value something less than 100 (like 20 )
the total count is returned using the dao method

```<code> @Query("SELECT COUNT(actor) FROM questions WHERE actor IN (:actors)")
    LiveData<Integer> getNumberOfQuestions(String[] actors);
</code>```

here String[] actors is the selected actor list

Using an observer

```<code>questionsViewModel.getTotalQuestionCount(mCheckedActorList).observe(this, new Observer<Integer>() {
            @Override
            public void onChanged(@Nullable Integer countTotal) {
                if (countTotal != null)
                    mTotalCount = String.valueOf(countTotal);
                if (mAnswerCount != null && mTotalCount != null)
                    mAllQuestionAnswered.setText(mAnswerCount.concat("/").concat(mTotalCount));

            }
        });
</code>```

I am observing the count, but consider the scenario

no filter applied (no actor selected,count =100)

actor developer is selected (count = 20)

onchanged in the first case returns 100 and in second it returns 100  and 20
 I only want the current value, ie 20 how can solve this? what am I doing wrong?

in view model

```<code> public LiveData<Integer> getTotalQuestionCount(List<String> actorsList) {
        if (actorsList != null && actorsList.size() > 0) {
            String[] actorArray = new String[actorsList.size()];
            actorArray = actorsList.toArray(actorArray);
            return questionsRepository.getTotalCount(actorArray);

        } else {
            return questionsRepository.getTotalCount();
        }
    }
</code>```

答:
Just call

```<code>questionsViewModel.getTotalQuestionCount(mCheckedActorList).setValue(null)
</code>```

before calling view model this will clear the previous value

Body:
I am using live data to update some view of the activity. the view contain question numbers both total question number and answered question number
 eg: 2/10 (answered/total)
the questions can be filtered using actors, if no actor is selected then it will list all questions (consider the total questions number as 100) then if I am selecting any actor(like a developer, HR) then the questions total number is reduced to another value something less than 100 (like 20 )
the total count is returned using the dao method

 @Query("SELECT COUNT(actor) FROM questions WHERE actor IN (:actors)")
    LiveData<Integer> getNumberOfQuestions(String[] actors);

here String[] actors is the selected actor list

Using an observer

questionsViewModel.getTotalQuestionCount(mCheckedActorList).observe(this, new Observer<Integer>() {
            @Override
            public void onChanged(@Nullable Integer countTotal) {
                if (countTotal != null)
                    mTotalCount = String.valueOf(countTotal);
                if (mAnswerCount != null && mTotalCount != null)
                    mAllQuestionAnswered.setText(mAnswerCount.concat("/").concat(mTotalCount));

            }
        });

I am observing the count, but consider the scenario

no filter applied (no actor selected,count =100)

actor developer is selected (count = 20)

onchanged in the first case returns 100 and in second it returns 100  and 20
 I only want the current value, ie 20 how can solve this? what am I doing wrong?

in view model

 public LiveData<Integer> getTotalQuestionCount(List<String> actorsList) {
        if (actorsList != null && actorsList.size() > 0) {
            String[] actorArray = new String[actorsList.size()];
            actorArray = actorsList.toArray(actorArray);
            return questionsRepository.getTotalCount(actorArray);

        } else {
            return questionsRepository.getTotalCount();
        }
    }

Body:
Just call

questionsViewModel.getTotalQuestionCount(mCheckedActorList).setValue(null)

before calling view model this will clear the previous value


来源: stackexchange

问:
Gradient Background for TabBar?
I'm trying to make the background of the TabNavigator be a gradient. The documentation at https://facebook.github.io/react-native/docs/colors.html indicates that color properties usually match how CSS works on the web. I went to https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient and read that Because s belong to the  data type, they can only be used where s can be used. For this reason, linear-gradient() won't work on background-color and other properties that use the  data type.

Consequently, the following won't work:

```<code>import { TabNavigator, TabBarBottom } from 'react-navigation';

export default TabNavigator(
  {
    Home: {
      screen: HomeScreen,
    },
  . . .
  },
  {
    navigationOptions: ({ navigation }) => ({
      tabBarIcon: ....
    tabBarComponent: TabBarBottom,
    tabBarPosition: 'bottom',
    animationEnabled: false,
    swipeEnabled: false,
    tabBarOptions: {
      activeTintColor: 'rgb(111, 111, 111)',
      labelStyle: {
        fontSize: 12,
      },
      style: {
        backgroundColor: 'linear-gradient(45deg, blue, red)',
      },
    }
  }
);
</code>```

Which is clear from the documentation. What isn't clear is what will work.

Update:

Clearly the regularly accepted practice is to create your own tab bar. Or, in my case, to tell the designer that he was out of luck.

答:
you can use this</p>
```<code><Tab.Navigator
  screenOptions={{
    headerShown: false,
    tabBarActiveTintColor: '#fff',
    tabBarStyle:{position:'absolute', height:55} ,
    tabBarBackground:() =>(
      <LinearGradient  colors={['#AD3231',  '#2757C3']} style={{height:70,borderTopLeftRadius:15,borderTopRightRadius:15}}/>
    )
  }}>
</Tab.Navigator>
</code>```

ContentLicense: CC BY-SA 4.0

Title: Gradient Background for TabBar?

Body:
I'm trying to make the background of the TabNavigator be a gradient. The documentation at https://facebook.github.io/react-native/docs/colors.html indicates that color properties usually match how CSS works on the web. I went to https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient and read that Because s belong to the  data type, they can only be used where s can be used. For this reason, linear-gradient() won't work on background-color and other properties that use the  data type.

Consequently, the following won't work:

import { TabNavigator, TabBarBottom } from 'react-navigation';

export default TabNavigator(
  {
    Home: {
      screen: HomeScreen,
    },
  . . .
  },
  {
    navigationOptions: ({ navigation }) => ({
      tabBarIcon: ....
    tabBarComponent: TabBarBottom,
    tabBarPosition: 'bottom',
    animationEnabled: false,
    swipeEnabled: false,
    tabBarOptions: {
      activeTintColor: 'rgb(111, 111, 111)',
      labelStyle: {
        fontSize: 12,
      },
      style: {
        backgroundColor: 'linear-gradient(45deg, blue, red)',
      },
    }
  }
);

Which is clear from the documentation. What isn't clear is what will work.

Update:

Clearly the regularly accepted practice is to create your own tab bar. Or, in my case, to tell the designer that he was out of luck.

Body:
you can use this

<Tab.Navigator
  screenOptions={{
    headerShown: false,
    tabBarActiveTintColor: '#fff',
    tabBarStyle:{position:'absolute', height:55} ,
    tabBarBackground:() =>(
      <LinearGradient  colors={['#AD3231',  '#2757C3']} style={{height:70,borderTopLeftRadius:15,borderTopRightRadius:15}}/>
    )
  }}>
</Tab.Navigator>


问:
Django Rest Framework viewsets.ModelViewSet
I have created a view in my DRF api that takes in a couple of parameters and saves them in the database.Am using a serializer derived from a model to do this.Below is the serializer and model code:

class CreditPaymentSerializer(serializers.ModelSerializer):

```<code>session = serializers.PrimaryKeyRelatedField(
    queryset=ShoppingSession.objects.all, many=False)

class Meta:
    model = CreditPayment
    exclude = ['last_update']
</code>```

and the model is

```<code>class CreditPayment(models.Model):
session = models.ForeignKey('shops.ShoppingSession', on_delete=models.PROTECT)
name = models.CharField(max_length=50, default = 'none')
number = models.CharField(max_length=15, blank=False)
email  = models.CharField(max_length=40, blank=True)
amount_payed = models.IntegerField(blank=False)
total_shopping = models.IntegerField(blank=False)
amount_remaining = models.IntegerField(blank=False)
date_payment_expected = models.DateField(blank=False)
last_update = models.DateField(auto_now=True)

def __str__(self):
    return self.name
</code>```

The viewset that is used to perform the creation of an instance of the model is:

```<code>class CreditPaymentView(viewsets.ModelViewSet):
permission_classes = [IsAuthenticated]
queryset = CreditPayment.objects.all()
serializer_class = CreditPaymentSerializer

def create(self, request, *args, **kwargs):
    serializer = self.get_serializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    self.perform_create(serializer)
    headers = self.get_success_headers(serializer.data)

    res = {
        "message": "Details Successfully created"
    }

    return Response(res, status=status.HTTP_201_CREATED, headers=headers)
</code>```

I cannot tell what is the wrong with the view,once i try to make a post request i get an error. With the error stack looking as follows

```<code>Traceback (most recent call last):
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/sean/Development/SKAKEY/payment/views.py", line 27, in create
    serializer.is_valid(raise_exception=True)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/serializers.py", line 227, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/serializers.py", line 426, in run_validation
    value = self.to_internal_value(data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/serializers.py", line 483, in to_internal_value
    validated_value = field.run_validation(primitive_value)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/relations.py", line 153, in run_validation
    return super().run_validation(data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/fields.py", line 568, in run_validation
    value = self.to_internal_value(data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/relations.py", line 264, in to_internal_value
    return queryset.get(pk=data)
AttributeError: 'function' object has no attribute 'get'
[10/Feb/2022 06:25:36] "POST /api/v1/shop/payment/credit-details/ HTTP/1.1" 500 128842
</code>```

Any leads on what the problem could be or the error means, or is it the foreign key relation raising the error?

答:
update your serializer code like below:</p>
```<code>session = serializers.PrimaryKeyRelatedField(
    queryset=ShoppingSession.objects.all(), many=False)

class Meta:
    model = CreditPayment
    exclude = ['last_update']
</code>```

Body:
I have created a view in my DRF api that takes in a couple of parameters and saves them in the database.Am using a serializer derived from a model to do this.Below is the serializer and model code:

class CreditPaymentSerializer(serializers.ModelSerializer):

session = serializers.PrimaryKeyRelatedField(
    queryset=ShoppingSession.objects.all, many=False)

class Meta:
    model = CreditPayment
    exclude = ['last_update']

and the model is

class CreditPayment(models.Model):
session = models.ForeignKey('shops.ShoppingSession', on_delete=models.PROTECT)
name = models.CharField(max_length=50, default = 'none')
number = models.CharField(max_length=15, blank=False)
email  = models.CharField(max_length=40, blank=True)
amount_payed = models.IntegerField(blank=False)
total_shopping = models.IntegerField(blank=False)
amount_remaining = models.IntegerField(blank=False)
date_payment_expected = models.DateField(blank=False)
last_update = models.DateField(auto_now=True)

def __str__(self):
    return self.name

The viewset that is used to perform the creation of an instance of the model is:

class CreditPaymentView(viewsets.ModelViewSet):
permission_classes = [IsAuthenticated]
queryset = CreditPayment.objects.all()
serializer_class = CreditPaymentSerializer

def create(self, request, *args, **kwargs):
    serializer = self.get_serializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    self.perform_create(serializer)
    headers = self.get_success_headers(serializer.data)

    res = {
        "message": "Details Successfully created"
    }

    return Response(res, status=status.HTTP_201_CREATED, headers=headers)

I cannot tell what is the wrong with the view,once i try to make a post request i get an error. With the error stack looking as follows

Traceback (most recent call last):
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/sean/Development/SKAKEY/payment/views.py", line 27, in create
    serializer.is_valid(raise_exception=True)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/serializers.py", line 227, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/serializers.py", line 426, in run_validation
    value = self.to_internal_value(data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/serializers.py", line 483, in to_internal_value
    validated_value = field.run_validation(primitive_value)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/relations.py", line 153, in run_validation
    return super().run_validation(data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/fields.py", line 568, in run_validation
    value = self.to_internal_value(data)
  File "/home/sean/anaconda3/envs/skakey/lib/python3.8/site-packages/rest_framework/relations.py", line 264, in to_internal_value
    return queryset.get(pk=data)
AttributeError: 'function' object has no attribute 'get'
[10/Feb/2022 06:25:36] "POST /api/v1/shop/payment/credit-details/ HTTP/1.1" 500 128842

Any leads on what the problem could be or the error means, or is it the foreign key relation raising the error?

Body:
update your serializer code like below:

session = serializers.PrimaryKeyRelatedField(
    queryset=ShoppingSession.objects.all(), many=False)

class Meta:
    model = CreditPayment
    exclude = ['last_update']


问:
Qt QListWidget performance issues
my application (Qt 4.6) requires me to display certain messages in a list which always scrolls down upon adding a new line (so the most recent line is always visible).

As I am having performance issues in the whole process which includes displaying these one-line messages, I've run some tests and found the QListWidget I am using for this to be the main issue.

I've created a simple test project with a default list widget "listWidget" and a push button "pushButton" which adds 1000 items in a loop on click. Those two widgets are added in a layout on the main window.
Here's the .cpp code (.h is default + the slot definition)

```<code>#include "MainWindow.h"
#include "ui_MainWindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_released()
{
    for( int iLine = 0; iLine < 1000; iLine++ )
    {
        ui->listWidget->addItem(
            QString( "%1: This is a dummy text" )
            .arg( QString::number( iLine ).rightJustified( 4, '0' ) )
            );
        ui->listWidget->scrollToBottom();
        QApplication::processEvents();
    }
}
</code>```

Without the scrollToBottom() the performance is alright, but if I add scrollToBottom, it also requires me to add processEvents() for a repaint, and things start getting really slow. When you resize the height of the window (and implicitly the list widget), you can literally watch the update speed changing.

I've tried playing around with performance flags like adding the following lines to the constructor:

```<code>ui->listWidget->setLayoutMode( QListWidget::Batched );
ui->listWidget->setBatchSize( 10 );
</code>```

This speeds it up alot, but scrollToBottom() does no longer work.

Does anyone have an idea how to improve the speed? Feel free to suggest completely different approaches as long as they're using Qt.

[Edit]
Taking a look at the performance of e.g. the Details list in the Install Dialogue of Qt Creator or programs like wireshark which don't have problems displaying a couple of lines per second, I know autoscrolling lists which update at a high speed are possible in general. The main question is: Is this possible with Qt?

答:
I am not sure if this will solve your problem or not but it may offer a different approach.

QWidget has updatesEnabled property that allows your control whether widget receives paint events or not.

Try disabling this properyt then populate your list and then re-enable it to paint your widget back.

I hope this helps.

ContentLicense: CC BY-SA 3.0

Title: Qt QListWidget performance issues

Body:
my application (Qt 4.6) requires me to display certain messages in a list which always scrolls down upon adding a new line (so the most recent line is always visible).

As I am having performance issues in the whole process which includes displaying these one-line messages, I've run some tests and found the QListWidget I am using for this to be the main issue.

I've created a simple test project with a default list widget "listWidget" and a push button "pushButton" which adds 1000 items in a loop on click. Those two widgets are added in a layout on the main window.
Here's the .cpp code (.h is default + the slot definition)

#include "MainWindow.h"
#include "ui_MainWindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_released()
{
    for( int iLine = 0; iLine < 1000; iLine++ )
    {
        ui->listWidget->addItem(
            QString( "%1: This is a dummy text" )
            .arg( QString::number( iLine ).rightJustified( 4, '0' ) )
            );
        ui->listWidget->scrollToBottom();
        QApplication::processEvents();
    }
}

Without the scrollToBottom() the performance is alright, but if I add scrollToBottom, it also requires me to add processEvents() for a repaint, and things start getting really slow. When you resize the height of the window (and implicitly the list widget), you can literally watch the update speed changing.

I've tried playing around with performance flags like adding the following lines to the constructor:

ui->listWidget->setLayoutMode( QListWidget::Batched );
ui->listWidget->setBatchSize( 10 );

This speeds it up alot, but scrollToBottom() does no longer work.

Does anyone have an idea how to improve the speed? Feel free to suggest completely different approaches as long as they're using Qt.

[Edit]
Taking a look at the performance of e.g. the Details list in the Install Dialogue of Qt Creator or programs like wireshark which don't have problems displaying a couple of lines per second, I know autoscrolling lists which update at a high speed are possible in general. The main question is: Is this possible with Qt?


问:
is there a way of passing the cars component as the search result from the search inputs in React.js?
This is the code for my search component, it contains the search input that returns a search result

```<code>function Search (props) {
const [search, setSearch] = useState("")
 function handleSearch(e){
   setSearch(e.target.value)
 };
      const filtered = !search
    ? data
    : data.filter((car) =>
        car.name.toLowerCase().includes(search.toLowerCase())
      );

  return(
    <>
    <div className="search-container">
    <input
    value={search}
    onChange={handleSearch}
    className="searchbox"
    type='text'
    placeholder="Find a car.."/>
    </div>
    </>
  )
}
</code>```

this is my CARS COMPONENT it shows the the collective lists of cars from my data

```<code>function Cars (){

  return(
    <>

    <div className="cars-container">
     {data.map((car) =>{
      return (
       <div className="cars-wrapper"
           key={car.number}>
          <img className='car-image'
          src={car.image} alt="mercedez" />
          <h4>{car.name}</h4>
          <p>{car.model}</p>
        <Link style={{fontSize: '1rem'}}
        to={`/cars/${car.number}`}>Mind blowing features</Link>
       </div>
      )
     })}

      </div>
   <Outlet />
   </>
  )
    }

     export {Cars}
</code>```

Now my question is, how can i pass the CARS component to the SEARCH component to be displayed whenever the search input is used to search for a car.

答:
Okay, there are several ways to do this.

You can create a parent element in which you declare a state, for example filtered, which you will pass to searchComponent where it will change, and in carComponent you will pass the already filtered state:

Like this:

 const Parent () => {
   const [filtered, setFiltered] = useState('');
   const handleFilter = (data) => {
          setFiltered(data)
   }

   return (<>
     <Search setFiltered={handleFilter}/>
     <Cars data={filtered}/>
   </>)
}```

You can create custom hooks with state, put them in a separate file, and use their state where you want, although I'm not entirely sure about this approach, because. I myself have been using more advanced methods for a long time.

That's about custom hooks: https://reactjs.org/docs/hooks-custom.html

Use libraries for state management like MobX or Redux

Body:
This is the code for my search component, it contains the search input that returns a search result

function Search (props) {
const [search, setSearch] = useState("")
 function handleSearch(e){
   setSearch(e.target.value)
 };
      const filtered = !search
    ? data
    : data.filter((car) =>
        car.name.toLowerCase().includes(search.toLowerCase())
      );

  return(
    <>

    <input
    value={search}
    onChange={handleSearch}
    className="searchbox"
    type='text'
    placeholder="Find a car.."/>

    </>
  )
}

this is my CARS COMPONENT it shows the the collective lists of cars from my data

function Cars (){

  return(
    <>

     {data.map((car) =>{
      return (

{car.name}

{car.model}

        <Link style={{fontSize: '1rem'}}
        to={`/cars/${car.number}`}>Mind blowing features</Link>

      )
     })}

   <Outlet />
   </>
  )
    }

     export {Cars}

Now my question is, how can i pass the CARS component to the SEARCH component to be displayed whenever the search input is used to search for a car.

Body:
Okay, there are several ways to do this.

You can create a parent element in which you declare a state, for example filtered, which you will pass to searchComponent where it will change, and in carComponent you will pass the already filtered state:

Like this:

 const Parent () => {
   const [filtered, setFiltered] = useState('');
   const handleFilter = (data) => {
          setFiltered(data)
   }

   return (<>
     <Search setFiltered={handleFilter}/>
     <Cars data={filtered}/>
   </>)
}

You can create custom hooks with state, put them in a separate file, and use their state where you want, although I'm not entirely sure about this approach, because. I myself have been using more advanced methods for a long time.

That's about custom hooks: https://reactjs.org/docs/hooks-custom.html

Use libraries for state management like MobX or Redux


问:
SwiftUI animation fails when nested in VStack
Trying to animate sub-views that are nested in a VStack hierarchy. In the example below, why do the views in the outer VStack animate correctly, but the views nested one level deeper do not?

Seems like the inner VStack is completely erasing/hiding the animations attached to those subviews.

```<code>struct SampleView: View {
@State private var showDetails = false

var body: some View {
    VStack {
        Button("Press to show details") {
            withAnimation {
                showDetails.toggle()
            }
        }

        if showDetails {

            VStack {
                // These views embedded in the sub-VStack do not animate at all:
                Text("Incorrect 1")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
                Text("Incorrect 2")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
                Text("Incorrect 3")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))
            }

            // These views animate correctly:
            Text("Correct 1")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
            Text("Correct 2")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
            Text("Correct 3")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))

        } else {
            Text("Waiting for details")
        }
    }
}
</code>```

}

答:
I suppose it's because the whole VStack is inserted as one view at once. But you can move the if inside the Stack and add a second one like this, then it works:

```<code>var body: some View {
    VStack {
        Button("Press to show details") {
            withAnimation {
                showDetails.toggle()
            }
        }

        VStack {
            if showDetails {
                // These views embedded in the sub-VStack do not animate at all:
                Text("Incorrect 1")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
                Text("Incorrect 2")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
                Text("Incorrect 3")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))
            }
        }
        if showDetails {
            // These views animate correctly:
            Text("Correct 1")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
            Text("Correct 2")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
            Text("Correct 3")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))

        } else {
            Text("Waiting for details")
        }
    }
    .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))
</code>```

}

Body:
Trying to animate sub-views that are nested in a VStack hierarchy. In the example below, why do the views in the outer VStack animate correctly, but the views nested one level deeper do not?

Seems like the inner VStack is completely erasing/hiding the animations attached to those subviews.

struct SampleView: View {
@State private var showDetails = false

var body: some View {
    VStack {
        Button("Press to show details") {
            withAnimation {
                showDetails.toggle()
            }
        }

        if showDetails {

            VStack {
                // These views embedded in the sub-VStack do not animate at all:
                Text("Incorrect 1")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
                Text("Incorrect 2")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
                Text("Incorrect 3")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))
            }

            // These views animate correctly:
            Text("Correct 1")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
            Text("Correct 2")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
            Text("Correct 3")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))

        } else {
            Text("Waiting for details")
        }
    }
}

}

Body:
I suppose it's because the whole VStack is inserted as one view at once. But you can move the if inside the Stack and add a second one like this, then it works:

var body: some View {
    VStack {
        Button("Press to show details") {
            withAnimation {
                showDetails.toggle()
            }
        }

        VStack {
            if showDetails {
                // These views embedded in the sub-VStack do not animate at all:
                Text("Incorrect 1")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
                Text("Incorrect 2")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
                Text("Incorrect 3")
                    .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))
            }
        }
        if showDetails {
            // These views animate correctly:
            Text("Correct 1")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(0)))
            Text("Correct 2")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(1)))
            Text("Correct 3")
                .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))

        } else {
            Text("Waiting for details")
        }
    }
    .transition(.opacity.animation(.easeInOut(duration: 1).delay(2)))

}


问:
Get checked value from radio button group
I am populating radio buttons dynamically, and on submit button click I need to get value of the checked radio button from the group.

```<code><ul data-bind="foreach: Numbers">
        <li>
            <input name="phone-group" type="radio" data-bind="attr: {'id': $data.id}, value: $data.value" >
            <label data-bind="Text: $data.value, attr:{'for': $data.id }" ></label>
        </li>
</ul>
<button role="link">Submit</button>
</code>```

This is the model: (coffeescript)

@Numbers = ko.observableArray([{id:"1",value:"1234"}, {id:"2",value:"5678"}, {id:"3",value:"91011"}])

On submit button click, I need the selected value from the radio button list.

答:
Consider using:</p>
```<code>    function getRBtn(rbName) {
      let opt = document.querySelector(`input[name=${rbName}]:checked`);
      return opt = (opt != null) ? opt.value : 'memo0';  // default value 'memo0'
    }
    // rbName is the radio button name value
    // opt.value is the value associated with the radio button
    // 'memo0' is a default value if no radio buttons have been selected.
</code>```

Body:
I am populating radio buttons dynamically, and on submit button click I need to get value of the checked radio button from the group.

            <input name="phone-group" type="radio" data-bind="attr: {'id': $data.id}, value: $data.value" >

<button role="link">Submit</button>

This is the model: (coffeescript)

@Numbers = ko.observableArray([{id:"1",value:"1234"}, {id:"2",value:"5678"}, {id:"3",value:"91011"}])

On submit button click, I need the selected value from the radio button list.

Body:
Consider using:

    function getRBtn(rbName) {
      let opt = document.querySelector(`input[name=${rbName}]:checked`);
      return opt = (opt != null) ? opt.value : 'memo0';  // default value 'memo0'
    }
    // rbName is the radio button name value
    // opt.value is the value associated with the radio button
    // 'memo0' is a default value if no radio buttons have been selected.


问:
How to pass an associative array as argument to a function in Bash?
How do you pass an associative array as an argument to a function? Is this possible in Bash?

The code below is not working as expected:

```<code>function iterateArray
{
    local ADATA="${@}"            # associative array

for key in "${!ADATA[@]}"
do
    echo "key - ${key}"
    echo "value: ${ADATA[$key]}"

done

}
</code>```

Passing associative arrays to a function like normal arrays does not work:

```<code>iterateArray "$A_DATA"
</code>```

or

```<code>iterateArray "$A_DATA[@]"
</code>```

答:
Two ways to pass associative arrays as parameters in bash

For regular bash indexed arrays, see my two other answers here (by reference) and here (by value). For printing arrays by value or reference, see my answer here.

1. Manual passing (via serialization/deserialization) of the associative array

Here's another way: you can manually serialize the associative array as you pass it to a function, then deserialize it back into a new associative array inside the function:

Here's a full, runnable example from my eRCaGuy_hello_world repo:

array_pass_as_bash_parameter_2_associative.sh:

# Print an associative array using manual serialization/deserialization
# Usage:
#       # General form:
#       print_associative_array array_length array_keys array_values
#
#       # Example:
#       #                          length        indices (keys)    values
#       print_associative_array "${#array1[@]}" "${!array1[@]}" "${array1[@]}"
print_associative_array() {
    i=1

    # read 1st argument, the array length
    array_len="${@:$i:1}"
    ((i++))

    # read all key:value pairs into a new associative array
    declare -A array
    for (( i_key="$i"; i_key<$(($i + "$array_len")); i_key++ )); do
        i_value=$(($i_key + $array_len))
        key="${@:$i_key:1}"
        value="${@:$i_value:1}"
        array["$key"]="$value"
    done

    # print the array by iterating through all of the keys now
    for key in "${!array[@]}"; do
        value="${array["$key"]}"
        echo "  $key: $value"
    done
}

# Let's create and load up an associative array and print it
declare -A array1
array1["a"]="cat"
array1["b"]="dog"
array1["c"]="mouse"

#                         length         indices (keys)    values
print_associative_array "${#array1[@]}" "${!array1[@]}" "${array1[@]}"
```
<p>Sample output:</p>
```  a: cat
  b: dog
  c: mouse
```
<h3>Explanation:</h3>
<p>For a given function named <code>print_associative_array</code>, here is the general form:</p>
<pre class="lang-bash prettyprint-override"><code># general form
print_associative_array array_length array_keys array_values
</code>```

For an array named array1, here is how to obtain the array length, indices (keys), and values:

array length: "${#array1[@]}"

all of the array indices (keys in this case, since it's an associative array): "${!array1[@]}"

all of the array values: "${array1[@]}"

So, an example call to print_associative_array would look like this:

# example call
#                         length         indices (keys)    values
print_associative_array "${#array1[@]}" "${!array1[@]}" "${array1[@]}"
```
<p>Putting the <em>length</em> of the array first is essential, as it allows us to parse the incoming serialized array as it arrives into the <code>print_associative_array</code> function inside the magic <code>@</code> array of all incoming arguments.</p>
<p>To parse the <code>@</code> array, we'll use array slicing, which is described as follows (this snippet is copy-pasted from my answer here):</p>
<pre class="lang-bash prettyprint-override"><code># array slicing basic format 1: grab a certain length starting at a certain
# index
echo "${@:2:5}"
#         │ │
#         │ └────> slice length
#         └──────> slice starting index (zero-based)
</code>```

2. [Better technique than above!] Pass the array by reference

...as @Todd Lehman explains in his answer here

# Print an associative array by passing the array by reference
# Usage:
#       # General form:
#       print_associative_array2 array
#       # Example
#       print_associative_array2 array1
print_associative_array2() {
    # declare a local **reference variable** (hence `-n`) named `array_reference`
    # which is a reference to the value stored in the first parameter
    # passed in
    local -n array_reference="$1"

    # print the array by iterating through all of the keys now
    for key in "${!array_reference[@]}"; do
        value="${array_reference["$key"]}"
        echo "  $key: $value"
    done
}

echo 'print_associative_array2 array1'
print_associative_array2 array1
echo ""
echo "OR (same thing--quotes don't matter in this case):"
echo 'print_associative_array2 "array1"'
print_associative_array2 "array1"
```
<p>Sample output:</p>
<pre class="lang-none prettyprint-override"><code>print_associative_array2 array1
  a: cat
  b: dog
  c: mouse

OR (same thing--quotes don't matter in this case):
print_associative_array2 "array1"
  a: cat
  b: dog
  c: mouse
</code>```

See also:

[my answer] a more-extensive demo of me serializing/deserializing a regular "indexed" bash array in order to pass one or more of them as parameters to a function: Passing arrays as parameters in bash

[my answer] a demo of me passing a regular "indexed" bash array by reference: Passing arrays as parameters in bash

[my answer] array slicing: Unix & Linux: Bash: slice of positional parameters

[my question] Why do the man bash pages state the declare and local -n attribute "cannot be applied to array variables", and yet it can?

Body:
How do you pass an associative array as an argument to a function? Is this possible in Bash?

The code below is not working as expected:

function iterateArray
{
    local ADATA="${@}"            # associative array

for key in "${!ADATA[@]}"
do
    echo "key - ${key}"
    echo "value: ${ADATA[$key]}"

done

}

Passing associative arrays to a function like normal arrays does not work:

iterateArray "$A_DATA"

or

iterateArray "$A_DATA[@]"

Body:
Two ways to pass associative arrays as parameters in bash

For regular bash indexed arrays, see my two other answers here (by reference) and here (by value). For printing arrays by value or reference, see my answer here.

1. Manual passing (via serialization/deserialization) of the associative array

Here's another way: you can manually serialize the associative array as you pass it to a function, then deserialize it back into a new associative array inside the function:

Here's a full, runnable example from my eRCaGuy_hello_world repo:

array_pass_as_bash_parameter_2_associative.sh:

# Print an associative array using manual serialization/deserialization
# Usage:
#       # General form:
#       print_associative_array array_length array_keys array_values
#
#       # Example:
#       #                          length        indices (keys)    values
#       print_associative_array "${#array1[@]}" "${!array1[@]}" "${array1[@]}"
print_associative_array() {
    i=1

    # read 1st argument, the array length
    array_len="${@:$i:1}"
    ((i++))

    # read all key:value pairs into a new associative array
    declare -A array
    for (( i_key="$i"; i_key<$(($i + "$array_len")); i_key++ )); do
        i_value=$(($i_key + $array_len))
        key="${@:$i_key:1}"
        value="${@:$i_value:1}"
        array["$key"]="$value"
    done

    # print the array by iterating through all of the keys now
    for key in "${!array[@]}"; do
        value="${array["$key"]}"
        echo "  $key: $value"
    done
}

# Let's create and load up an associative array and print it
declare -A array1
array1["a"]="cat"
array1["b"]="dog"
array1["c"]="mouse"

#                         length         indices (keys)    values
print_associative_array "${#array1[@]}" "${!array1[@]}" "${array1[@]}"

Sample output:

  a: cat
  b: dog
  c: mouse

Explanation:

For a given function named print_associative_array, here is the general form:

# general form
print_associative_array array_length array_keys array_values

For an array named array1, here is how to obtain the array length, indices (keys), and values:

array length: "${#array1[@]}"

all of the array indices (keys in this case, since it's an associative array): "${!array1[@]}"

all of the array values: "${array1[@]}"

So, an example call to print_associative_array would look like this:

# example call
#                         length         indices (keys)    values
print_associative_array "${#array1[@]}" "${!array1[@]}" "${array1[@]}"

Putting the length of the array first is essential, as it allows us to parse the incoming serialized array as it arrives into the print_associative_array function inside the magic @ array of all incoming arguments.

To parse the @ array, we'll use array slicing, which is described as follows (this snippet is copy-pasted from my answer here):

# array slicing basic format 1: grab a certain length starting at a certain
# index
echo "${@:2:5}"
#         │ │
#         │ └────> slice length
#         └──────> slice starting index (zero-based)

2. [Better technique than above!] Pass the array by reference

...as @Todd Lehman explains in his answer here

# Print an associative array by passing the array by reference
# Usage:
#       # General form:
#       print_associative_array2 array
#       # Example
#       print_associative_array2 array1
print_associative_array2() {
    # declare a local **reference variable** (hence `-n`) named `array_reference`
    # which is a reference to the value stored in the first parameter
    # passed in
    local -n array_reference="$1"

    # print the array by iterating through all of the keys now
    for key in "${!array_reference[@]}"; do
        value="${array_reference["$key"]}"
        echo "  $key: $value"
    done
}

echo 'print_associative_array2 array1'
print_associative_array2 array1
echo ""
echo "OR (same thing--quotes don't matter in this case):"
echo 'print_associative_array2 "array1"'
print_associative_array2 "array1"

Sample output:

print_associative_array2 array1
  a: cat
  b: dog
  c: mouse

OR (same thing--quotes don't matter in this case):
print_associative_array2 "array1"
  a: cat
  b: dog
  c: mouse

See also:

[my answer] a more-extensive demo of me serializing/deserializing a regular "indexed" bash array in order to pass one or more of them as parameters to a function: Passing arrays as parameters in bash

[my answer] a demo of me passing a regular "indexed" bash array by reference: Passing arrays as parameters in bash

[my answer] array slicing: Unix & Linux: Bash: slice of positional parameters

[my question] Why do the man bash pages state the declare and local -n attribute "cannot be applied to array variables", and yet it can?


问:
Failed to connect to cc-clickhouse.ads.aliyuncs.com port 8443: Operation timed out
When I'm trying to connect my ClickHouse instance on Alibaba Cloud with https protocol from my Mac, and this is the response error:

Failed to connect to cc-xxxx.germany.ads.aliyuncs.com port 8443: Operation timed out
enter image description here

curl --cacert ./Downloads/ClickHouse-CA-Chain.pem https://cc-clickhouseinstance.connection.string.ads.aliyuncs.com:8443/ping

I have tried ping, and it shows ok, so what the problem would be?

How to connect ApsaraDB for ClickHouse instance on Alibaba Cloud using https?

答:
Maybe you should check your instance security group, be sure the public IP of your PC is on the allow list.

If you don't know how to get your public IP, check below.
https://ip.taobao.com/ipSearch

Or you can switch to connect from ECS instances and put public IP or intranet IP on the list. Just like this
Data Security Rules Configuration Example

[Reference]
https://www.alibabacloud.com/help/doc-detail/393349.htm


答:
I don't know how to get the checked value in CoffeeScript. However, in JavaScript, using the name attribute on the input, you can get the checked value using document.querySelector() method:

```<code>let checkedValue = document.querySelector('input[name="phone-group"]:checked').value;
console.log(checkedValue);
</code>```

Title: Get checked value from radio button group

Body:
I don't know how to get the checked value in CoffeeScript. However, in JavaScript, using the name attribute on the input, you can get the checked value using document.querySelector() method:

let checkedValue = document.querySelector('input[name="phone-group"]:checked').value;
console.log(checkedValue);


问:
Piranha CMS block inside and outside container div
From code template we have:

```<code><div class="block @block.CssName()">
  <div class="container">
     @Html.DisplayFor(m => block, block.GetType().Name)
  </div>
</div>
</code>```

it make my content block always inside container class. How to make a flexible page where we can put a block inside and outside container

答:
So finally i've made it by removing containerfrom template:

```<code><div class="block @block.CssName()">
  <!--<div class="container">-->
     @Html.DisplayFor(m => block, block.GetType().Name)
  <!--</div>-->
</div>
</code>```

It make all standard block sit outside container. Next i made a group block of container. Any block can be inside this container group block except standard group block such as gallery and columns. Luckily it is open source, so we can make our own columns and gallery group block to be inside a container by modify cshtml template. I dont know how piranha.org do this

But i think my solve fit my purpose

Body:
From code template we have:

     @Html.DisplayFor(m => block, block.GetType().Name)

it make my content block always inside container class. How to make a flexible page where we can put a block inside and outside container

Body:
So finally i've made it by removing containerfrom template:

<div class="block @block.CssName()">
  <!--<div class="container">-->
     @Html.DisplayFor(m => block, block.GetType().Name)
  <!--</div>-->
</div>

It make all standard block sit outside container. Next i made a group block of container. Any block can be inside this container group block except standard group block such as gallery and columns. Luckily it is open source, so we can make our own columns and gallery group block to be inside a container by modify cshtml template. I dont know how piranha.org do this

But i think my solve fit my purpose


问:
Apple M1: can't start the confluent control center using docker
I would like to start the Confluent control center using docker as prescribed in the document:

https://docs.confluent.io/platform/current/quickstart/ce-docker-quickstart.html

This is the docker-compose.yaml file they provided;

```<code>---
version: '2'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:5.5.0
    hostname: zookeeper
    container_name: zookeeper
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000

  broker:
    image: confluentinc/cp-server:5.5.0
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: broker:29092
      CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
      CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
      CONFLUENT_METRICS_ENABLE: 'true'
      CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'

  schema-registry:
    image: confluentinc/cp-schema-registry:5.5.0
    hostname: schema-registry
    container_name: schema-registry
    depends_on:
      - zookeeper
      - broker
    ports:
      - "8081:8081"
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'

  connect:
    image: cnfldemos/cp-server-connect-datagen:0.3.2-5.5.0
    hostname: connect
    container_name: connect
    depends_on:
      - zookeeper
      - broker
      - schema-registry
    ports:
      - "8083:8083"
    environment:
      CONNECT_BOOTSTRAP_SERVERS: 'broker:29092'
      CONNECT_REST_ADVERTISED_HOST_NAME: connect
      CONNECT_REST_PORT: 8083
      CONNECT_GROUP_ID: compose-connect-group
      CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs
      CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000
      CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets
      CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status
      CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_KEY_CONVERTER: org.apache.kafka.connect.storage.StringConverter
      CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter
      CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: http://schema-registry:8081
      CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
      CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
      CONNECT_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      # CLASSPATH required due to CC-2422
      CLASSPATH: /usr/share/java/monitoring-interceptors/monitoring-interceptors-5.5.0.jar
      CONNECT_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
      CONNECT_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
      CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components"
      CONNECT_LOG4J_LOGGERS: org.apache.zookeeper=ERROR,org.I0Itec.zkclient=ERROR,org.reflections=ERROR

  control-center:
    image: confluentinc/cp-enterprise-control-center:5.5.0
    hostname: control-center
    container_name: control-center
    depends_on:
      - zookeeper
      - broker
      - schema-registry
      - connect
      - ksqldb-server
    ports:
      - "9021:9021"
    environment:
      CONTROL_CENTER_BOOTSTRAP_SERVERS: 'broker:29092'
      CONTROL_CENTER_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      CONTROL_CENTER_CONNECT_CLUSTER: 'connect:8083'
      CONTROL_CENTER_KSQL_KSQLDB1_URL: "http://ksqldb-server:8088"
      CONTROL_CENTER_KSQL_KSQLDB1_ADVERTISED_URL: "http://localhost:8088"
      CONTROL_CENTER_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
      CONTROL_CENTER_REPLICATION_FACTOR: 1
      CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS: 1
      CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1
      CONFLUENT_METRICS_TOPIC_REPLICATION: 1
      PORT: 9021

  ksqldb-server:
    image: confluentinc/cp-ksqldb-server:5.5.0
    hostname: ksqldb-server
    container_name: ksqldb-server
    depends_on:
      - broker
      - connect
    ports:
      - "8088:8088"
    environment:
      KSQL_CONFIG_DIR: "/etc/ksql"
      KSQL_BOOTSTRAP_SERVERS: "broker:29092"
      KSQL_HOST_NAME: ksqldb-server
      KSQL_LISTENERS: "http://0.0.0.0:8088"
      KSQL_CACHE_MAX_BYTES_BUFFERING: 0
      KSQL_KSQL_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
      KSQL_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
      KSQL_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
      KSQL_KSQL_CONNECT_URL: "http://connect:8083"

  ksqldb-cli:
    image: confluentinc/cp-ksqldb-cli:5.5.0
    container_name: ksqldb-cli
    depends_on:
      - broker
      - connect
      - ksqldb-server
    entrypoint: /bin/sh
    tty: true

  ksql-datagen:
    image: confluentinc/ksqldb-examples:5.5.0
    hostname: ksql-datagen
    container_name: ksql-datagen
    depends_on:
      - ksqldb-server
      - broker
      - schema-registry
      - connect
    command: "bash -c 'echo Waiting for Kafka to be ready... && \
                       cub kafka-ready -b broker:29092 1 40 && \
                       echo Waiting for Confluent Schema Registry to be ready... && \
                       cub sr-ready schema-registry 8081 40 && \
                       echo Waiting a few seconds for topic creation to finish... && \
                       sleep 11 && \
                       tail -f /dev/null'"
    environment:
      KSQL_CONFIG_DIR: "/etc/ksql"
      STREAMS_BOOTSTRAP_SERVERS: broker:29092
      STREAMS_SCHEMA_REGISTRY_HOST: schema-registry
      STREAMS_SCHEMA_REGISTRY_PORT: 8081

  rest-proxy:
    image: confluentinc/cp-kafka-rest:5.5.0
    depends_on:
      - zookeeper
      - broker
      - schema-registry
    ports:
      - 8082:8082
    hostname: rest-proxy
    container_name: rest-proxy
    environment:
      KAFKA_REST_HOST_NAME: rest-proxy
      KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092'
      KAFKA_REST_LISTENERS: "http://0.0.0.0:8082"
      KAFKA_REST_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
</code>```

I run the services using the command:

```<code>docker-compose up -d
</code>```

After a while the services look -

and I was not able to reach the control center in the localhost:9021 they the port is listening. I look for the container logs and find these:

control-center

```<code>control-center  | [2021-12-03 06:12:52,137] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-4-consumer, groupId=_confluent-controlcenter-5-5-0-1] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,143] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-4-consumer, groupId=_confluent-controlcenter-5-5-0-1] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,142] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-8-consumer, groupId=_confluent-controlcenter-5-5-0-1] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,146] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-8-consumer, groupId=_confluent-controlcenter-5-5-0-1] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,151] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-2-consumer, groupId=_confluent-controlcenter-5-5-0-1] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,155] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-2-consumer, groupId=_confluent-controlcenter-5-5-0-1] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,277] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-7-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,278] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-4-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 6 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,296] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-3-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 6 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,298] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-5-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 7 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,306] INFO streams in state=REBALANCING (io.confluent.controlcenter.streams.KafkaStreamsManager)
control-center  | [2021-12-03 06:12:52,297] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-8-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,310] INFO tocheck=[Store{name=KSTREAM-OUTEROTHER-0000000105-store, rollup=false}, Store{name=TriggerActionsStore, rollup=false}, Store{name=TriggerEventsStore, rollup=false}, Store{name=AlertHistoryStore, rollup=false}, Store{name=MonitoringMessageAggregatorWindows, rollup=true}, Store{name=MetricsAggregateStore, rollup=false}, Store{name=Group, rollup=true}, Store{name=MonitoringTriggerStore, rollup=false}, Store{name=group-aggregate-store, rollup=true}, Store{name=monitoring-aggregate-rekey-store, rollup=false}, Store{name=aggregatedTopicPartitionTableWindows, rollup=true}, Store{name=MonitoringVerifierStore, rollup=false}, Store{name=KSTREAM-OUTERTHIS-0000000104-store, rollup=false}, Store{name=aggregate-topic-partition-store, rollup=false}, Store{name=MonitoringStream, rollup=true}] (io.confluent.controlcenter.streams.KafkaStreamsManager)
control-center  | [2021-12-03 06:12:52,310] INFO streams in state=REBALANCING (io.confluent.controlcenter.streams.KafkaStreamsManager)
control-center  | #
control-center  | # A fatal error has been detected by the Java Runtime Environment:
control-center  | #
control-center  | #  SIGSEGV[thread 283969722112 also had an error]
control-center  | [thread 283968669440 also had an error]
control-center  |  (0xb) at pc=0x000000400c04f320, pid=1, tid=0x0000004225fa2700
control-center  | #
control-center  | # JRE version: OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (8.0_212-b04) (build 1.8.0_212-b04)
control-center  | # Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-amd64 compressed oops)
control-center  | # Problematic frame:
control-center  | # [thread 284374480640 also had an error]
control-center  | J 2840 C1 org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.maybeTriggerWakeup()V (48 bytes) @ 0x000000400c04f320 [0x000000400c04f300+0x20]
control-center  | #
control-center  | # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
control-center  | #
control-center  | # An error report file with more information is saved as:
control-center  | # //hs_err_pid1.log
control-center  | [thread 284375533312 also had an error]
control-center  | [thread 284378691328 also had an error]
control-center  | [thread 284377638656 also had an error]
control-center  | [thread 279529854720 also had an error]
control-center  | [2021-12-03 06:12:52,431] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-6-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [thread 284376585984 also had an error]
control-center  | #
control-center  | # If you would like to submit a bug report, please visit:
control-center  | #   http://www.azulsystems.com/support/
control-center  | #
control-center  | qemu: uncaught target signal 6 (Aborted) - core dumped
</code>```

broker logs

```<code>    broker  | [2021-12-03 06:15:52,919] TRACE [Broker id=1] Cached leader info UpdateMetadataPartitionState(topicName='docker-connect-status', partitionIndex=4, controllerEpoch=1, leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], observers=[], offlineReplicas=[]) for partition docker-connect-status-4 in response to UpdateMetadata request sent by controller 1 epoch 1 with correlation id 74 (state.change.logger)
    broker  | [2021-12-03 06:15:52,919] TRACE [Broker id=1] Cached leader info UpdateMetadataPartitionState(topicName='docker-connect-status', partitionIndex=1, controllerEpoch=1, leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], observers=[], offlineReplicas=[]) for partition docker-connect-status-1 in response to UpdateMetadata request sent by controller 1 epoch 1 with correlation id 74 (state.change.logger)
    broker  | [2021-12-03 06:15:52,919] TRACE [Broker id=1] Cached leader info UpdateMetadataPartitionState(topicName='docker-connect-status', partitionIndex=3, controllerEpoch=1, leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], observers=[], offlineReplicas=[]) for partition docker-connect-status-3 in response to UpdateMetadata request sent by controller 1 epoch 1 with correlation id 74 (state.change.logger)
    broker  | [2021-12-03 06:15:52,940] TRACE [Controller id=1 epoch=1] Received response {error_code=0,_tagged_fields={}} for request UPDATE_METADATA with correlation id 74 sent to broker broker:29092 (id: 1 rack: null) (state.change.logger)
</code>```

I believe this control center log provided the main error:

```<code># A fatal error has been detected by the Java Runtime Environment:
control-center  | #
control-center  | #  SIGSEGV[thread 283969722112 also had an error]
control-center  | [thread 283968669440 also had an error]
control-center  |  (0xb) at pc=0x000000400c04f320, pid=1, tid=0x0000004225fa2700
control-center  | #
control-center  | # JRE version: OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (8.0_212-b04) (build 1.8.0_212-b04)
control-center  | # Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-amd64 compressed oops)
control-center  | # Problematic frame:
control-center  | # [thread 284374480640 also had an error]
control-center  | J 2840 C1 org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.maybeTriggerWakeup()V (48 bytes) @ 0x000000400c04f320 [0x000000400c04f300+0x20]
control-center  | #
control-center  | # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
control-center  | #
control-center  | # An error report file with more information is saved as:
control-center  | # //hs_err_pid1.log
control-center  | [thread 284375533312 also had an error]
control-center  | [thread 284378691328 also had an error]
control-center  | [thread 284377638656 also had an error]
control-center  | [thread 279529854720 also had an error]
control-center  | [2021-12-03 06:12:52,431] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-6-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [thread 284376585984 also had an error]
control-center  | #
control-center  | # If you would like to submit a bug report, please visit:
control-center  | #   http://www.azulsystems.com/support/
control-center  | #
control-center  | qemu: uncaught target signal 6 (Aborted) - core dumped
</code>```

This is the Java version that I use:

```<code>$ java --version
openjdk 11.0.9.1 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
</code>```

Previosuly, I never had an issue with the confluent platform using the docker, so, is this particular to the Apple m1 chip and how do I solve it until confluent provides an official solution?

答:
I experienced the same - boosting memory and CPU, even all the way up, did not help. Confluent has mentioned they are working on it - in the issue the suggestion is to use a hypervisor or a cheap hosted instance:

In the meantime, I recommend running an M1-supported hypervisor, using some cloud instances for development, or using Confluent Cloud basic clusters for development. - @addisonhuddy

This other SO post explains how to create your own docker-compose for Kafka using ARM supported images, but is a manual setup not Confluent (as asked in original question).

Body:
I would like to start the Confluent control center using docker as prescribed in the document:

https://docs.confluent.io/platform/current/quickstart/ce-docker-quickstart.html

This is the docker-compose.yaml file they provided;

---
version: '2'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:5.5.0
    hostname: zookeeper
    container_name: zookeeper
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000

  broker:
    image: confluentinc/cp-server:5.5.0
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: broker:29092
      CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
      CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
      CONFLUENT_METRICS_ENABLE: 'true'
      CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'

  schema-registry:
    image: confluentinc/cp-schema-registry:5.5.0
    hostname: schema-registry
    container_name: schema-registry
    depends_on:
      - zookeeper
      - broker
    ports:
      - "8081:8081"
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'

  connect:
    image: cnfldemos/cp-server-connect-datagen:0.3.2-5.5.0
    hostname: connect
    container_name: connect
    depends_on:
      - zookeeper
      - broker
      - schema-registry
    ports:
      - "8083:8083"
    environment:
      CONNECT_BOOTSTRAP_SERVERS: 'broker:29092'
      CONNECT_REST_ADVERTISED_HOST_NAME: connect
      CONNECT_REST_PORT: 8083
      CONNECT_GROUP_ID: compose-connect-group
      CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs
      CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000
      CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets
      CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status
      CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1
      CONNECT_KEY_CONVERTER: org.apache.kafka.connect.storage.StringConverter
      CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter
      CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: http://schema-registry:8081
      CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
      CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
      CONNECT_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      # CLASSPATH required due to CC-2422
      CLASSPATH: /usr/share/java/monitoring-interceptors/monitoring-interceptors-5.5.0.jar
      CONNECT_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
      CONNECT_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
      CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components"
      CONNECT_LOG4J_LOGGERS: org.apache.zookeeper=ERROR,org.I0Itec.zkclient=ERROR,org.reflections=ERROR

  control-center:
    image: confluentinc/cp-enterprise-control-center:5.5.0
    hostname: control-center
    container_name: control-center
    depends_on:
      - zookeeper
      - broker
      - schema-registry
      - connect
      - ksqldb-server
    ports:
      - "9021:9021"
    environment:
      CONTROL_CENTER_BOOTSTRAP_SERVERS: 'broker:29092'
      CONTROL_CENTER_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      CONTROL_CENTER_CONNECT_CLUSTER: 'connect:8083'
      CONTROL_CENTER_KSQL_KSQLDB1_URL: "http://ksqldb-server:8088"
      CONTROL_CENTER_KSQL_KSQLDB1_ADVERTISED_URL: "http://localhost:8088"
      CONTROL_CENTER_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
      CONTROL_CENTER_REPLICATION_FACTOR: 1
      CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS: 1
      CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1
      CONFLUENT_METRICS_TOPIC_REPLICATION: 1
      PORT: 9021

  ksqldb-server:
    image: confluentinc/cp-ksqldb-server:5.5.0
    hostname: ksqldb-server
    container_name: ksqldb-server
    depends_on:
      - broker
      - connect
    ports:
      - "8088:8088"
    environment:
      KSQL_CONFIG_DIR: "/etc/ksql"
      KSQL_BOOTSTRAP_SERVERS: "broker:29092"
      KSQL_HOST_NAME: ksqldb-server
      KSQL_LISTENERS: "http://0.0.0.0:8088"
      KSQL_CACHE_MAX_BYTES_BUFFERING: 0
      KSQL_KSQL_SCHEMA_REGISTRY_URL: "http://schema-registry:8081"
      KSQL_PRODUCER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor"
      KSQL_CONSUMER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor"
      KSQL_KSQL_CONNECT_URL: "http://connect:8083"

  ksqldb-cli:
    image: confluentinc/cp-ksqldb-cli:5.5.0
    container_name: ksqldb-cli
    depends_on:
      - broker
      - connect
      - ksqldb-server
    entrypoint: /bin/sh
    tty: true

  ksql-datagen:
    image: confluentinc/ksqldb-examples:5.5.0
    hostname: ksql-datagen
    container_name: ksql-datagen
    depends_on:
      - ksqldb-server
      - broker
      - schema-registry
      - connect
    command: "bash -c 'echo Waiting for Kafka to be ready... && \
                       cub kafka-ready -b broker:29092 1 40 && \
                       echo Waiting for Confluent Schema Registry to be ready... && \
                       cub sr-ready schema-registry 8081 40 && \
                       echo Waiting a few seconds for topic creation to finish... && \
                       sleep 11 && \
                       tail -f /dev/null'"
    environment:
      KSQL_CONFIG_DIR: "/etc/ksql"
      STREAMS_BOOTSTRAP_SERVERS: broker:29092
      STREAMS_SCHEMA_REGISTRY_HOST: schema-registry
      STREAMS_SCHEMA_REGISTRY_PORT: 8081

  rest-proxy:
    image: confluentinc/cp-kafka-rest:5.5.0
    depends_on:
      - zookeeper
      - broker
      - schema-registry
    ports:
      - 8082:8082
    hostname: rest-proxy
    container_name: rest-proxy
    environment:
      KAFKA_REST_HOST_NAME: rest-proxy
      KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092'
      KAFKA_REST_LISTENERS: "http://0.0.0.0:8082"
      KAFKA_REST_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'

I run the services using the command:

docker-compose up -d

After a while the services look -

and I was not able to reach the control center in the localhost:9021 they the port is listening. I look for the container logs and find these:

control-center

control-center  | [2021-12-03 06:12:52,137] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-4-consumer, groupId=_confluent-controlcenter-5-5-0-1] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,143] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-4-consumer, groupId=_confluent-controlcenter-5-5-0-1] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,142] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-8-consumer, groupId=_confluent-controlcenter-5-5-0-1] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,146] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-8-consumer, groupId=_confluent-controlcenter-5-5-0-1] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,151] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-2-consumer, groupId=_confluent-controlcenter-5-5-0-1] Join group failed with org.apache.kafka.common.errors.MemberIdRequiredException: The group member needs to have a valid member id before actually entering a consumer group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,155] INFO [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-2-consumer, groupId=_confluent-controlcenter-5-5-0-1] (Re-)joining group (org.apache.kafka.clients.consumer.internals.AbstractCoordinator)
control-center  | [2021-12-03 06:12:52,277] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-7-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,278] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-4-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 6 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,296] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-3-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 6 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,298] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-5-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 7 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,306] INFO streams in state=REBALANCING (io.confluent.controlcenter.streams.KafkaStreamsManager)
control-center  | [2021-12-03 06:12:52,297] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-8-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [2021-12-03 06:12:52,310] INFO tocheck=[Store{name=KSTREAM-OUTEROTHER-0000000105-store, rollup=false}, Store{name=TriggerActionsStore, rollup=false}, Store{name=TriggerEventsStore, rollup=false}, Store{name=AlertHistoryStore, rollup=false}, Store{name=MonitoringMessageAggregatorWindows, rollup=true}, Store{name=MetricsAggregateStore, rollup=false}, Store{name=Group, rollup=true}, Store{name=MonitoringTriggerStore, rollup=false}, Store{name=group-aggregate-store, rollup=true}, Store{name=monitoring-aggregate-rekey-store, rollup=false}, Store{name=aggregatedTopicPartitionTableWindows, rollup=true}, Store{name=MonitoringVerifierStore, rollup=false}, Store{name=KSTREAM-OUTERTHIS-0000000104-store, rollup=false}, Store{name=aggregate-topic-partition-store, rollup=false}, Store{name=MonitoringStream, rollup=true}] (io.confluent.controlcenter.streams.KafkaStreamsManager)
control-center  | [2021-12-03 06:12:52,310] INFO streams in state=REBALANCING (io.confluent.controlcenter.streams.KafkaStreamsManager)
control-center  | #
control-center  | # A fatal error has been detected by the Java Runtime Environment:
control-center  | #
control-center  | #  SIGSEGV[thread 283969722112 also had an error]
control-center  | [thread 283968669440 also had an error]
control-center  |  (0xb) at pc=0x000000400c04f320, pid=1, tid=0x0000004225fa2700
control-center  | #
control-center  | # JRE version: OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (8.0_212-b04) (build 1.8.0_212-b04)
control-center  | # Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-amd64 compressed oops)
control-center  | # Problematic frame:
control-center  | # [thread 284374480640 also had an error]
control-center  | J 2840 C1 org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.maybeTriggerWakeup()V (48 bytes) @ 0x000000400c04f320 [0x000000400c04f300+0x20]
control-center  | #
control-center  | # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
control-center  | #
control-center  | # An error report file with more information is saved as:
control-center  | # //hs_err_pid1.log
control-center  | [thread 284375533312 also had an error]
control-center  | [thread 284378691328 also had an error]
control-center  | [thread 284377638656 also had an error]
control-center  | [thread 279529854720 also had an error]
control-center  | [2021-12-03 06:12:52,431] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-6-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [thread 284376585984 also had an error]
control-center  | #
control-center  | # If you would like to submit a bug report, please visit:
control-center  | #   http://www.azulsystems.com/support/
control-center  | #
control-center  | qemu: uncaught target signal 6 (Aborted) - core dumped

broker logs

    broker  | [2021-12-03 06:15:52,919] TRACE [Broker id=1] Cached leader info UpdateMetadataPartitionState(topicName='docker-connect-status', partitionIndex=4, controllerEpoch=1, leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], observers=[], offlineReplicas=[]) for partition docker-connect-status-4 in response to UpdateMetadata request sent by controller 1 epoch 1 with correlation id 74 (state.change.logger)
    broker  | [2021-12-03 06:15:52,919] TRACE [Broker id=1] Cached leader info UpdateMetadataPartitionState(topicName='docker-connect-status', partitionIndex=1, controllerEpoch=1, leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], observers=[], offlineReplicas=[]) for partition docker-connect-status-1 in response to UpdateMetadata request sent by controller 1 epoch 1 with correlation id 74 (state.change.logger)
    broker  | [2021-12-03 06:15:52,919] TRACE [Broker id=1] Cached leader info UpdateMetadataPartitionState(topicName='docker-connect-status', partitionIndex=3, controllerEpoch=1, leader=1, leaderEpoch=0, isr=[1], zkVersion=0, replicas=[1], observers=[], offlineReplicas=[]) for partition docker-connect-status-3 in response to UpdateMetadata request sent by controller 1 epoch 1 with correlation id 74 (state.change.logger)
    broker  | [2021-12-03 06:15:52,940] TRACE [Controller id=1 epoch=1] Received response {error_code=0,_tagged_fields={}} for request UPDATE_METADATA with correlation id 74 sent to broker broker:29092 (id: 1 rack: null) (state.change.logger)

I believe this control center log provided the main error:

# A fatal error has been detected by the Java Runtime Environment:
control-center  | #
control-center  | #  SIGSEGV[thread 283969722112 also had an error]
control-center  | [thread 283968669440 also had an error]
control-center  |  (0xb) at pc=0x000000400c04f320, pid=1, tid=0x0000004225fa2700
control-center  | #
control-center  | # JRE version: OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (8.0_212-b04) (build 1.8.0_212-b04)
control-center  | # Java VM: OpenJDK 64-Bit Server VM (25.212-b04 mixed mode linux-amd64 compressed oops)
control-center  | # Problematic frame:
control-center  | # [thread 284374480640 also had an error]
control-center  | J 2840 C1 org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.maybeTriggerWakeup()V (48 bytes) @ 0x000000400c04f320 [0x000000400c04f300+0x20]
control-center  | #
control-center  | # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
control-center  | #
control-center  | # An error report file with more information is saved as:
control-center  | # //hs_err_pid1.log
control-center  | [thread 284375533312 also had an error]
control-center  | [thread 284378691328 also had an error]
control-center  | [thread 284377638656 also had an error]
control-center  | [thread 279529854720 also had an error]
control-center  | [2021-12-03 06:12:52,431] WARN [Consumer clientId=_confluent-controlcenter-5-5-0-1-34f98e4d-4e61-42b9-93f5-dcd8ea94e837-StreamThread-6-consumer, groupId=_confluent-controlcenter-5-5-0-1] Error while fetching metadata with correlation id 8 : {_confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringMessageAggregatorWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-MonitoringStream-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-THREE_HOURS-repartition=UNKNOWN_TOPIC_OR_PARTITION, _confluent-controlcenter-5-5-0-1-aggregatedTopicPartitionTableWindows-ONE_MINUTE-repartition=UNKNOWN_TOPIC_OR_PARTITION} (org.apache.kafka.clients.NetworkClient)
control-center  | [thread 284376585984 also had an error]
control-center  | #
control-center  | # If you would like to submit a bug report, please visit:
control-center  | #   http://www.azulsystems.com/support/
control-center  | #
control-center  | qemu: uncaught target signal 6 (Aborted) - core dumped

This is the Java version that I use:

$ java --version
openjdk 11.0.9.1 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)

Previosuly, I never had an issue with the confluent platform using the docker, so, is this particular to the Apple m1 chip and how do I solve it until confluent provides an official solution?


问:
I want to first connect to aws and hit a python command from Nodejs via Api. Not sure how to do?
I want to execute 'python3 sample.py --path.data=/root/tej4' command from nodejs.The below is my code -

```<code>const runningPython = async(req,res,next) => {
    ssh.connect({
        host: '******',
        port: 22,
        username: 'ubuntu',
        privateKey: '*******'
    }).then(function () {
     exec('python3 sample.py --path.data=/root/tej4', (err, stdout, stderr) => {
        if (err) {
          console.log(err)
        }

        // the *entire* stdout and stderr (buffered)
        console.log(`stdout: ${stdout}`);
        console.log(`stderr: ${stderr}`);
      });
    })
    }
</code>```

But what I am getting response is its trying to run locally rather than on aws cli. Not sure how to achieve this?

```<code>Error: Command failed: python3 sample.py --path.data=/root/tej4
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
  killed: false,
  code: 9009,
  signal: null,
  cmd: 'python3 sample.py --path.data=/root/tej4'
}
stdout:
stderr: Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
</code>```

答:
You have to create an instance of type node_ssh and use that instance to call connect and executeCommand methods

const node_ssh = require('node-ssh');
const ssh = new node_ssh();

ssh
  .connect({
        host: '******',
        port: 22,
        username: 'ubuntu',
        privateKey: '*******'
  })
  .then(() => {
    ssh.execCommand('python3 sample.py --path.data=/root/tej4', { cwd:'/your-python-script-path-here' })
       .then((result) => {
          console.log('STDOUT: ' + result.stdout)
          console.log('STDERR: ' + result.stderr)
       });
```

Body:
I want to execute 'python3 sample.py --path.data=/root/tej4' command from nodejs.The below is my code -

const runningPython = async(req,res,next) => {
    ssh.connect({
        host: '******',
        port: 22,
        username: 'ubuntu',
        privateKey: '*******'
    }).then(function () {
     exec('python3 sample.py --path.data=/root/tej4', (err, stdout, stderr) => {
        if (err) {
          console.log(err)
        }

        // the *entire* stdout and stderr (buffered)
        console.log(`stdout: ${stdout}`);
        console.log(`stderr: ${stderr}`);
      });
    })
    }

But what I am getting response is its trying to run locally rather than on aws cli. Not sure how to achieve this?

Error: Command failed: python3 sample.py --path.data=/root/tej4
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

    at ChildProcess.exithandler (node:child_process:397:12)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
  killed: false,
  code: 9009,
  signal: null,
  cmd: 'python3 sample.py --path.data=/root/tej4'
}
stdout:
stderr: Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.