问:
io.lettuce.core.RedisCommandTimeoutException: Command timed out after 20 second(s)
I have a service that consumed data from Redis streams every second and sends the data to the client via web socket. Everything worked just fine until two weeks ago (this code has been written two years ago). Since then i'm getting lots of RedisCommandTimeoutException errors. This is the full stack trace:

```<code>org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 20 second(s)
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:70)
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41)
at org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisConnection.lambda$translateException$0(LettuceReactiveRedisConnection.java:293)
at reactor.core.publisher.Flux.lambda$onErrorMap$28(Flux.java:7070)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onError(MonoFlatMapMany.java:255)
at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
at io.lettuce.core.RedisPublisher$ImmediateSubscriber.onError(RedisPublisher.java:891)
at io.lettuce.core.RedisPublisher$State.onError(RedisPublisher.java:712)
at io.lettuce.core.RedisPublisher$RedisSubscription.onError(RedisPublisher.java:357)
at io.lettuce.core.RedisPublisher$SubscriptionCommand.onError(RedisPublisher.java:797)
at io.lettuce.core.RedisPublisher$SubscriptionCommand.doOnError(RedisPublisher.java:793)
at io.lettuce.core.protocol.CommandWrapper.completeExceptionally(CommandWrapper.java:128)
at io.lettuce.core.protocol.CommandExpiryWriter.lambda$potentiallyExpire$0(CommandExpiryWriter.java:175)
at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:750)
Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 20 second(s)
at io.lettuce.core.internal.ExceptionFactory.createTimeoutException(ExceptionFactory.java:59)
at io.lettuce.core.protocol.CommandExpiryWriter.lambda$potentiallyExpire$0(CommandExpiryWriter.java:176)
... 8 more
</code>```

This error appears in each subscribed stream at the same time, let's say i have three streams that i'm subscribing to, with names "A", "B" and "C", all of them will have this error at the same time, although i'm using different subscribers for each stream.

Nothing has changed in this service, not in the code and not in the configurations. I looked at the CPU, heap memory, etc. of the service and everything looks fine. I checked AWS Elasticache as well and it seems like there are no problems too (I even talked with AWS support). There is no significant increase in number of streams or opened web sockets.

In addition, i have two other services that write to the Redis streams and they're working great.

I'm using ReactiveRedisConnectionFactory class from spring-data-redis library.
This is configurations:

```<code>@Bean(name = "streamRedisLettuceConnectionFactory")
public RedisConnectionFactory connectionFactory() {
    log.info("Connecting to redis with configuration : {} ", chpStreamRedisConfiguration);
    LettuceClientConfiguration configuration = getLettuceClientConfiguration();
    return new LettuceConnectionFactory(redisStandaloneConfiguration, configuration);
}

@Bean(name = "streamRedisStandaloneConfiguration")
public RedisStandaloneConfiguration getRedisStandaloneConfiguration() {
    return new RedisStandaloneConfiguration(chpStreamRedisConfiguration.getHost(), chpStreamRedisConfiguration.getPort());
}

@Bean(name = "streamLettuceClientConfiguration")
public LettuceClientConfiguration getLettuceClientConfiguration() {
    return LettucePoolingClientConfiguration.builder()
            .poolConfig(getLettucePoolConfig())
            .commandTimeout(Duration.ofMillis(chpStreamRedisConfiguration.getTimeout()))
            .build();
}

@Bean(name = "streamLettucePoolConfig")
public GenericObjectPoolConfig getLettucePoolConfig() {
    GenericObjectPoolConfig genericObjectPoolConfig = new GenericObjectPoolConfig();
    genericObjectPoolConfig.setMaxTotal(chpStreamRedisConfiguration.getConnectionPool().getMaxTotal());
    genericObjectPoolConfig.setMaxIdle(chpStreamRedisConfiguration.getConnectionPool().getMaxTotal());
    genericObjectPoolConfig.setMinIdle(chpStreamRedisConfiguration.getConnectionPool().getMinIdle());
    return genericObjectPoolConfig;
}
</code>```

I'm using:
spring-data-redis:2.3.9.RELEASE
lettuce-core:6.1.2.RELEASE
spring-boot:5.2.18.RELEASE

I tried to upgrade lettuce to the latest version (6.2.2) and it didn't help.
I used io.lettuce.core.protocol on debug and the only thing i got is this:

```<code>Completing command LatencyMeteredCommand [type=XREAD, output=StreamReadOutput [output=[], error='Command timed out after 20 second(s)'], commandType=io.lettuce.core.RedisPublisher$SubscriptionCommand]
</code>```

I prefer not to increase the timeout because 20 seconds is already lot of time.

Body:
I have a service that consumed data from Redis streams every second and sends the data to the client via web socket. Everything worked just fine until two weeks ago (this code has been written two years ago). Since then i'm getting lots of RedisCommandTimeoutException errors. This is the full stack trace:

org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 20 second(s)
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:70)
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41)
at org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisConnection.lambda$translateException$0(LettuceReactiveRedisConnection.java:293)
at reactor.core.publisher.Flux.lambda$onErrorMap$28(Flux.java:7070)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onError(MonoFlatMapMany.java:255)
at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
at io.lettuce.core.RedisPublisher$ImmediateSubscriber.onError(RedisPublisher.java:891)
at io.lettuce.core.RedisPublisher$State.onError(RedisPublisher.java:712)
at io.lettuce.core.RedisPublisher$RedisSubscription.onError(RedisPublisher.java:357)
at io.lettuce.core.RedisPublisher$SubscriptionCommand.onError(RedisPublisher.java:797)
at io.lettuce.core.RedisPublisher$SubscriptionCommand.doOnError(RedisPublisher.java:793)
at io.lettuce.core.protocol.CommandWrapper.completeExceptionally(CommandWrapper.java:128)
at io.lettuce.core.protocol.CommandExpiryWriter.lambda$potentiallyExpire$0(CommandExpiryWriter.java:175)
at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:750)
Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 20 second(s)
at io.lettuce.core.internal.ExceptionFactory.createTimeoutException(ExceptionFactory.java:59)
at io.lettuce.core.protocol.CommandExpiryWriter.lambda$potentiallyExpire$0(CommandExpiryWriter.java:176)
... 8 more

This error appears in each subscribed stream at the same time, let's say i have three streams that i'm subscribing to, with names "A", "B" and "C", all of them will have this error at the same time, although i'm using different subscribers for each stream.

Nothing has changed in this service, not in the code and not in the configurations. I looked at the CPU, heap memory, etc. of the service and everything looks fine. I checked AWS Elasticache as well and it seems like there are no problems too (I even talked with AWS support). There is no significant increase in number of streams or opened web sockets.

In addition, i have two other services that write to the Redis streams and they're working great.

I'm using ReactiveRedisConnectionFactory class from spring-data-redis library.
This is configurations:

@Bean(name = "streamRedisLettuceConnectionFactory")
public RedisConnectionFactory connectionFactory() {
    log.info("Connecting to redis with configuration : {} ", chpStreamRedisConfiguration);
    LettuceClientConfiguration configuration = getLettuceClientConfiguration();
    return new LettuceConnectionFactory(redisStandaloneConfiguration, configuration);
}

@Bean(name = "streamRedisStandaloneConfiguration")
public RedisStandaloneConfiguration getRedisStandaloneConfiguration() {
    return new RedisStandaloneConfiguration(chpStreamRedisConfiguration.getHost(), chpStreamRedisConfiguration.getPort());
}

@Bean(name = "streamLettuceClientConfiguration")
public LettuceClientConfiguration getLettuceClientConfiguration() {
    return LettucePoolingClientConfiguration.builder()
            .poolConfig(getLettucePoolConfig())
            .commandTimeout(Duration.ofMillis(chpStreamRedisConfiguration.getTimeout()))
            .build();
}

@Bean(name = "streamLettucePoolConfig")
public GenericObjectPoolConfig getLettucePoolConfig() {
    GenericObjectPoolConfig genericObjectPoolConfig = new GenericObjectPoolConfig();
    genericObjectPoolConfig.setMaxTotal(chpStreamRedisConfiguration.getConnectionPool().getMaxTotal());
    genericObjectPoolConfig.setMaxIdle(chpStreamRedisConfiguration.getConnectionPool().getMaxTotal());
    genericObjectPoolConfig.setMinIdle(chpStreamRedisConfiguration.getConnectionPool().getMinIdle());
    return genericObjectPoolConfig;
}

I'm using:
spring-data-redis:2.3.9.RELEASE
lettuce-core:6.1.2.RELEASE
spring-boot:5.2.18.RELEASE

I tried to upgrade lettuce to the latest version (6.2.2) and it didn't help.
I used io.lettuce.core.protocol on debug and the only thing i got is this:

Completing command LatencyMeteredCommand [type=XREAD, output=StreamReadOutput [output=[], error='Command timed out after 20 second(s)'], commandType=io.lettuce.core.RedisPublisher$SubscriptionCommand]

I prefer not to increase the timeout because 20 seconds is already lot of time.


来源: stackexchange

问:
Chrome font rendering artifacts
When I'm scrolling page and header become "position: fixed" there is some font rendering issue.

font bug

Properties like

```<code>-webkit-font-smoothing: antialiased;
</code>```

and

```<code>text-rendering: optimizeLegibility;
</code>```

don't help. Also I've tried to reset Chrome flags.

ContentLicense: CC BY-SA 4.0

Title: Chrome font rendering artifacts

Body:
When I'm scrolling page and header become "position: fixed" there is some font rendering issue.

font bug

Properties like

-webkit-font-smoothing: antialiased;

and

text-rendering: optimizeLegibility;

don't help. Also I've tried to reset Chrome flags.


问:
I'm trying to authenticate an Outlook mail with the AUTH2 usin an acces token, but its not working
I can get the acces token and the auth string but after that the athenticate methon is giving me errors the whole time, thats the code I got:

```<code># Metodo para conectar con el servidor de OUTLOOK
def get_token():
    try:

        app = ConfidentialClientApplication(clientID, authority=authority,
                                            client_credential=clientSecret)

        access_token = app.acquire_token_for_client(scopes=scope)

        token = access_token['access_token']
        encoded_token = base64.b64encode(token.encode("utf-8"))
    except Exception as e:
        print (e)
    finally:
        return encoded_token

def generate_auth_string(user1, token):
    auth_string = f"user={user1}\1auth=Bearer {token}\1\1"

    return auth_string

#IMAP AUTHENTICATE
try:
    imap = imaplib.IMAP4_SSL('imap-mail.outlook.com', 993)
    imap.debug = 4
    imap.authenticate("XOAUTH2", generate_auth_string(user1, get_token()))
    imap.select('inbox')
    print("correct")

except Exception as e:
    print("incorrect")
    print (e)
</code>```

first I got the error 'str' object is not callable, I made some changes and then it disapear but authentification was not working anyway, ow I got back the same error on this code, what should I do?

Body:
I can get the acces token and the auth string but after that the athenticate methon is giving me errors the whole time, thats the code I got:

# Metodo para conectar con el servidor de OUTLOOK
def get_token():
    try:

        app = ConfidentialClientApplication(clientID, authority=authority,
                                            client_credential=clientSecret)

        access_token = app.acquire_token_for_client(scopes=scope)

        token = access_token['access_token']
        encoded_token = base64.b64encode(token.encode("utf-8"))
    except Exception as e:
        print (e)
    finally:
        return encoded_token

def generate_auth_string(user1, token):
    auth_string = f"user={user1}\1auth=Bearer {token}\1\1"

    return auth_string

#IMAP AUTHENTICATE
try:
    imap = imaplib.IMAP4_SSL('imap-mail.outlook.com', 993)
    imap.debug = 4
    imap.authenticate("XOAUTH2", generate_auth_string(user1, get_token()))
    imap.select('inbox')
    print("correct")

except Exception as e:
    print("incorrect")
    print (e)

first I got the error 'str' object is not callable, I made some changes and then it disapear but authentification was not working anyway, ow I got back the same error on this code, what should I do?


问:
Implement adaHessian as an optimizer in neural network model
I want to use second order optimizer instead of using SGD, Adam, Adagrad, AdaDelta etc in neural network model. So I found AdaHessian as an optimizer. I have the following code:

```<code># define model
 model = Sequential()
 model.add(Dense(132, input_dim=66, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(88, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(44, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(22, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(1, activation='relu'))
 model.compile(loss='mse', optimizer=optimizer = Adahessian(params=model), metrics=['accuracy'])
 # fit model
 model.fit(trainX, trainy, epochs=50, validation_split=0.2,verbose=0)
 # evaluate the model
 loss, test_acc = model.evaluate(testX, testy, verbose=0)
 return model, loss, test_acc
</code>```

Can anyone help me what params= means in AdaHessian() and what should I do to write i.e., model.parameters() or others? But I got error message:

```<code>AttributeError: 'Sequential' object has no attribute 'parameters'
</code>```

Please show instructions so I can follow to implement second order optimizers in compilation of model.

Body:
I want to use second order optimizer instead of using SGD, Adam, Adagrad, AdaDelta etc in neural network model. So I found AdaHessian as an optimizer. I have the following code:

# define model
 model = Sequential()
 model.add(Dense(132, input_dim=66, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(88, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(44, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(22, activation='linear'))
 model.add(Dropout(0.5))
 model.add(Dense(1, activation='relu'))
 model.compile(loss='mse', optimizer=optimizer = Adahessian(params=model), metrics=['accuracy'])
 # fit model
 model.fit(trainX, trainy, epochs=50, validation_split=0.2,verbose=0)
 # evaluate the model
 loss, test_acc = model.evaluate(testX, testy, verbose=0)
 return model, loss, test_acc

Can anyone help me what params= means in AdaHessian() and what should I do to write i.e., model.parameters() or others? But I got error message:

AttributeError: 'Sequential' object has no attribute 'parameters'

Please show instructions so I can follow to implement second order optimizers in compilation of model.


问:
Prevent fullcalendar (react) from rerendering eventContent too many times (performance issues)
I am working on a student management app and I am using fullcalendar (react) to render the calendar. I am using the eventContent prop to render custom events. The problem is that the eventContent function is called too many times and it causes performance issues.

```<code>import React from "react";
import FullCalendar from "@fullcalendar/react";

import interactionPlugin from "@fullcalendar/interaction";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";

// TODO
// 1. Custom Event / Task / Reminder
// 2. CRUD with modals and popups
// 3. change caledar styles and add custom icons
// 4. refactor code and split into components

interface ICalendar {
  initialData: any;
  categories: any;
}

type TCalendarState = {
  data: any;
  initialData: any;
};

class Calendar extends React.Component<ICalendar, TCalendarState> {
  calendarRef = React.createRef<any>();

  state: TCalendarState = {
    data: [],
    initialData: this.props.initialData,
  };

  prevousMonth = () => {
    this.calendarRef.current.getApi().prev();
  };

  nextMonth = () => {
    this.calendarRef.current.getApi().next();
  };

  currentDate = () => {
    this.calendarRef.current.getApi().today();
  };

  changeView = (e: any) => {
    this.calendarRef.current.getApi().changeView(e.target.value);
  };

  filterEvents = (e: any) => {
    const value = e.target.value;
    const calendarApi = this.calendarRef.current.getApi();
    calendarApi.removeAllEventSources();

    if (value === "All") {
      calendarApi.addEventSource(this.state.initialData);
    }

    const filteredEvents = this.state.initialData.filter(
      (event: any) => event.extendedProps.category === value
    );

    calendarApi.addEventSource(filteredEvents);
  };

  render() {
    return (
      <>
        {/* Header */}
        <div>
          <button onClick={this.prevousMonth}>Prevous Month</button>
          <button onClick={this.currentDate}>Today</button>
          <button onClick={this.nextMonth}>Next Month</button>
          {/* Select event type */}
          <select onChange={this.filterEvents}>
            {/* All option */}
            <option value="All">All</option>
            {/* map in Categories and render options */}
            {this.props.categories.map((category: any, index: number) => (
              <option key={index} value={category}>
                {category}
              </option>
            ))}
          </select>

          {/* Change view */}
          <select onChange={this.changeView}>
            <option value="dayGridMonth">month</option>
            <option value="timeGridWeek">week</option>
            <option value="timeGridDay">day</option>
          </select>

          {/* Current Date Title*/}
          <span>{this.calendarRef.current?.getApi().view.title}</span>
        </div>

        <div
          style={{
            width: "800px",
            height: "800px",
          }}
        >
          <FullCalendar
            ref={this.calendarRef}
            plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
            initialView="dayGridMonth"
            // Remove header
            headerToolbar={false}
            editable={true}
            selectable={true}
            selectMirror={true}
            dayMaxEvents={true}
            weekends={true}
            initialEvents={this.state.initialData}
            eventsSet={this.handleEvents}
            eventContent={this.EventContent}
          />
        </div>
      </>
    );
  }

  handleEvents = (events: any) => {
    console.log("run handleEvents");
    this.setState({ data: events });
  };

  // this function cases too many rerenders and performance issues (need to fix)
  EventContent(eventInfo: any) {
    console.log("handleEvents called");
    return (
      <>
        {/* check if type in task or event */}
        {eventInfo.event.extendedProps.type === "Task" ? (
          <div className="flex flex-row">
            {/* check box to complete task */}
            <input
              type="checkbox"
              onClick={() => {
                eventInfo.event.setExtendedProp(
                  "complete",
                  !eventInfo.event.extendedProps.complete
                );
              }}
            />
            <div
              className={
                eventInfo.event.extendedProps.complete
                  ? "line-through"
                  : "no-underline"
              }
            >
              {eventInfo.event.title}
            </div>
          </div>
        ) : (
          <div className="flex flex-row">
            <div className="event__time">{eventInfo.timeText}</div>
            <div className="event__title">{eventInfo.event.title}</div>
          </div>
        )}
      </>
    );
  }
}

export default React.memo(Calendar);
</code>```

I tried to use React.memo but it didn't work. I also tried to use useCallback but it didn't work either. I am not sure what to do. I would appreciate any help. Thanks in advance.

Body:
I am working on a student management app and I am using fullcalendar (react) to render the calendar. I am using the eventContent prop to render custom events. The problem is that the eventContent function is called too many times and it causes performance issues.

import React from "react";
import FullCalendar from "@fullcalendar/react";

import interactionPlugin from "@fullcalendar/interaction";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";

// TODO
// 1. Custom Event / Task / Reminder
// 2. CRUD with modals and popups
// 3. change caledar styles and add custom icons
// 4. refactor code and split into components

interface ICalendar {
  initialData: any;
  categories: any;
}

type TCalendarState = {
  data: any;
  initialData: any;
};

class Calendar extends React.Component<ICalendar, TCalendarState> {
  calendarRef = React.createRef<any>();

  state: TCalendarState = {
    data: [],
    initialData: this.props.initialData,
  };

  prevousMonth = () => {
    this.calendarRef.current.getApi().prev();
  };

  nextMonth = () => {
    this.calendarRef.current.getApi().next();
  };

  currentDate = () => {
    this.calendarRef.current.getApi().today();
  };

  changeView = (e: any) => {
    this.calendarRef.current.getApi().changeView(e.target.value);
  };

  filterEvents = (e: any) => {
    const value = e.target.value;
    const calendarApi = this.calendarRef.current.getApi();
    calendarApi.removeAllEventSources();

    if (value === "All") {
      calendarApi.addEventSource(this.state.initialData);
    }

    const filteredEvents = this.state.initialData.filter(
      (event: any) => event.extendedProps.category === value
    );

    calendarApi.addEventSource(filteredEvents);
  };

  render() {
    return (
      <>
        {/* Header */}

          <button onClick={this.prevousMonth}>Prevous Month</button>
          <button onClick={this.currentDate}>Today</button>
          <button onClick={this.nextMonth}>Next Month</button>
          {/* Select event type */}
          <select onChange={this.filterEvents}>
            {/* All option */}
            <option value="All">All</option>
            {/* map in Categories and render options */}
            {this.props.categories.map((category: any, index: number) => (
              <option key={index} value={category}>
                {category}
              </option>
            ))}
          </select>

          {/* Change view */}
          <select onChange={this.changeView}>
            <option value="dayGridMonth">month</option>
            <option value="timeGridWeek">week</option>
            <option value="timeGridDay">day</option>
          </select>

          {/* Current Date Title*/}
          {this.calendarRef.current?.getApi().view.title}

          <FullCalendar
            ref={this.calendarRef}
            plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
            initialView="dayGridMonth"
            // Remove header
            headerToolbar={false}
            editable={true}
            selectable={true}
            selectMirror={true}
            dayMaxEvents={true}
            weekends={true}
            initialEvents={this.state.initialData}
            eventsSet={this.handleEvents}
            eventContent={this.EventContent}
          />

      </>
    );
  }

  handleEvents = (events: any) => {
    console.log("run handleEvents");
    this.setState({ data: events });
  };

  // this function cases too many rerenders and performance issues (need to fix)
  EventContent(eventInfo: any) {
    console.log("handleEvents called");
    return (
      <>
        {/* check if type in task or event */}
        {eventInfo.event.extendedProps.type === "Task" ? (

            {/* check box to complete task */}
            <input
              type="checkbox"
              onClick={() => {
                eventInfo.event.setExtendedProp(
                  "complete",
                  !eventInfo.event.extendedProps.complete
                );
              }}
            />

              {eventInfo.event.title}

        ) : (

{eventInfo.timeText}

{eventInfo.event.title}

        )}
      </>
    );
  }
}

export default React.memo(Calendar);

I tried to use React.memo but it didn't work. I also tried to use useCallback but it didn't work either. I am not sure what to do. I would appreciate any help. Thanks in advance.


问:
How to connect to laravel soketi from other client except laravel-echo?
I am using laravel soketi package. And I dont want to use laravel-echo for client connection. So, I am testing with firecamp. But not able to connect.

Soketi is up and running with

```<code>  Server is up and running!
    The Websockets server is available at 127.0.0.1:6001
    The HTTP API server is available at http://127.0.0.1:6001
    The /usage endpoint is available on port 9601.
</code>```

and in firecamp to connect I use url as ws://localhost:6001/
but it could not get connected.

So, how to get connected?

Body:
I am using laravel soketi package. And I dont want to use laravel-echo for client connection. So, I am testing with firecamp. But not able to connect.

Soketi is up and running with

  Server is up and running!
    The Websockets server is available at 127.0.0.1:6001
    The HTTP API server is available at http://127.0.0.1:6001
    The /usage endpoint is available on port 9601.

and in firecamp to connect I use url as ws://localhost:6001/
but it could not get connected.

So, how to get connected?


问:
CSS counter problem in Firefox - ul interferes with ol > li counter in Firefox

ol {
  counter-reset: item;
}

ol>li {
  counter-increment: item;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><ul>
  <li>ul 1 test 1</li>
  <li>ul 1 test 2</li>
  <li>ul 1 test 3</li>
</ul>
<ol>
  <li>ol 1 test 1</li>
  <li>ol 1 test 2</li>
  <li>ol 1 test 3</li>
</ol>
<ul>
  <li>ul 2 test 1</li>
  <li>ul 2 test 2</li>
  <li>ul 2 test 3</li>
</ul>
<ol>
  <li>ol 2 test 1</li>
  <li>ol 2 test 2</li>
  <li>ol 2 test 3</li>
</ol>
<ol>
  <li>ol 3 test 1</li>
  <li>ol 3 test 2</li>
  <li>ol 3 test 3</li>
</ol></code>```

You can test this out in your different browsers Chrome & Firefox and it will give you different results..

In firefox the counter doesn't get reset and continues counting on the amount of
 elements in the
 element.

In Chrome there is no problem.

Is this a bug in Firefox?

Should I use counter-set instead? This seems to be working. What is the difference?

Should I add counter-reset to the unordered list? This also seems to be working.

Body:
ol {
  counter-reset: item;
}

ol>li {
  counter-increment: item;
}

ul 1 test 1

ul 1 test 2

ul 1 test 3

ol 1 test 1

ol 1 test 2

ol 1 test 3

ul 2 test 1

ul 2 test 2

ul 2 test 3

ol 2 test 1

ol 2 test 2

ol 2 test 3

ol 3 test 1

ol 3 test 2

ol 3 test 3

You can test this out in your different browsers Chrome & Firefox and it will give you different results..

In firefox the counter doesn't get reset and continues counting on the amount of
 elements in the
 element.

In Chrome there is no problem.

Is this a bug in Firefox?

Should I use counter-set instead? This seems to be working. What is the difference?

Should I add counter-reset to the unordered list? This also seems to be working.


问:
How to keep the longest token of text analysis result in elasticsearch?
I use  medcl /
elasticsearch-analysis-pinyin  to ayalyze a text field, and I want only keep the longest token in the analysis result.

For example in the below result, only keep the longest token english123djcjdj.

Is there a token filter for this?

I've checked the token filter doc of elasticsearch, there is an limit token count filter which only keep the first token which it not match my case.

```<code># curl -H 'Content-type:application/json' -XPOST localhost:8200/pinyin/_analyze?pretty -d '{"analyzer":"pinyin_analyzer","text":"english 123DJ曾经DJ"}'
{
  "tokens" : [
    {
      "token" : "english123dj",
      "start_offset" : 0,
      "end_offset" : 0,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "english123djcjdj",
      "start_offset" : 0,
      "end_offset" : 0,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "dj",
      "start_offset" : 0,
      "end_offset" : 0,
      "type" : "word",
      "position" : 1
    }
  ]
}

</code>```

Body:
I use  medcl /
elasticsearch-analysis-pinyin  to ayalyze a text field, and I want only keep the longest token in the analysis result.

For example in the below result, only keep the longest token english123djcjdj.

Is there a token filter for this?

I've checked the token filter doc of elasticsearch, there is an limit token count filter which only keep the first token which it not match my case.

# curl -H 'Content-type:application/json' -XPOST localhost:8200/pinyin/_analyze?pretty -d '{"analyzer":"pinyin_analyzer","text":"english 123DJ曾经DJ"}'
{
  "tokens" : [
    {
      "token" : "english123dj",
      "start_offset" : 0,
      "end_offset" : 0,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "english123djcjdj",
      "start_offset" : 0,
      "end_offset" : 0,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "dj",
      "start_offset" : 0,
      "end_offset" : 0,
      "type" : "word",
      "position" : 1
    }
  ]
}


问:
Gson annotations with Kotlin
I have a SpringBoot project with Kotlin, and I am using Gson to read and write Json. I am trying to annotate some fields away from Json by custom annotations:

```<code>data class Order(
    val external: Boolean,
    val orderNumber: String,
    val companyName: String,
    @Exclude val vatCode: String,
)
</code>```

Here is how I define strategy:

```<code>private final var strategy: ExclusionStrategy = object : ExclusionStrategy {
    override fun shouldSkipClass(clazz: Class<*>?): Boolean {
        return false
    }

    override fun shouldSkipField(field: FieldAttributes): Boolean {
        return field.getAnnotation(Exclude::class.java) != null
    }
}

</code>```

And implement it here:

```<code>val gson = GsonBuilder().setExclusionStrategies(strategy).create()
</code>```

But it won't work. It seems that annotation is not recognized / cannot be read by strategy functions. What might cause the problem?

Title: Gson annotations with Kotlin

Body:
I have a SpringBoot project with Kotlin, and I am using Gson to read and write Json. I am trying to annotate some fields away from Json by custom annotations:

data class Order(
    val external: Boolean,
    val orderNumber: String,
    val companyName: String,
    @Exclude val vatCode: String,
)

Here is how I define strategy:

private final var strategy: ExclusionStrategy = object : ExclusionStrategy {
    override fun shouldSkipClass(clazz: Class<*>?): Boolean {
        return false
    }

    override fun shouldSkipField(field: FieldAttributes): Boolean {
        return field.getAnnotation(Exclude::class.java) != null
    }
}

And implement it here:

val gson = GsonBuilder().setExclusionStrategies(strategy).create()

But it won't work. It seems that annotation is not recognized / cannot be read by strategy functions. What might cause the problem?


问:
can i able to configure my device as RTSP streaming server
Please confirm me one thing , can i able to configure my device as RTSP streaming server.

can this allow to play video from sdcard android

ContentLicense: CC BY-SA 3.0


问:
Response validation Doesn't work properly in ktor
So I have an API response like this :

If it succeed

```<code>{"success":true,"message":"user found","data": {data} }
</code>```

If failed

```<code>{"success":false,"message":"user not found" }
</code>```

the response code for the two above is 200.

After reading Ktor's documentation, we can use Response validation (https://ktor.io/docs/response-validation.html#2xx).

When I get a response with status = false, the validation is working properly.

But when I get response with status = true, I get this error

```<code>io.ktor.serialization.JsonConvertException: Illegal input
</code>```

But if I don't use validationResponse, and get response API status = true everything is fine.

My code now

```<code>HttpResponseValidator {
            validateResponse { response ->
                val error: ErrorResponse = response.body()

                if (!error.success) {
                    if (error.message.equals("bad_password", ignoreCase = true)) {
                        throw ResponseException.BadPassword
                    } else {
                        if (error.message.isEmpty()) {
                            throw ResponseException.BadRequest
                        } else {
                            throw ResponseException.UnknownError(
                                error = error.message
                            )
                        }
                    }
                }
            }
        }

@Serializable
data class ErrorResponse(
    @SerialName("message")
    val message: String,
    @SerialName("success")
    val success: Boolean
)
</code>```

is there any way to solve this ?

Body:
So I have an API response like this :

If it succeed

{"success":true,"message":"user found","data": {data} }

If failed

{"success":false,"message":"user not found" }

the response code for the two above is 200.

After reading Ktor's documentation, we can use Response validation (https://ktor.io/docs/response-validation.html#2xx).

When I get a response with status = false, the validation is working properly.

But when I get response with status = true, I get this error

io.ktor.serialization.JsonConvertException: Illegal input

But if I don't use validationResponse, and get response API status = true everything is fine.

My code now

HttpResponseValidator {
            validateResponse { response ->
                val error: ErrorResponse = response.body()

                if (!error.success) {
                    if (error.message.equals("bad_password", ignoreCase = true)) {
                        throw ResponseException.BadPassword
                    } else {
                        if (error.message.isEmpty()) {
                            throw ResponseException.BadRequest
                        } else {
                            throw ResponseException.UnknownError(
                                error = error.message
                            )
                        }
                    }
                }
            }
        }

@Serializable
data class ErrorResponse(
    @SerialName("message")
    val message: String,
    @SerialName("success")
    val success: Boolean
)

is there any way to solve this ?


问:
How to deploy dash app to the web server with responsive design?
I wrote a dash app that takes in various parameters and excel files from the user and downloads another excel file depending on the parameters provided by the user.

When I run this app on the my local port 8011, app layout looks fine, however, when we deployed the app on a live server, the app became distorted and the layout did not come out to be the same as when I run the same app on my local port. Is there something I can do to fix this layout problem?

Local Port Layout

Live Server Layout

I coded the app and tested it only on my local port using Debug==True and it looked fine but when the app was deployed on a live server, it was not the same. I could not try to fix it because I do not know the source of this problem and have no experience in web design at all.

UPDATE :

"Hr" and "Br" elements do not seem to work

After div elements, there is no next line (continues on the same line)


问:
Spring boot modular monolith project using different context for each service (module)
I am trying to create a modular-monolith project. I have application, user-service and product-service. When I tried to change the context path for the user and product service, it was not affected.

I put this config to my application.properties file for user and product services.

```<code>server.servlet.context-path=/user-service
server.servlet.context-path=/product-service
</code>```

My application module code:

```<code>@SpringBootApplication(scanBasePackages = {
        "com.gucardev.userservice",
        "com.gucardev.productservice"
})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
</code>```

And my top pom.xml file:

```<code>   <modules>
        <module>user-service</module>
        <module>product-service</module>
        <module>application</module>
    </modules>
</code>```

Body:
I am trying to create a modular-monolith project. I have application, user-service and product-service. When I tried to change the context path for the user and product service, it was not affected.

I put this config to my application.properties file for user and product services.

server.servlet.context-path=/user-service
server.servlet.context-path=/product-service

My application module code:

@SpringBootApplication(scanBasePackages = {
        "com.gucardev.userservice",
        "com.gucardev.productservice"
})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

And my top pom.xml file:

   <modules>
        <module>user-service</module>
        <module>product-service</module>
        <module>application</module>
    </modules>


问:
An error occurred in the secure channel support WSL
```<code>wsl --install
Windows Subsystem for Linux is already installed.
An error occurred in the secure channel support
wsl --list --online
An error occurred in the secure channel support
</code>```

how to make it work?
i also selected ssl 3.0 from the internet options and TLS 1.2,1.3 are checked too. it still doesn't work.

Body:
wsl --install
Windows Subsystem for Linux is already installed.
An error occurred in the secure channel support
wsl --list --online
An error occurred in the secure channel support

how to make it work?
i also selected ssl 3.0 from the internet options and TLS 1.2,1.3 are checked too. it still doesn't work.


问:
ERROR: could not open file "C:\Users\kelly\Downloads\orders_data.csv" for reading: No such file or directory
It shows this when I try to import a csv file to my postgresql

I did this but still shows similar error

```<code>COPY public."orders_data" from 'C:\Users\kelly\Downloads\orders_data.csv' DELIMITERS ',' csv Header;
</code>```

I have created my table already, I just want to import the csv files into the table but I keep getting error message

Body:
It shows this when I try to import a csv file to my postgresql

I did this but still shows similar error

COPY public."orders_data" from 'C:\Users\kelly\Downloads\orders_data.csv' DELIMITERS ',' csv Header;

I have created my table already, I just want to import the csv files into the table but I keep getting error message


问:
Creating transaction to send BNB via BNB Smart Chain with Wallet Core on iOS
I try to create, sign and broadcast transactions through the Tatum. But can't find any example of how to do this. All I know is that BSC network is based on Ethereum  Virtual Machine. So my transaction should be like this:

```<code>let signerInput = EthereumSigningInput.with {
    $0.chainID = chainID
    $0.gasPrice = gasPrice
    $0.gasLimit = gasLimit
    $0.to = address
    $0.nonce = transactionsCount
    $0.transaction = EthereumTransaction.with {
               $0.transfer = EthereumTransaction.Transfer.with {
                   $0.amount = amountData
               }
    }
    $0.privateKey = wallet.getKeyForCoin(coin: .smartChain).data
}

let output: EthereumSigningOutput = AnySigner.sign(
    input: signerInput,
    coin: .smartChain
)
</code>```

Am I wrong? Should I prepare the transaction in some other way?
Thank you!

I try to use Ethereum style transactions via BNB Smart Chain network.

Body:
I try to create, sign and broadcast transactions through the Tatum. But can't find any example of how to do this. All I know is that BSC network is based on Ethereum  Virtual Machine. So my transaction should be like this:

let signerInput = EthereumSigningInput.with {
    $0.chainID = chainID
    $0.gasPrice = gasPrice
    $0.gasLimit = gasLimit
    $0.to = address
    $0.nonce = transactionsCount
    $0.transaction = EthereumTransaction.with {
               $0.transfer = EthereumTransaction.Transfer.with {
                   $0.amount = amountData
               }
    }
    $0.privateKey = wallet.getKeyForCoin(coin: .smartChain).data
}

let output: EthereumSigningOutput = AnySigner.sign(
    input: signerInput,
    coin: .smartChain
)

Am I wrong? Should I prepare the transaction in some other way?
Thank you!

I try to use Ethereum style transactions via BNB Smart Chain network.


问:
searching an External user in People picker and starting an invitation
I would like to know, how can I search for non-existing external users and sending them an email like the picture bellow

Below is the code that I have used:

```<code>   <PeoplePicker
        context={porps.context as any}
        personSelectionLimit={3}
        groupName={""}
        onChange={_addUser}
        principalTypes={[PrincipalType.User, PrincipalType.SecurityGroup]}
        resolveDelay={200}
        defaultSelectedUsers={_Picker}

      />
</code>```

Body:
I would like to know, how can I search for non-existing external users and sending them an email like the picture bellow

Below is the code that I have used:

   <PeoplePicker
        context={porps.context as any}
        personSelectionLimit={3}
        groupName={""}
        onChange={_addUser}
        principalTypes={[PrincipalType.User, PrincipalType.SecurityGroup]}
        resolveDelay={200}
        defaultSelectedUsers={_Picker}

      />


问:
ERROR TypeError: (moment__WEBPACK_IMPORTED_MODULE_1___namespace_cache || moment__WEBPACK_IMPORTED_MODULE_1___namespace_cache) is not a function
I was migrating my angular 11 app to angular 14. I had a custom npm package that used moment 2.29.3. i also had the same moment package installed in app also. Now i am getting following console error in the app where i am using the npm package

ERROR TypeError: (moment__WEBPACK_IMPORTED_MODULE_1___namespace_cache || moment__WEBPACK_IMPORTED_MODULE_1___namespace_cache) is not a function

tried various solution mentioned in the following posts
using Moment with Angular library 13 causes an error
https://stackoverflow.com/a/71038799


问:
Cannot change the boolean in table lua love2d
I am creating a simple platformer with love2d in lua.
I want the player to stand on the ground so that it won't fall.

However I got some proablem that I cannot change the string of a table return from player.lua

(It is a table because the player.lua return m and the last sentance, and m is a table)

I tested that the isOnFloor function is work, but I just can't change the boolean in the player table.

Main.lua

```<code>local love = require("love")
local tileMapper = require("tile/tileMapper")
local player = require "player"

local isOnFloor = require("isOnFloor")

function love.load()

    love.window.setMode(1080, 640)

    love.window.setTitle("Simple Platformer")

    tileMapper:spawn()

    tiles = tileMapper.tiles

    player:setValue()

    love.keyboard.keyPressed = {}

end

function love.update(dt)

    for i = 1, #tiles do

        if isOnFloor(player.x, player.y, tiles[i].x, tiles[i].y, 32, 32 * 3, 72, 72) then

            player.currentState = "ground" -- I wanna change it here but when I go back to
 --player.lua and try to let it out put the self.currentState, nothing changed --

        else

            player.currentState = "air"

        end

    end

    player:update(dt)

    love.keyboard.keyPressed = {}

end

</code>```

I try to print out the player.currentState the the line after I set the player.currentState = "ground". It printed out "ground"

But if I print it in player.lua, it is always "air"

player.lua(I didn't paste some of the code here)

```<code>m = {}

function m:setValue()

    self.x = 400
    self.y = 50

    self.vtx = 0

    self.y_input = 0

    self.speed = 300
    self.jumpForce = -800
    self.gravity = 100

    self.anim = {idle = {img = love.graphics.newImage("assets/Idle.png"), maxFrame = 10},
                run = {img = love.graphics.newImage("assets/Run.png"), maxFrame = 11},
                jump = {img = love.graphics.newImage("assets/Jump.png"), maxFrame = 0},
                fall = {img = love.graphics.newImage("assets/Fall.png"), maxFrame = 0}}

    self.currentAnim = nil

    for i = 1, #self.anim do

        self.anim[i]:setFilter("nearest", "nearest")

    end

    self.frame = 0
    self.timer = 0

    self.currentState = nil

end

function m:update(dt)
    print(self.currentState)
    ---------------------- Player States Update ------------------------

    self:getXInput()

    if self.currentState == "ground" then

        if self.vtx == 0 then

            self.currentAnim = self.anim.idle

    elseif not(self.vtx == 0) then

            self.currentAnim = self.anim.run

        end

    elseif self.currentState == "air" then

        self.y_input = self.y_input + self.gravity

        if self.y_input > 0 then

            self.currentAnim = self.anim.fall

        elseif self.y_input < 0  then

            self.currentAnim = self.anim.jump

        end

    end

    ------------------------ Anim --------------------
    self:animUpdate(dt)

    if love.keyboard.keyPressed["space"] == true then

        self.y_input = self.jumpForce

    end

    self.x = self.x + self.speed * dt * self.vtx
    self.y = self.y + self.y_input * dt

end

return m
</code>```

If you have an idea of this porblem, please tell, thank you.

Body:
I am creating a simple platformer with love2d in lua.
I want the player to stand on the ground so that it won't fall.

However I got some proablem that I cannot change the string of a table return from player.lua

(It is a table because the player.lua return m and the last sentance, and m is a table)

I tested that the isOnFloor function is work, but I just can't change the boolean in the player table.

Main.lua

local love = require("love")
local tileMapper = require("tile/tileMapper")
local player = require "player"

local isOnFloor = require("isOnFloor")

function love.load()

    love.window.setMode(1080, 640)

    love.window.setTitle("Simple Platformer")

    tileMapper:spawn()

    tiles = tileMapper.tiles

    player:setValue()

    love.keyboard.keyPressed = {}

end

function love.update(dt)

    for i = 1, #tiles do

        if isOnFloor(player.x, player.y, tiles[i].x, tiles[i].y, 32, 32 * 3, 72, 72) then

            player.currentState = "ground" -- I wanna change it here but when I go back to
 --player.lua and try to let it out put the self.currentState, nothing changed --

        else

            player.currentState = "air"

        end

    end

    player:update(dt)

    love.keyboard.keyPressed = {}

end

I try to print out the player.currentState the the line after I set the player.currentState = "ground". It printed out "ground"

But if I print it in player.lua, it is always "air"

player.lua(I didn't paste some of the code here)

m = {}

function m:setValue()

    self.x = 400
    self.y = 50

    self.vtx = 0

    self.y_input = 0

    self.speed = 300
    self.jumpForce = -800
    self.gravity = 100

    self.anim = {idle = {img = love.graphics.newImage("assets/Idle.png"), maxFrame = 10},
                run = {img = love.graphics.newImage("assets/Run.png"), maxFrame = 11},
                jump = {img = love.graphics.newImage("assets/Jump.png"), maxFrame = 0},
                fall = {img = love.graphics.newImage("assets/Fall.png"), maxFrame = 0}}

    self.currentAnim = nil

    for i = 1, #self.anim do

        self.anim[i]:setFilter("nearest", "nearest")

    end

    self.frame = 0
    self.timer = 0

    self.currentState = nil

end

function m:update(dt)
    print(self.currentState)
    ---------------------- Player States Update ------------------------

    self:getXInput()

    if self.currentState == "ground" then

        if self.vtx == 0 then

            self.currentAnim = self.anim.idle

    elseif not(self.vtx == 0) then

            self.currentAnim = self.anim.run

        end

    elseif self.currentState == "air" then

        self.y_input = self.y_input + self.gravity

        if self.y_input > 0 then

            self.currentAnim = self.anim.fall

        elseif self.y_input < 0  then

            self.currentAnim = self.anim.jump

        end

    end

    ------------------------ Anim --------------------
    self:animUpdate(dt)

    if love.keyboard.keyPressed["space"] == true then

        self.y_input = self.jumpForce

    end

    self.x = self.x + self.speed * dt * self.vtx
    self.y = self.y + self.y_input * dt

end

return m

If you have an idea of this porblem, please tell, thank you.


问:
how to store login history in node js using mongoose schema
i am at initial stage of learning mern stack i dont know to how store the login history whenever a user login

i tried to access with jwt token which is stored in my localstorage

```<code>app.post("/apexa_Admin_login", async (req, res) => { //creating login api

    let isAuthorized = await registermodule.findOne({ userid: req.body.userid, passwordHash: req.body.passwordHash })//using isAuthorized variable along with findone method
    try {
        if (isAuthorized) {

            const token = await isAuthorized.generateToken();

            res.status(200).send({
                message: "we valid",
                token: token,
                id: isAuthorized._id,
                userid: isAuthorized.userid,
                passwordHash: isAuthorized.passwordHash,
                // status: 200
        })

              //try to access with token

            let getTokenHistory = localStorage.getItem("token")
            console.log("token history", getTokenHistory)
            //passing a message
            console.log(token, "token")
        }
        else {

            res.status(404).send('Sorry, cant find that');

        }
    } catch {
        logger.error(new Error(`File Name: ${path.basename(__filename)} | Method Name : Login|  Message: Catch Error`))
    }
})
</code>```

Body:
i am at initial stage of learning mern stack i dont know to how store the login history whenever a user login

i tried to access with jwt token which is stored in my localstorage

app.post("/apexa_Admin_login", async (req, res) => { //creating login api

    let isAuthorized = await registermodule.findOne({ userid: req.body.userid, passwordHash: req.body.passwordHash })//using isAuthorized variable along with findone method
    try {
        if (isAuthorized) {

            const token = await isAuthorized.generateToken();

            res.status(200).send({
                message: "we valid",
                token: token,
                id: isAuthorized._id,
                userid: isAuthorized.userid,
                passwordHash: isAuthorized.passwordHash,
                // status: 200
        })

              //try to access with token

            let getTokenHistory = localStorage.getItem("token")
            console.log("token history", getTokenHistory)
            //passing a message
            console.log(token, "token")
        }
        else {

            res.status(404).send('Sorry, cant find that');

        }
    } catch {
        logger.error(new Error(`File Name: ${path.basename(__filename)} | Method Name : Login|  Message: Catch Error`))
    }
})


问:
how to pass an additional parameter to an OnClick event, asp.net web form?
I have a function called "CreateReportForEachCompany" as following:

```<code>   protected Dictionary<int, List<ReportObject>> CreateReportForEachCompany()
        {
            try
            {
                Dictionary<int, List<ReportObject>> dict = new Dictionary<int, List<ReportObject>>();

                EnvironmentVariable.setEnvId((int)environmentEnum.mll);

                //bakashot_tarif is a VIEW not a TABLE
                DataTable dt = GeneralDbExecuterService.executeSqlSelectDataScript("select * from bakashot_tarif");

                foreach (DataRow dr in dt.Rows)
                {
                    var reportRow = FillObjectWithValues(dr);
                    int company_Id = dr.Field<int>("company_Id");
                    CreateDictionaryPairIfNotExist(dict, company_Id);
                    dict[company_Id].Add(reportRow);
               }
                return dict;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
</code>```

now lets say I invoked it that way and got myself a dictionary with keys/values as needed.

```<code>            var dictionary = CreateReportForEachCompany();

</code>```

now.. I have another function named:

CreateCsvForEachCompany(Dictionary<int, List<ReportObject>> dict)

that TAKES the dictionary as parameter and creates few csvs based on the dictionary keys..

now those two functions above are executed on button click as following:

```<code>  protected void ExecuteProgram(object sender, EventArgs e)
        {
           var dictionary = CreateReportForEachCompany();
           CreateCsvForEachCompany(dictionary);
        }
</code>```

after that, I have a function named TransferSftpOnClick which meant to transfer file via SFTP (secure file transfer protocol ) into a designated location in the server:

```<code>  void TransferSftpOnClick(Dictionary<int, List<ReportObject>> dict)
        {
            EnvironmentVariable.SetSubject(EnvironmentVariable.appSubjectEnum.btl);
            string systemId = "MLL";
            string fileType = "HIYUV-CHEVRA";
            string chargeMonth = DateTime.Now.ToString("yyyyMM");
            var fileCreationDate = DateTime.Now.ToString("yyyyMMdd");
            string fileCreationTime = DateTime.Now.ToString("HHmmss");
            string subject = EnvironmentVariable.appSubjectEnum.btl.ToString().ToUpper();
            string location = EnvironmentVariable.getLocalFilePath() + @"\";

            foreach (KeyValuePair<int, List<ReportObject>> entry in dict)
            {
                FtpUtil ftp = new FtpUtil();
                int key = entry.Key;
                string fileName = systemId + "-" + fileType + "-" + String.Format("{0:00000}", key) + "-" + chargeMonth + "-" + fileCreationDate + "-" + fileCreationTime + ".CSV";
             **ftp.saveFileToFtp(location, key.ToString(), fileName, subject);**
            }
        }
</code>```

I want my function to recognize the dictionary that is executed in function "ExecuteProgram()"
And I want to trigger onClick on TransferSftpOnClick that will just transfer me the files to the designated location.

how can I achieve that? is it even worth doing?
or should I just do this:

```<code>  FtpUtil ftp = new FtpUtil();
  ftp.saveFileToFtp(location, key.ToString(), fileName, subject);

</code>```

under the CreateCsvPerCompany to avoid that mess?

hope I was clear, thanks

Body:
I have a function called "CreateReportForEachCompany" as following:

   protected Dictionary<int, List<ReportObject>> CreateReportForEachCompany()
        {
            try
            {
                Dictionary<int, List<ReportObject>> dict = new Dictionary<int, List<ReportObject>>();

                EnvironmentVariable.setEnvId((int)environmentEnum.mll);

                //bakashot_tarif is a VIEW not a TABLE
                DataTable dt = GeneralDbExecuterService.executeSqlSelectDataScript("select * from bakashot_tarif");

                foreach (DataRow dr in dt.Rows)
                {
                    var reportRow = FillObjectWithValues(dr);
                    int company_Id = dr.Field<int>("company_Id");
                    CreateDictionaryPairIfNotExist(dict, company_Id);
                    dict[company_Id].Add(reportRow);
               }
                return dict;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }

now lets say I invoked it that way and got myself a dictionary with keys/values as needed.

            var dictionary = CreateReportForEachCompany();

now.. I have another function named:

CreateCsvForEachCompany(Dictionary<int, List<ReportObject>> dict)

that TAKES the dictionary as parameter and creates few csvs based on the dictionary keys..

now those two functions above are executed on button click as following:

  protected void ExecuteProgram(object sender, EventArgs e)
        {
           var dictionary = CreateReportForEachCompany();
           CreateCsvForEachCompany(dictionary);
        }

after that, I have a function named TransferSftpOnClick which meant to transfer file via SFTP (secure file transfer protocol ) into a designated location in the server:

  void TransferSftpOnClick(Dictionary<int, List<ReportObject>> dict)
        {
            EnvironmentVariable.SetSubject(EnvironmentVariable.appSubjectEnum.btl);
            string systemId = "MLL";
            string fileType = "HIYUV-CHEVRA";
            string chargeMonth = DateTime.Now.ToString("yyyyMM");
            var fileCreationDate = DateTime.Now.ToString("yyyyMMdd");
            string fileCreationTime = DateTime.Now.ToString("HHmmss");
            string subject = EnvironmentVariable.appSubjectEnum.btl.ToString().ToUpper();
            string location = EnvironmentVariable.getLocalFilePath() + @"\";

            foreach (KeyValuePair<int, List<ReportObject>> entry in dict)
            {
                FtpUtil ftp = new FtpUtil();
                int key = entry.Key;
                string fileName = systemId + "-" + fileType + "-" + String.Format("{0:00000}", key) + "-" + chargeMonth + "-" + fileCreationDate + "-" + fileCreationTime + ".CSV";
             **ftp.saveFileToFtp(location, key.ToString(), fileName, subject);**
            }
        }

I want my function to recognize the dictionary that is executed in function "ExecuteProgram()"
And I want to trigger onClick on TransferSftpOnClick that will just transfer me the files to the designated location.

how can I achieve that? is it even worth doing?
or should I just do this:

  FtpUtil ftp = new FtpUtil();
  ftp.saveFileToFtp(location, key.ToString(), fileName, subject);

under the CreateCsvPerCompany to avoid that mess?

hope I was clear, thanks


问:
Python drive.add_cookie() error encounter
There's this issue that I have that for some reason the driver.add_cookie(cookie) doesn't do anything, I built a CSV from where I can load the cookies from but nothing is happening and I get this in the terminal:

I have removed the actual website for security purposes.

```<code>#Set variables for ease of access
username = 'test'
password = 'test@@'
url = 'https://www.exampleurl.com'
driver = webdriver.Safari()

#Access URL
driver.get(url)

#Create function for cookie loading
def load_cookies(file):
    with open(file, encoding='utf-8-sig') as f:
        dict_reader = DictReader(f)
        list_dict = list(dict_reader)
    return list_dict

#Create Object to store cookies
cookies = load_cookies("webauto_cookies.csv")
for cookie in cookies:
    driver.add_cookie(cookie)

#Refresh the browser
driver.refresh()
</code>```

When the automation runs it opens my browser and then automatically closes because it doesn't recognize the cookies for some reason.

Maybe do I need to just create a dictionary based on the cookies instead of a CSV?

Body:
There's this issue that I have that for some reason the driver.add_cookie(cookie) doesn't do anything, I built a CSV from where I can load the cookies from but nothing is happening and I get this in the terminal:

I have removed the actual website for security purposes.

#Set variables for ease of access
username = 'test'
password = 'test@@'
url = 'https://www.exampleurl.com'
driver = webdriver.Safari()

#Access URL
driver.get(url)

#Create function for cookie loading
def load_cookies(file):
    with open(file, encoding='utf-8-sig') as f:
        dict_reader = DictReader(f)
        list_dict = list(dict_reader)
    return list_dict

#Create Object to store cookies
cookies = load_cookies("webauto_cookies.csv")
for cookie in cookies:
    driver.add_cookie(cookie)

#Refresh the browser
driver.refresh()

When the automation runs it opens my browser and then automatically closes because it doesn't recognize the cookies for some reason.

Maybe do I need to just create a dictionary based on the cookies instead of a CSV?


问:
creating PDF black background instead of image via jsPDF in React js
Hi I am creating pdf with image background via jsPDF library. File creating successfully but making background black instead of image my code is this.

```<code>  const exportBrocharPDF = () => {

   let element = (

  <div style={{ textAlign: "left", width:"600px"}}>
     <div style={{ backgroundImage: `url("https://mentorlogix.com/pricebuilder/pdfimages/4.png")`}}>
            <p  style={{fontSize: "10px", color:"#000"}}>
              Your investment in the maintenance package is just , billed directly to your credit card.
            </p>
      </div>
  </div>
        )

       const doc = new jsPDF("p", "pt", "a4");
       doc.html(ReactDOMServer.renderToString(element), {
       callback: function (doc) {
       doc.save('Brochar.pdf');
     }
    });
  };
</code>```

Result is like this

I am trying a lot but not success please anyone can help to resolve my issue

Body:
Hi I am creating pdf with image background via jsPDF library. File creating successfully but making background black instead of image my code is this.

  const exportBrocharPDF = () => {

   let element = (

     <div style={{ backgroundImage: `url("https://mentorlogix.com/pricebuilder/pdfimages/4.png")`}}>

              Your investment in the maintenance package is just , billed directly to your credit card.

        )

       const doc = new jsPDF("p", "pt", "a4");
       doc.html(ReactDOMServer.renderToString(element), {
       callback: function (doc) {
       doc.save('Brochar.pdf');
     }
    });
  };

Result is like this

I am trying a lot but not success please anyone can help to resolve my issue


问:
Will this code send a notification on this day every month?
I have this code that should send a notification to the user on the same day every month. However I'm can't simulate this, so I can't test it. I was wondering if any of you could proof check it, to ensure it does send a notification every month.
Thanks</p>
```<code>static func addNotification(){
    let center = UNUserNotificationCenter.current()

    let addRequest = {
        let content = UNMutableNotificationContent()
        content.title = "Test"
        content.subtitle = "Test"
        content.sound = UNNotificationSound.default

        var dateComponents = DateComponents()
        dateComponents.day = 31
        dateComponents.hour = 12

        let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)

        let request = UNNotificationRequest(identifier: "", content: content, trigger: trigger)
        center.add(request)
    }

    center.getNotificationSettings { settings in
        if settings.authorizationStatus == .authorized{
            addRequest()
        }
        else{
            center.requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
                if success{
                    addRequest()
                }
            }
        }
    }
}
</code>```

Body:
I have this code that should send a notification to the user on the same day every month. However I'm can't simulate this, so I can't test it. I was wondering if any of you could proof check it, to ensure it does send a notification every month.
Thanks

static func addNotification(){
    let center = UNUserNotificationCenter.current()

    let addRequest = {
        let content = UNMutableNotificationContent()
        content.title = "Test"
        content.subtitle = "Test"
        content.sound = UNNotificationSound.default

        var dateComponents = DateComponents()
        dateComponents.day = 31
        dateComponents.hour = 12

        let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)

        let request = UNNotificationRequest(identifier: "", content: content, trigger: trigger)
        center.add(request)
    }

    center.getNotificationSettings { settings in
        if settings.authorizationStatus == .authorized{
            addRequest()
        }
        else{
            center.requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
                if success{
                    addRequest()
                }
            }
        }
    }
}


问:
Difficulty using buoyancy plugin (libBuoyancyPlugin.so) for my gazebo model(for ROS1)
RE-EDIT:
I want to apply bouyancy plugin my model which is made of 3 links. Do I need to apply the bouyancy plugin to all of the links for my model to float? Or do I just need to apply it to the base_link. The collision geometries for all of links are .dae files. But I have the gemotry of my base_link as a sphere for my Buoyancy plugin. Below is my .urdf.xacro file. For now, my model still phases through my world, so buoyancy isn't working. Not quite sure what I'm doing wrong.

```<code><?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="wam-v">
  <xacro:include filename="properties.urdf.xacro"/>

  <link name="base_link">
    <visual>
     <geometry>
       <mesh filename="package://freddy/mesh/WAM-V.dae"/>
     </geometry>
   </visual>
   <collision name="base_link_collision">
     <geometry>
       <mesh filename="package://freddy/mesh/WAM-V.dae"/>
       <!--sphere radius="1.5" /-->
     </geometry>
   </collision>
   <inertial>
     <mass value="247.07"/>
     <inertia ixx="200" ixy="0.03" ixz="3.09" iyy="500" iyz="-0.05" izz="165.39"/>
     <!--inertia ixx="198.828" ixy="0" ixz="0" iyy="198.828" iyz="0" izz="198.828"/-->
   </inertial>
  </link>

  <joint name="base_link_joint" type="fixed">
    <origin xyz="0 0 1.84"/>
    <parent link="base_footprint"/>
    <child link="base_link"/>
  </joint>

  <link name="base_footprint"/>

  <link name="front_camera_link"/>
  <joint name="front_camera_joint" type="fixed">
    <origin xyz="1.2 0 0"/>
    <parent link="base_link"/>
    <child link="front_camera_link"/>
  </joint>
  <link name="left_camera_link"/>
  <joint name="left_camera_joint" type="fixed">
    <origin xyz="0 0.5 0" rpy="0 0 ${pi/2}"/>
    <parent link="base_link"/>
    <child link="left_camera_link"/>
  </joint>
  <link name="right_camera_link"/>
  <joint name="right_camera_joint" type="fixed">
    <origin xyz="0 -0.5 0" rpy="0 0 ${-pi/2}"/>
    <parent link="base_link"/>
    <child link="right_camera_link"/>
  </joint>
  <link name="rear_camera_link"/>
  <joint name="rear_camera_joint" type="fixed">
    <origin xyz="-0.5 0 0" rpy="0 0 ${pi}"/>
    <parent link="base_link"/>
    <child link="rear_camera_link"/>
  </joint>

  <link name="scan"/>
  <joint name="scan_joint" type="fixed">
    <origin xyz="1.5 0 -1" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="scan"/>
  </joint>

  <link name="right_motor">
    <visual>
     <geometry>
       <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
     </geometry>
    </visual>
    <collision name="right_motor_collision">
      <geometry>
        <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="0.01"/>
      <inertia ixx="0.00086" ixy="0.00" ixz="0.00" iyy="0.00086" iyz="0.00" izz="0.0017"/>
    </inertial>
  </link>

  <joint name="right_motor_joint" type="continuous">
    <origin xyz="${motor_position_x} -${motor_position_y} ${motor_position_z}"/>
    <parent link="base_link"/>
    <child link="right_motor"/>
    <limit effort="0.5293" velocity="100${pi}" />
  </joint>

  <link name="left_motor">
    <visual>
     <geometry>
       <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
     </geometry>
    </visual>
    <collision name="left_motor_collision">
      <geometry>
        <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="0.01"/>
      <inertia ixx="0.00086" ixy="0.00" ixz="0.00" iyy="0.00086" iyz="0.00" izz="0.0017"/>
    </inertial>
  </link>

  <joint name="left_motor_joint" type="continuous">
    <origin xyz="${motor_position_x} ${motor_position_y} ${motor_position_z}"/>
    <parent link="base_link"/>
    <child link="left_motor"/>
    <limit effort="0.5293" velocity="100${pi}" />
  </joint>

  <link name="gps"/>

  <joint name="gps_joint" type="fixed">
    <origin xyz="0.8 0 0"/>
    <parent link="base_link"/>
    <child link="gps"/>
  </joint>

  <transmission name="right_motor_trans">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="right_motor_joint">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="right_motor_actuator">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
      <mechanicalReduction>30</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="left_motor_trans">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="left_motor_joint">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="left_motor_actuator">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
      <mechanicalReduction>30</mechanicalReduction>
    </actuator>
  </transmission>

  <!--gazebo>
        <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
            <commandTopic>cmd_vel</commandTopic>
            <odometryTopic>odom</odometryTopic>
            <odometryFrame>odom</odometryFrame>
            <odometrySource>world</odometrySource>
            <publishOdomTF>true</publishOdomTF>
            <robotBaseFrame>base_footprint</robotBaseFrame>
            <publishWheelTF>false</publishWheelTF>
            <publishTf>true</publishTf>
            <publishWheelJointState>true</publishWheelJointState>
            <legacyMode>false</legacyMode>
            <updateRate>30</updateRate>
            <leftJoint>left_motor_joint</leftJoint>
            <rightJoint>right_motor_joint</rightJoint>
            <wheelSeparation>2.054</wheelSeparation>
            <wheelDiameter>0.098</wheelDiameter>
            <wheelAcceleration>1</wheelAcceleration>
            <wheelTorque>10</wheelTorque>
            <rosDebugLevel>na</rosDebugLevel>
        </plugin>
   </gazebo-->
   <gazebo  reference="scan">
       <plugin name="BuoyancyPlugin" filename="libBuoyancyPlugin.so">
         <!--a viscous liquid -->
        <fluid_density>1000</fluid_density>
        <link name="base_link">
            <center_of_volume>0 0 1.84</center_of_volume>
             <volume>47.712</volume>
        </link>
        <geometry><sphere radius="2.25" /></geometry>
       </plugin>
   </gazebo>

  <xacro:include filename="camera.urdf.xacro"/>
  <xacro:camera prefix="front"/>
  <xacro:camera prefix="right"/>
  <xacro:camera prefix="left"/>
  <xacro:camera prefix="rear"/>

  <xacro:include filename="$(find velodyne_description)/urdf/VLP-16.urdf.xacro"/>
  <VLP-16 parent="base_link" name="velodyne" topic="/velodyne_points">
    <origin xyz="0.8 0 0.3" rpy="0 0 0" />
  </VLP-16>

  <gazebo reference="scan">
    <material>Gazebo/Blue</material>
    <turnGravityOff>false</turnGravityOff>
    <sensor type="ray" name="scan_sensor">
      <pose>0 0 0 0 0 0</pose>
      <visualize>false</visualize>
      <update_rate>40</update_rate>
      <ray>
        <scan>
          <horizontal>
            <samples>720</samples>
            <resolution>1</resolution>
            <min_angle>-1.570796</min_angle>
            <max_angle>1.570796</max_angle>
          </horizontal>
        </scan>
        <range>
          <min>1</min>
          <max>30.0</max>
          <resolution>0.001</resolution>
        </range>
      </ray>
      <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
        <topicName>/scan</topicName>
        <frameName>scan</frameName>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="front_camera_link">
    <sensor type="camera" name="front">
      <update_rate>30.0</update_rate>
      <!--camera name="head"-->
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1].-->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      <!--/camera-->
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/front</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>front_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="right_camera_link">
    <sensor type="camera" name="right">
      <update_rate>30.0</update_rate>
      <!--camera name="head"-->
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1].-->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      <!--/camera-->
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/right</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>right_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="left_camera_link">
    <sensor type="camera" name="left">
      <update_rate>30.0</update_rate>
      <!--camera name="head"-->
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1].-->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      <!--/camera-->
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/left</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>left_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="rear_camera_link">
    <sensor type="camera" name="rear">
      <update_rate>30.0</update_rate>
      <!--camera name="head"-->
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1].-->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      <!--/camera-->
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/rear</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>back_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

</robot>

</code>```

Body:
RE-EDIT:
I want to apply bouyancy plugin my model which is made of 3 links. Do I need to apply the bouyancy plugin to all of the links for my model to float? Or do I just need to apply it to the base_link. The collision geometries for all of links are .dae files. But I have the gemotry of my base_link as a sphere for my Buoyancy plugin. Below is my .urdf.xacro file. For now, my model still phases through my world, so buoyancy isn't working. Not quite sure what I'm doing wrong.

<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="wam-v">
  <xacro:include filename="properties.urdf.xacro"/>

  <link name="base_link">
    <visual>
     <geometry>
       <mesh filename="package://freddy/mesh/WAM-V.dae"/>
     </geometry>
   </visual>
   <collision name="base_link_collision">
     <geometry>
       <mesh filename="package://freddy/mesh/WAM-V.dae"/>

     </geometry>
   </collision>
   <inertial>
     <mass value="247.07"/>
     <inertia ixx="200" ixy="0.03" ixz="3.09" iyy="500" iyz="-0.05" izz="165.39"/>

   </inertial>
  </link>

  <joint name="base_link_joint" type="fixed">
    <origin xyz="0 0 1.84"/>
    <parent link="base_footprint"/>
    <child link="base_link"/>
  </joint>

  <link name="base_footprint"/>

  <link name="front_camera_link"/>
  <joint name="front_camera_joint" type="fixed">
    <origin xyz="1.2 0 0"/>
    <parent link="base_link"/>
    <child link="front_camera_link"/>
  </joint>
  <link name="left_camera_link"/>
  <joint name="left_camera_joint" type="fixed">
    <origin xyz="0 0.5 0" rpy="0 0 ${pi/2}"/>
    <parent link="base_link"/>
    <child link="left_camera_link"/>
  </joint>
  <link name="right_camera_link"/>
  <joint name="right_camera_joint" type="fixed">
    <origin xyz="0 -0.5 0" rpy="0 0 ${-pi/2}"/>
    <parent link="base_link"/>
    <child link="right_camera_link"/>
  </joint>
  <link name="rear_camera_link"/>
  <joint name="rear_camera_joint" type="fixed">
    <origin xyz="-0.5 0 0" rpy="0 0 ${pi}"/>
    <parent link="base_link"/>
    <child link="rear_camera_link"/>
  </joint>

  <link name="scan"/>
  <joint name="scan_joint" type="fixed">
    <origin xyz="1.5 0 -1" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="scan"/>
  </joint>

  <link name="right_motor">
    <visual>
     <geometry>
       <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
     </geometry>
    </visual>
    <collision name="right_motor_collision">
      <geometry>
        <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="0.01"/>
      <inertia ixx="0.00086" ixy="0.00" ixz="0.00" iyy="0.00086" iyz="0.00" izz="0.0017"/>
    </inertial>
  </link>

  <joint name="right_motor_joint" type="continuous">
    <origin xyz="${motor_position_x} -${motor_position_y} ${motor_position_z}"/>
    <parent link="base_link"/>
    <child link="right_motor"/>
    <limit effort="0.5293" velocity="100${pi}" />
  </joint>

  <link name="left_motor">
    <visual>
     <geometry>
       <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
     </geometry>
    </visual>
    <collision name="left_motor_collision">
      <geometry>
        <mesh filename="package://freddy/mesh/PROPELLER.dae"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="0.01"/>
      <inertia ixx="0.00086" ixy="0.00" ixz="0.00" iyy="0.00086" iyz="0.00" izz="0.0017"/>
    </inertial>
  </link>

  <joint name="left_motor_joint" type="continuous">
    <origin xyz="${motor_position_x} ${motor_position_y} ${motor_position_z}"/>
    <parent link="base_link"/>
    <child link="left_motor"/>
    <limit effort="0.5293" velocity="100${pi}" />
  </joint>

  <link name="gps"/>

  <joint name="gps_joint" type="fixed">
    <origin xyz="0.8 0 0"/>
    <parent link="base_link"/>
    <child link="gps"/>
  </joint>

  <transmission name="right_motor_trans">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="right_motor_joint">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="right_motor_actuator">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
      <mechanicalReduction>30</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="left_motor_trans">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="left_motor_joint">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="left_motor_actuator">
      <hardwareInterface>VelocityJointInterface</hardwareInterface>
      <mechanicalReduction>30</mechanicalReduction>
    </actuator>
  </transmission>

   <gazebo  reference="scan">
       <plugin name="BuoyancyPlugin" filename="libBuoyancyPlugin.so">

        <fluid_density>1000</fluid_density>
        <link name="base_link">
            <center_of_volume>0 0 1.84</center_of_volume>
             <volume>47.712</volume>
        </link>
        <geometry><sphere radius="2.25" /></geometry>
       </plugin>
   </gazebo>

  <xacro:include filename="camera.urdf.xacro"/>
  <xacro:camera prefix="front"/>
  <xacro:camera prefix="right"/>
  <xacro:camera prefix="left"/>
  <xacro:camera prefix="rear"/>

  <xacro:include filename="$(find velodyne_description)/urdf/VLP-16.urdf.xacro"/>
  <VLP-16 parent="base_link" name="velodyne" topic="/velodyne_points">
    <origin xyz="0.8 0 0.3" rpy="0 0 0" />
  </VLP-16>

  <gazebo reference="scan">
    <material>Gazebo/Blue</material>
    <turnGravityOff>false</turnGravityOff>
    <sensor type="ray" name="scan_sensor">
      <pose>0 0 0 0 0 0</pose>
      <visualize>false</visualize>
      <update_rate>40</update_rate>
      <ray>
        <scan>
          <horizontal>
            <samples>720</samples>
            <resolution>1</resolution>
            <min_angle>-1.570796</min_angle>
            <max_angle>1.570796</max_angle>
          </horizontal>
        </scan>
        <range>
          <min>1</min>
          <max>30.0</max>
          <resolution>0.001</resolution>
        </range>
      </ray>
      <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
        <topicName>/scan</topicName>
        <frameName>scan</frameName>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="front_camera_link">
    <sensor type="camera" name="front">
      <update_rate>30.0</update_rate>

        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>

          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>

      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/front</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>front_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="right_camera_link">
    <sensor type="camera" name="right">
      <update_rate>30.0</update_rate>

        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>

          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>

      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/right</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>right_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="left_camera_link">
    <sensor type="camera" name="left">
      <update_rate>30.0</update_rate>

        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>

          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>

      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/left</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>left_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

 <gazebo reference="rear_camera_link">
    <sensor type="camera" name="rear">
      <update_rate>30.0</update_rate>

        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>

          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>

      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>wam_v/rear</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>back_camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

</robot>


问:
How to fix flexbox overlapping divs when using media query?
I'm asking my first question here, so I apologize in advance if I didn't explain something well.

I'm currently developing portfolio website (Angular 13 with Sass). I've come to a point where I have two divs placed next to each other inside of a flexbox. I use media query (mobile view) to achieve divs to place below each other. One div contains text and other image.

I'm using Sass for flex box

```<code>@mixin flex-container($flexdirection, $justifycontent: false) {
  @if $justifycontent {
    justify-content: $justifycontent;
  } @else {
    justify-content: center;
  }
  display: flex;
  flex-wrap: wrap;
  row-gap: 20px;
  align-items: center;
  flex-direction: $flexdirection;
}
</code>```

HTML component looks like this

```<code><div class="about" id="about" #about>
    <div class="about__details">
        <h1 class="about__title">{{title}}<span class="purple_highlight">A</span>ndjela. <span class="wave"></span>
        </h1>
        <p class="about__paragraph">{{paragraph}}
        </p>
        <a href="https://drive.google.com/file/d/1PK82zuN4g_Ly5nmNIgRpIsEW9j_gnyaS/view?usp=share_link" target="_blank">
            <button class="about__cv_button">My resume</button>
        </a>
    </div>
    <div class="about__img">
        <img src="assets/img/profilePicture.png" alt="profile">
    </div>
</div>

</code>```

CSS looks like this

```<code>@include mq-between(xs, sm) {
  .about {
    @include flex-container(row);
    height: 100vh;
    &__img {
      background-color: aqua;
      bottom: 0;
      right: 0;
      flex-shrink: 0;
    }
    img {
      max-width: 100%;
      max-height: 100%;
    }
    &__details {
      background-color: blanchedalmond;
      left: 10%;
      right: 10%;
    }
  }
}
</code>```

Result looks like in picture

I've tried using flex-direction as column, flex-basis, max-width, max-height, padding and margin, but nothing seems to make changes for what I'm looking for.

What am I missing to show the divs beneath each other with the correct height?

Body:
I'm asking my first question here, so I apologize in advance if I didn't explain something well.

I'm currently developing portfolio website (Angular 13 with Sass). I've come to a point where I have two divs placed next to each other inside of a flexbox. I use media query (mobile view) to achieve divs to place below each other. One div contains text and other image.

I'm using Sass for flex box

@mixin flex-container($flexdirection, $justifycontent: false) {
  @if $justifycontent {
    justify-content: $justifycontent;
  } @else {
    justify-content: center;
  }
  display: flex;
  flex-wrap: wrap;
  row-gap: 20px;
  align-items: center;
  flex-direction: $flexdirection;
}

HTML component looks like this

{{title}}Andjela.

{{paragraph}}

            <button class="about__cv_button">My resume</button>

CSS looks like this

@include mq-between(xs, sm) {
  .about {
    @include flex-container(row);
    height: 100vh;
    &__img {
      background-color: aqua;
      bottom: 0;
      right: 0;
      flex-shrink: 0;
    }
    img {
      max-width: 100%;
      max-height: 100%;
    }
    &__details {
      background-color: blanchedalmond;
      left: 10%;
      right: 10%;
    }
  }
}

Result looks like in picture

I've tried using flex-direction as column, flex-basis, max-width, max-height, padding and margin, but nothing seems to make changes for what I'm looking for.

What am I missing to show the divs beneath each other with the correct height?