问:
MissingPluginException(No implementation found for method logThis on channel flutter_logs) with testing
i a testing my repository method

```<code>@override
  Future<DataState<bool>> login(String email, String password) async {
    FlutterLogs.logInfo(TAG, ACTION_TAG, 'login');
    return await doSafeApiCall<bool, JwtResponse>(
        () async => await _appApiService.signIn(SignInRequest(email: email, password: password)),
        (responseData) => true,
        extraSuccessAction: (responseData) => _actionAfterEnter(responseData));
  }
</code>```

my test

```<code>test("Login", ()  {
    final String email = 'email';
    final String password = 'password';
    final String token = 'token';
    final String refreshToken = 'refreshToken';

    when(() => secureStorageServiceTest.writeToken(token))
        .thenAnswer((invocation) => Future.value());
    when(() => secureStorageServiceTest.writeRefreshToken(refreshToken))
        .thenAnswer((invocation) => Future.value());

     testingRepoCall<JwtResponse, bool>(
        repoCall: () => repositoryImpl.login(email, password),
        apiCall: () => appApiService.signIn(any<SignInRequest>()),
        response: JwtResponse(token: token, refreshToken: 'refreshToken', type: 'type'));
  });
</code>```

i have error

```<code>package:flutter/src/services/platform_channel.dart 294:7                                         MethodChannel._invokeMethod
===== asynchronous gap ===========================
dart:async                                                                                _CustomZone.registerBinaryCallback
test/unit/repository_test/repository_helpers.dart 37:18                                          testingRepoCall
test/unit/repository_test/authorization_repository/authorization_repositpry_impl_test.dart 61:6  main.<fn>
This test failed after it had already completed. Make sure to use [expectAsync]
or the [completes] matcher when testing async code.
package:flutter/src/services/platform_channel.dart 294:7                                         MethodChannel._invokeMethod
===== asynchronous gap ===========================
dart:async                                                                                _CustomZone.registerBinaryCallback
test/unit/repository_test/repository_helpers.dart 37:18                                          testingRepoCall
test/unit/repository_test/authorization_repository/authorization_repositpry_impl_test.dart 61:6  main.<fn>

MissingPluginException(No implementation found for method logThis on channel flutter_logs)
</code>```

So i have problem with FlutterLogs.logInfo(TAG, ACTION_TAG, 'login');.I use flutter_logs package.I think ,i should mock FlutterLogs, but how can do this?Or any other solution?

Body:
i a testing my repository method

@override
  Future<DataState<bool>> login(String email, String password) async {
    FlutterLogs.logInfo(TAG, ACTION_TAG, 'login');
    return await doSafeApiCall<bool, JwtResponse>(
        () async => await _appApiService.signIn(SignInRequest(email: email, password: password)),
        (responseData) => true,
        extraSuccessAction: (responseData) => _actionAfterEnter(responseData));
  }

my test

test("Login", ()  {
    final String email = 'email';
    final String password = 'password';
    final String token = 'token';
    final String refreshToken = 'refreshToken';

    when(() => secureStorageServiceTest.writeToken(token))
        .thenAnswer((invocation) => Future.value());
    when(() => secureStorageServiceTest.writeRefreshToken(refreshToken))
        .thenAnswer((invocation) => Future.value());

     testingRepoCall<JwtResponse, bool>(
        repoCall: () => repositoryImpl.login(email, password),
        apiCall: () => appApiService.signIn(any<SignInRequest>()),
        response: JwtResponse(token: token, refreshToken: 'refreshToken', type: 'type'));
  });

i have error

package:flutter/src/services/platform_channel.dart 294:7                                         MethodChannel._invokeMethod
===== asynchronous gap ===========================
dart:async                                                                                _CustomZone.registerBinaryCallback
test/unit/repository_test/repository_helpers.dart 37:18                                          testingRepoCall
test/unit/repository_test/authorization_repository/authorization_repositpry_impl_test.dart 61:6  main.<fn>
This test failed after it had already completed. Make sure to use [expectAsync]
or the [completes] matcher when testing async code.
package:flutter/src/services/platform_channel.dart 294:7                                         MethodChannel._invokeMethod
===== asynchronous gap ===========================
dart:async                                                                                _CustomZone.registerBinaryCallback
test/unit/repository_test/repository_helpers.dart 37:18                                          testingRepoCall
test/unit/repository_test/authorization_repository/authorization_repositpry_impl_test.dart 61:6  main.<fn>

MissingPluginException(No implementation found for method logThis on channel flutter_logs)

So i have problem with FlutterLogs.logInfo(TAG, ACTION_TAG, 'login');.I use flutter_logs package.I think ,i should mock FlutterLogs, but how can do this?Or any other solution?


来源: stackexchange

问:
Server/Client Authority issue - Mirror in Unity
I am trying to make a string of text send from the host to the client and vice versa. This is done by sending a string of text from the players' scripts to a gameobject with the the following script on it:

```<code>using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Mirror;

public class AnswerReceiver : NetworkBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(this);
    }
    [SyncVar] public string getfromcards;
    [SyncVar] public string SendToOthers;
    public NetworkIdentity identity;

    public void CardClicked()
    {
        if(isServer) {
            ServerCardClicked();

        }
        else
        {
            ClientCardClicked();
        }

    }
    [Command]
    public void ClientCardClicked()
    {
        SendToOthers = getfromcards;
    }
    [ClientRpc]
    void ServerCardClicked()
    {
        SendToOthers = getfromcards;
    }
}
</code>```

When the script does this, I am able to get text from the client to the server but sending text to the script from the host produces the following error: "Trying to send command for object without authority. AnswerReceiver.ClientCardClicked"

Anyone know whats up?
Thanks

ContentLicense: CC BY-SA 4.0

Body:
I am trying to make a string of text send from the host to the client and vice versa. This is done by sending a string of text from the players' scripts to a gameobject with the the following script on it:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Mirror;

public class AnswerReceiver : NetworkBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(this);
    }
    [SyncVar] public string getfromcards;
    [SyncVar] public string SendToOthers;
    public NetworkIdentity identity;

    public void CardClicked()
    {
        if(isServer) {
            ServerCardClicked();

        }
        else
        {
            ClientCardClicked();
        }

    }
    [Command]
    public void ClientCardClicked()
    {
        SendToOthers = getfromcards;
    }
    [ClientRpc]
    void ServerCardClicked()
    {
        SendToOthers = getfromcards;
    }
}

When the script does this, I am able to get text from the client to the server but sending text to the script from the host produces the following error: "Trying to send command for object without authority. AnswerReceiver.ClientCardClicked"

Anyone know whats up?
Thanks


问:
Rollup Error: Unexpected token on JsnLog's ts: import JSNLogAppender = JL.JSNLogAppender
I have a reproduce repo JsnLogRollup.

I would like to use JsnLog with ES6 way, take jsnlog.ES6Demo main.js as index.ts:

```<code>import {JL} from 'jsnlog';

JL().info("log entry from jsnlog");
</code>```

With Rollup rollup.config.mjs:

```<code>import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';

export default {
  input: 'index.ts',
  output: [
    {
      file: 'index.umd.js',
      format: 'umd',
    },
    {
      file: 'index.es.js',
      format: 'es',
    }
  ],
  plugins: [
    typescript(),
    nodeResolve()
  ]
};
</code>```

I can't make Rollup/TypeScript/JsnLog work together. Rollup shows:

```<code>[!] RollupError: Unexpected token (Note that you need plugins to
import files that are not JavaScript) node_modules/jsnlog/jsnlog.ts
(3:22) 1: /// <reference path="Definitions/jsnlog_interfaces.d.ts"/>
2: 3: import JSNLogAppender = JL.JSNLogAppender
                            ^
</code>```

Save index.ts unchanged again, rollup produce different error:

```<code>[!] RollupError: "JL" is not exported by "node_modules/jsnlog/jsnlog.ts", imported by "index.ts".
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
index.ts (1:9)
1: import { JL } from 'jsnlog';
            ^
</code>```

Comment index.ts's line JL().info() line fixed the problem, but I need JL().

Use external/globals in rollup.config.mjs makes rollup happy. But index.html failed with:

Uncaught TypeError: Failed to resolve module specifier "jsnlog". Relative references must start with either "/", "./", or "../".

Body:
I have a reproduce repo JsnLogRollup.

I would like to use JsnLog with ES6 way, take jsnlog.ES6Demo main.js as index.ts:

import {JL} from 'jsnlog';

JL().info("log entry from jsnlog");

With Rollup rollup.config.mjs:

import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';

export default {
  input: 'index.ts',
  output: [
    {
      file: 'index.umd.js',
      format: 'umd',
    },
    {
      file: 'index.es.js',
      format: 'es',
    }
  ],
  plugins: [
    typescript(),
    nodeResolve()
  ]
};

I can't make Rollup/TypeScript/JsnLog work together. Rollup shows:

[!] RollupError: Unexpected token (Note that you need plugins to
import files that are not JavaScript) node_modules/jsnlog/jsnlog.ts
(3:22) 1: /// <reference path="Definitions/jsnlog_interfaces.d.ts"/>
2: 3: import JSNLogAppender = JL.JSNLogAppender
                            ^

Save index.ts unchanged again, rollup produce different error:

[!] RollupError: "JL" is not exported by "node_modules/jsnlog/jsnlog.ts", imported by "index.ts".
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
index.ts (1:9)
1: import { JL } from 'jsnlog';
            ^

Comment index.ts's line JL().info() line fixed the problem, but I need JL().

Use external/globals in rollup.config.mjs makes rollup happy. But index.html failed with:

Uncaught TypeError: Failed to resolve module specifier "jsnlog". Relative references must start with either "/", "./", or "../".


问:
Shows invalid line number in aar
I have an AAR project, and after every release I will be integrating it in to another application, we have enabled proguard for both host application and aar, and we have it working fine.

The problem is when we get any crash report from aar, we are not able to understand the cause and from it happened since the proguard is enabled, this issue happens only for crashes in aar. I have added rules for showing the line number and all but it is showing wrong line number.

Can any one help here ?

Title: Shows invalid line number in aar


问:
Add an argument to application's JVM args
I would like to add an argument that points to a applicationinsights-agent-3.4.7.jar file
the argument being -javaagent:"path/to/applicationinsights-agent-3.4.7.jar. I'm trying to add that in a Build agent VM that runs Ubuntu in Azure DevOps. I'm doing this on an application that already has Java installed and but I can't find a command to find the JVM file or just the location of the file. Any help is appreciated.

I tried installing Tomcat and I thought I could change it from there but I'm automating all those steps and I can't seem to be able to do so.


问:
TDengine 3.0.2.2 create mnode execution stuck
Use docker-compose to deploy the TDengine Swarm cluster, there is no response after the execution of CREATE MNODE ON DNODE dnode_id, the command didn't execute correctly or report an error

Environment：
OS: docker image tdengine/tdengine:3.0.2.2
8G Memory, i5-1135G7, 512G SSD
TDengine Version: 3.0.2.2

Use docker-compose to build a Docker Swarm TDengine cluster

show mnodes and show dnodes are acting normal

There is no response after the execution of CREATE MNODE ON DNODE dnode_id, and there is no exception in the logs

I expect to be able to create mnode normally to achieve high availability of the cluster

Docker compose file:

```<code>version: "3.9"

services:
  td-1:
    build:
      dockerfile: ./docker/tdengine.Dockerfile
      args:
        TAOSD_VER: 3.0.2.2
        TZ: Asia/Shanghai
    image: localhost:5000/kun/tdengine
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-1"
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-2"
    volumes:
      - taosdata-td1:/var/lib/taos/
      - taoslog-td1:/var/log/taos/
    deploy:
      placement:
        constraints:
          - node.hostname==manager
  td-2:
    image: localhost:5000/kun/tdengine
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-2"
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-3"
    volumes:
      - taosdata-td2:/var/lib/taos/
      - taoslog-td2:/var/log/taos/
    deploy:
      placement:
        constraints:
          - node.hostname==server-01
  td-3:
    image: localhost:5000/kun/tdengine
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-3"
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-2"
    volumes:
      - taosdata-td3:/var/lib/taos/
      - taoslog-td3:/var/log/taos/
    deploy:
      placement:
        constraints:
          - node.hostname==server-02

  adapter:
    image: localhost:5000/kun/tdengine
    entrypoint: "taosadapter"
    networks:
      - inter
    environment:
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-2"
    deploy:
      labels:
        caddy_0: localhost:6041
        caddy_0.reverse_proxy: adapter:6041
        caddy_1: localhost:6044
        caddy_1.reverse_proxy: adapter:6044
      mode: global
      placement:
        constraints:
          - node.role == manager

  caddy-docker-proxy:
    build:
      dockerfile: ./docker/caddy-docker-proxy.Dockerfile
    image: localhost:5000/kun/caddy-docker-proxy
    networks:
      - inter
    ports:
      - 6041:6041
      - 6044:6044/udp
      - 80:80
      - 5188:5188
    environment:
      - CADDY_INGRESS_NETWORKS=inter
      - CADDY_DOCKER_CADDYFILE_PATH=/etc/Caddyfile
    volumes:
      - caddy_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == manager

networks:
  inter:
  host:
    external: true
volumes:
  taosdata-td1:
  taoslog-td1:
  taosdata-td2:
  taoslog-td2:
  taosdata-td3:
  taoslog-td3:
  caddy_data:
</code>```

Body:
Use docker-compose to deploy the TDengine Swarm cluster, there is no response after the execution of CREATE MNODE ON DNODE dnode_id, the command didn't execute correctly or report an error

Environment：
OS: docker image tdengine/tdengine:3.0.2.2
8G Memory, i5-1135G7, 512G SSD
TDengine Version: 3.0.2.2

Use docker-compose to build a Docker Swarm TDengine cluster

show mnodes and show dnodes are acting normal

There is no response after the execution of CREATE MNODE ON DNODE dnode_id, and there is no exception in the logs

I expect to be able to create mnode normally to achieve high availability of the cluster

Docker compose file:

version: "3.9"

services:
  td-1:
    build:
      dockerfile: ./docker/tdengine.Dockerfile
      args:
        TAOSD_VER: 3.0.2.2
        TZ: Asia/Shanghai
    image: localhost:5000/kun/tdengine
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-1"
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-2"
    volumes:
      - taosdata-td1:/var/lib/taos/
      - taoslog-td1:/var/log/taos/
    deploy:
      placement:
        constraints:
          - node.hostname==manager
  td-2:
    image: localhost:5000/kun/tdengine
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-2"
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-3"
    volumes:
      - taosdata-td2:/var/lib/taos/
      - taoslog-td2:/var/log/taos/
    deploy:
      placement:
        constraints:
          - node.hostname==server-01
  td-3:
    image: localhost:5000/kun/tdengine
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-3"
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-2"
    volumes:
      - taosdata-td3:/var/lib/taos/
      - taoslog-td3:/var/log/taos/
    deploy:
      placement:
        constraints:
          - node.hostname==server-02

  adapter:
    image: localhost:5000/kun/tdengine
    entrypoint: "taosadapter"
    networks:
      - inter
    environment:
      TAOS_FIRST_EP: "td-1"
      TAOS_SECOND_EP: "td-2"
    deploy:
      labels:
        caddy_0: localhost:6041
        caddy_0.reverse_proxy: adapter:6041
        caddy_1: localhost:6044
        caddy_1.reverse_proxy: adapter:6044
      mode: global
      placement:
        constraints:
          - node.role == manager

  caddy-docker-proxy:
    build:
      dockerfile: ./docker/caddy-docker-proxy.Dockerfile
    image: localhost:5000/kun/caddy-docker-proxy
    networks:
      - inter
    ports:
      - 6041:6041
      - 6044:6044/udp
      - 80:80
      - 5188:5188
    environment:
      - CADDY_INGRESS_NETWORKS=inter
      - CADDY_DOCKER_CADDYFILE_PATH=/etc/Caddyfile
    volumes:
      - caddy_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == manager

networks:
  inter:
  host:
    external: true
volumes:
  taosdata-td1:
  taoslog-td1:
  taosdata-td2:
  taoslog-td2:
  taosdata-td3:
  taoslog-td3:
  caddy_data:


问:
Spring Data Jpa how to select all columns by using CriteriaQuery
In the following code, if I used query.multiselect(generalVecEntityRoot) to query all columns in entity, it throws exception, Unable to locate appropriate constructor as in

org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [general.GeneralVecEntity]. Expected arguments are: general.GeneralVecEntity [select new general.GeneralVecEntity(generatedAlias0) from general.GeneralVecEntity as generatedAlias0 where ( generatedAlias0.groupId in (:param0) ) and ( generatedAlias0.appId=:param1 )]

However, instead, listing columns one by one would work, but code could be tedious and hard to read, so I would like to use Root object to query all columns, but no idea what was wrong. The following are query function and entity definition. Thanks.

```<code>    private List<GeneralVecEntity> findGeneralVecByGroupIdInAndAppIdGroupingByGroupId(String appId, String[] groupIds) {
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<GeneralVecEntity> query = cb.createQuery(GeneralVecEntity.class);

        Root<GeneralVecEntity> generalVecEntityRoot = query.from(GeneralVecEntity.class);

        query.where(generalVecEntityRoot.get("groupId").in(groupIds), cb.equal(generalVecEntityRoot.get("appId"), appId));

        CriteriaQuery<GeneralVecEntity> cq = query.multiselect(generalVecEntityRoot.get("id"),
                generalVecEntityRoot.get("groupId"),
                generalVecEntityRoot.get("appId"),
                generalVecEntityRoot.get("vec"),
                generalVecEntityRoot.get("createTime"));
        return em.createQuery(cq).getResultList();
    }
</code>```
```<code>@Entity
@Getter
@Setter
@ToString
@Table(name = "general_vec")
@AllArgsConstructor
@NoArgsConstructor
public class GeneralVecEntity {
    @Id
    @GeneratedValue
    private Long id;

    private String groupId;

    private String appId;

    @Lob
    @Column(name="vec", columnDefinition="TEXT NOT NULL")
    @Convert(converter= DbConverter.ListToJson.class)
    private float[] vec;

    @Column(name="create_time",columnDefinition="timestamp", updatable = false)
    @CreationTimestamp
    private LocalDateTime createTime;
}
</code>```

Body:
In the following code, if I used query.multiselect(generalVecEntityRoot) to query all columns in entity, it throws exception, Unable to locate appropriate constructor as in

org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [general.GeneralVecEntity]. Expected arguments are: general.GeneralVecEntity [select new general.GeneralVecEntity(generatedAlias0) from general.GeneralVecEntity as generatedAlias0 where ( generatedAlias0.groupId in (:param0) ) and ( generatedAlias0.appId=:param1 )]

However, instead, listing columns one by one would work, but code could be tedious and hard to read, so I would like to use Root object to query all columns, but no idea what was wrong. The following are query function and entity definition. Thanks.

    private List<GeneralVecEntity> findGeneralVecByGroupIdInAndAppIdGroupingByGroupId(String appId, String[] groupIds) {
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<GeneralVecEntity> query = cb.createQuery(GeneralVecEntity.class);

        Root<GeneralVecEntity> generalVecEntityRoot = query.from(GeneralVecEntity.class);

        query.where(generalVecEntityRoot.get("groupId").in(groupIds), cb.equal(generalVecEntityRoot.get("appId"), appId));

        CriteriaQuery<GeneralVecEntity> cq = query.multiselect(generalVecEntityRoot.get("id"),
                generalVecEntityRoot.get("groupId"),
                generalVecEntityRoot.get("appId"),
                generalVecEntityRoot.get("vec"),
                generalVecEntityRoot.get("createTime"));
        return em.createQuery(cq).getResultList();
    }

@Entity
@Getter
@Setter
@ToString
@Table(name = "general_vec")
@AllArgsConstructor
@NoArgsConstructor
public class GeneralVecEntity {
    @Id
    @GeneratedValue
    private Long id;

    private String groupId;

    private String appId;

    @Lob
    @Column(name="vec", columnDefinition="TEXT NOT NULL")
    @Convert(converter= DbConverter.ListToJson.class)
    private float[] vec;

    @Column(name="create_time",columnDefinition="timestamp", updatable = false)
    @CreationTimestamp
    private LocalDateTime createTime;
}


问:
python kivyMD dialog forgot password not showing text input field
trying to click Forgot password button which brings up an alert box, where the user can input their email address

i can get the popup to happen when hitting the forgot password button
it displays only a submit button down the bottom
no text input
what am i doing wrong?
[enter image description here][1]

.py file

```<code>kv = '''
<PasswordResetDialog>:
    orientation: "vertical"

    MDTextField:
        id: email_address
        hint_text:enter email

'''
</code>```
```<code>class PasswordResetDialog(MDDialog):
    pass

    def PasswordResetDialog(self):
        self.dialog = PasswordResetDialog(
            content_cls=PasswordResetDialog(),
            buttons=[
                MDFlatButton(
                    text="SUBMIT",
                    on_release=neat_dialog()
                ),
            ],
        )

        def neat_dialog(self, obj):
            self.dialog.dismiss()
            email = self.dialog.ids.email.text
            forgot = auth.send_password_reset_email(email_address)

        self.dialog.open()

</code>```

.kv file with the forgot password button

```<code>MDTextButton:
            text: "Forgot Password?"
            on_release:app.PasswordResetDialog()```

  [1]: https://i.stack.imgur.com/rqCog.png
```

Body:
trying to click Forgot password button which brings up an alert box, where the user can input their email address

i can get the popup to happen when hitting the forgot password button
it displays only a submit button down the bottom
no text input
what am i doing wrong?
[enter image description here][1]

.py file

kv = '''
<PasswordResetDialog>:
    orientation: "vertical"

    MDTextField:
        id: email_address
        hint_text:enter email

'''

class PasswordResetDialog(MDDialog):
    pass

    def PasswordResetDialog(self):
        self.dialog = PasswordResetDialog(
            content_cls=PasswordResetDialog(),
            buttons=[
                MDFlatButton(
                    text="SUBMIT",
                    on_release=neat_dialog()
                ),
            ],
        )

        def neat_dialog(self, obj):
            self.dialog.dismiss()
            email = self.dialog.ids.email.text
            forgot = auth.send_password_reset_email(email_address)

        self.dialog.open()

.kv file with the forgot password button

MDTextButton:
            text: "Forgot Password?"
            on_release:app.PasswordResetDialog()```

  [1]: https://i.stack.imgur.com/rqCog.png


问:
Packaging a java application to .jar or .exe
I am working on a JavaFX project. There is a 'settings' module that saves the user's input into a txt file and reads it every time the app launches. But I find that I can't read it after I packaged it into .jar file, so I changed the reading func to 'Inputstream':

```<code>    //File myFile = new File(fileName);
    InputStream myFile = FileIO.class.getClassLoader().getResourceAsStream(fileName);
    Scanner scanner = new Scanner(myFile);
</code>```

and I can't write in the txt as well.

I thought I should put the txt outside the .jar file, but then how can I package it to a .exe file?

I am expecting that by some means I can implement my function and get an .exe file

Body:
I am working on a JavaFX project. There is a 'settings' module that saves the user's input into a txt file and reads it every time the app launches. But I find that I can't read it after I packaged it into .jar file, so I changed the reading func to 'Inputstream':

    //File myFile = new File(fileName);
    InputStream myFile = FileIO.class.getClassLoader().getResourceAsStream(fileName);
    Scanner scanner = new Scanner(myFile);

and I can't write in the txt as well.

I thought I should put the txt outside the .jar file, but then how can I package it to a .exe file?

I am expecting that by some means I can implement my function and get an .exe file


问:
Flutter get device uptime
I'm building a flutter application, which needs some sort of session expiry system which will log out the user from the account. Problem is, I need it to be offline compatible. One of the solutions I've found is using device's uptime, basically I want to store when was the last time user connected to the internet, save the timestamp. And when the user opens the app while offline, calculate the difference between current timestamp, and the stored timestamp. If it has exceeded the given limit, the user will be logged out. I tried using DateTime.now() for this, however, it seems like DateTime.now() is affected by the user's device time, meaning that the user can possibly exploit the system by changing his device's date and time. Which is why I came to device's uptime, however I haven't found any methods/ways/packages to get the device's uptime (which won't be affected by changes in device's date and time). Are there any ways I could do this? Any help would be greatly appreciated!</p>

Title: Flutter get device uptime


问:
'command not found: next'
I installed Next.js manually and created it using the command npm install next react react-dom

Followed that up with the creation of pages directory, and an index.js file with the function HomePage() { return stuff } export default HomePage

I added the script commands recommended on the next docs to my package.json. Ironically i was able to run npm start one time and that ran the build commands which created a .next folder with static, server, and other files etc... I can see a static/chunks/pages/_app.j file but whenever i'm in the terminal now... a day later... npm start shoots me an error saying

Error: Could not find a production build in the '/Users/clm/src/personal/transportation-solutions/.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id

I have tried to use the commands next build as well as next start and next dev all of which are inside of my package.json file but none of them work.

Has anyone ran into this problem before? I would appreciate some insight as to why i was able to boot up my application yesterday but not today.

Title: 'command not found: next'


问:
How to set and change duty cycles for PWM code
I am trying to blink the yellow and green LEDs on my CC32xx board. To do that I need to edit some code that was presented to me. I need to set duty for PWM1 to 90%, set duty for PWM2 to 10%, set the sleep(1) function so it sleeps for 1 second, set duty for PWM1 to 0%, set duty for PWM2 to 90%, and create my code in a loop.

So far, I have set PWM1 to 90% of the period and PWM2 to 10% of the period. And changed the value of variable time to 1000000 ms, which is 1 second. How do you change value of PWM1 to 0% and PWM2 to 90% of period after the sleep function executes? Here is my code:

```<code>/*
 *  ======== pwmled2.c ========
 */
/* For usleep() */
#include <unistd.h>
#include <stddef.h>

/* Driver Header files */
#include <ti/drivers/PWM.h>

/* Driver configuration */
#include "ti_drivers_config.h"

/*
 *  ======== mainThread ========
 *  Task periodically increments the PWM duty for the on board LED.
 */
void *mainThread(void *arg0)
{
    /* Period and duty in microseconds */
    uint16_t   pwmPeriod = 3000;
    uint16_t   duty = 0;
    uint16_t   dutyInc = 100;

    /* Sleep time in microseconds */
    uint32_t   time = 1000000;
    PWM_Handle pwm1 = NULL;
    PWM_Handle pwm2 = NULL;
    PWM_Params params;

    /* Call driver init functions. */
    PWM_init();

    PWM_Params_init(&params);
    params.dutyUnits = PWM_DUTY_US;
    params.dutyValue = 0;
    params.periodUnits = PWM_PERIOD_US;
    params.periodValue = pwmPeriod;
    pwm1 = PWM_open(CONFIG_PWM_0, &params);
    if (pwm1 == NULL) {
        /* CONFIG_PWM_0 did not open */
        while (1);
    }

    PWM_start(pwm1);

    pwm2 = PWM_open(CONFIG_PWM_1, &params);
    if (pwm2 == NULL) {
        /* CONFIG_PWM_0 did not open */
        while (1);
    }

    PWM_start(pwm2);

    /* Loop forever incrementing the PWM duty */
    while (1) {
        PWM_setDuty(pwm1, 2700);

        PWM_setDuty(pwm2, 300);

        duty = (duty + dutyInc);

        if (duty == pwmPeriod || (!duty)) {
            dutyInc = - dutyInc;
        }

        usleep(time);
    }
}
</code>```

Body:
I am trying to blink the yellow and green LEDs on my CC32xx board. To do that I need to edit some code that was presented to me. I need to set duty for PWM1 to 90%, set duty for PWM2 to 10%, set the sleep(1) function so it sleeps for 1 second, set duty for PWM1 to 0%, set duty for PWM2 to 90%, and create my code in a loop.

So far, I have set PWM1 to 90% of the period and PWM2 to 10% of the period. And changed the value of variable time to 1000000 ms, which is 1 second. How do you change value of PWM1 to 0% and PWM2 to 90% of period after the sleep function executes? Here is my code:

/*
 *  ======== pwmled2.c ========
 */
/* For usleep() */
#include <unistd.h>
#include <stddef.h>

/* Driver Header files */
#include <ti/drivers/PWM.h>

/* Driver configuration */
#include "ti_drivers_config.h"

/*
 *  ======== mainThread ========
 *  Task periodically increments the PWM duty for the on board LED.
 */
void *mainThread(void *arg0)
{
    /* Period and duty in microseconds */
    uint16_t   pwmPeriod = 3000;
    uint16_t   duty = 0;
    uint16_t   dutyInc = 100;

    /* Sleep time in microseconds */
    uint32_t   time = 1000000;
    PWM_Handle pwm1 = NULL;
    PWM_Handle pwm2 = NULL;
    PWM_Params params;

    /* Call driver init functions. */
    PWM_init();

    PWM_Params_init(&params);
    params.dutyUnits = PWM_DUTY_US;
    params.dutyValue = 0;
    params.periodUnits = PWM_PERIOD_US;
    params.periodValue = pwmPeriod;
    pwm1 = PWM_open(CONFIG_PWM_0, &params);
    if (pwm1 == NULL) {
        /* CONFIG_PWM_0 did not open */
        while (1);
    }

    PWM_start(pwm1);

    pwm2 = PWM_open(CONFIG_PWM_1, &params);
    if (pwm2 == NULL) {
        /* CONFIG_PWM_0 did not open */
        while (1);
    }

    PWM_start(pwm2);

    /* Loop forever incrementing the PWM duty */
    while (1) {
        PWM_setDuty(pwm1, 2700);

        PWM_setDuty(pwm2, 300);

        duty = (duty + dutyInc);

        if (duty == pwmPeriod || (!duty)) {
            dutyInc = - dutyInc;
        }

        usleep(time);
    }
}


问:
Python bar graph problems
I'm trying to create a bar graph in python based off number of individuals in certain zip codes.
I have about 120 zip codes, with my highest number of individuals being under 200.
I can't seem to find a code online that is working -- keep getting
"ValueError: shape mismatch: objects cannot be broadcast to a single shape"

I don't know if I'm inserting too much data at once, but I need all 120 data enteries on the X axis on one bar graph. If I try to do it with only 3 enteries, it works.

Help..

tried all the online codes I can find

Title: Python bar graph problems


问:
AtomicInteger : Thread safe unconditional increment/decrement counter (atomically incremented/decremented from multiple threads)
Looking at the Java 11 source code for AtomicInteger & Unsafe, I concluded that if one only wants a thread safe unconditional increment/decrement counter (just atomically incremented/decremented unconditionally from multiple threads) one can just use the AtomicInteger's unconditional increment/decrement methods (like AtomicInteger#incrementAndGet() or AtomicInteger#decrementAndGet() or the related variants) out of the box to achieve that.

This since they already ensure that the call to the increment/decrement methods always increases/decreases the value by 1 atomically even when invoked from multiple threads without any race condition issues (getAndAddInt code in Unsafe clearly retries weakCompareAndSetInt() until it succeeds for an increment by 1).

If this is the case, isn't the below statement incorrect/needless in this Baeldung post on atomic variables? Why does one need to code this increment() method for it to be a thread safe counter, why can't one just use the methods I noted above?

Or am I missing or misunderstanding something?

```<code>A thread-safe counter implemented with AtomicInteger is shown in the example below:

public class SafeCounterWithoutLock {
    private final AtomicInteger counter = new AtomicInteger(0);

    public int getValue() {
        return counter.get();
    }
    public void increment() {
        while(true) {
            int existingValue = getValue();
            int newValue = existingValue + 1;
            if(counter.compareAndSet(existingValue, newValue)) {
                return;
            }
        }
    }
}
</code>```

Thanks

Body:
Looking at the Java 11 source code for AtomicInteger & Unsafe, I concluded that if one only wants a thread safe unconditional increment/decrement counter (just atomically incremented/decremented unconditionally from multiple threads) one can just use the AtomicInteger's unconditional increment/decrement methods (like AtomicInteger#incrementAndGet() or AtomicInteger#decrementAndGet() or the related variants) out of the box to achieve that.

This since they already ensure that the call to the increment/decrement methods always increases/decreases the value by 1 atomically even when invoked from multiple threads without any race condition issues (getAndAddInt code in Unsafe clearly retries weakCompareAndSetInt() until it succeeds for an increment by 1).

If this is the case, isn't the below statement incorrect/needless in this Baeldung post on atomic variables? Why does one need to code this increment() method for it to be a thread safe counter, why can't one just use the methods I noted above?

Or am I missing or misunderstanding something?

A thread-safe counter implemented with AtomicInteger is shown in the example below:

public class SafeCounterWithoutLock {
    private final AtomicInteger counter = new AtomicInteger(0);

    public int getValue() {
        return counter.get();
    }
    public void increment() {
        while(true) {
            int existingValue = getValue();
            int newValue = existingValue + 1;
            if(counter.compareAndSet(existingValue, newValue)) {
                return;
            }
        }
    }
}

Thanks


问:
Want to know the package name of app clicked from android sharesheet
I want to know the package name of app clicked from android sharsheet. Developer.android.com says to use a pending with Intent.createchooser. And we can get package name in onReceive method of broadcast receiver that we use in pending Intent.
My Main Activity only has a button that starts a sharing intent and opens android sharesheet.

```<code>package com.upstox.android.shubhampoc

import android.app.PendingIntent
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.upstox.android.shubhampoc.databinding.ActivityMainBinding
import com.upstox.android.shubhampoc.share.SharingNotificationReceiver

class MainActivity : AppCompatActivity() {

    private var _binding: ActivityMainBinding? = null
    private val binding get() = checkNotNull(_binding)

    private val sharingNotificationReceiver = SharingNotificationReceiver()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        setClickListeners()
    }

    override fun onStart() {
        super.onStart()
        registerReceiver(sharingNotificationReceiver, IntentFilter())
    }

    override fun onStop() {
        super.onStop()
        unregisterReceiver(sharingNotificationReceiver)
    }

    private fun setClickListeners() {
        binding.btnShare.setOnClickListener {
            val sendIntent: Intent = Intent().apply {
                action = Intent.ACTION_SEND
                putExtra(Intent.EXTRA_TEXT, "Sharing from a POC App")
                type = "text/plain"
            }
            val receiveIntent = Intent(applicationContext, SharingNotificationReceiver::class.java)
            receiveIntent.putExtra("check", "value received")

            val pendingIntent = PendingIntent.getBroadcast(
                applicationContext,
                25,
                receiveIntent,
                PendingIntent.FLAG_IMMUTABLE
            )

            val shareIntent =
                Intent.createChooser(sendIntent, "Share Text", pendingIntent.intentSender)
            startActivity(shareIntent)
        }
    }
}
</code>```

Here is my Broadcast receiver.

```<code>package com.upstox.android.shubhampoc.share

import android.content.BroadcastReceiver
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.Intent.EXTRA_CHOSEN_COMPONENT

class SharingNotificationReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context?, intent: Intent?) {
        val clickedComponent : ComponentName? = intent?.getParcelableExtra(EXTRA_CHOSEN_COMPONENT);
        println("shubhamnoti intent : $clickedComponent")
        println("shubhamnoti intent : ${intent?.getStringExtra("check")}")
    }
}

</code>```

And my android.manifest file

```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.upstox.android.shubhampoc">

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.ShubhamPOC"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:theme="@style/Theme.ShubhamPOC.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver
            android:name=".share.SharingNotificationReceiver"
            android:exported="false">
        </receiver>
    </application>
</manifest>
</code>```

The problem I am facing is I am getting Intent.extras as null in broadcast receiver. Is there a way to get the clicked app component name from android sharesheet.

I am expecting the component name of app clicked from android sharesheet. But Intent.extras is null in broadcast receiver and if i pass a custom extra just for checking then intent.extras has only that custom extra in it.

To be precise i am expecting override fun onReceive(context: Context, intent: Intent) { ... val clickedComponent : ComponentName = intent.getParcelableExtra(EXTRA_CHOSEN_COMPONENT); }
as mentioned in android documentation.

Body:
I want to know the package name of app clicked from android sharsheet. Developer.android.com says to use a pending with Intent.createchooser. And we can get package name in onReceive method of broadcast receiver that we use in pending Intent.
My Main Activity only has a button that starts a sharing intent and opens android sharesheet.

package com.upstox.android.shubhampoc

import android.app.PendingIntent
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.upstox.android.shubhampoc.databinding.ActivityMainBinding
import com.upstox.android.shubhampoc.share.SharingNotificationReceiver

class MainActivity : AppCompatActivity() {

    private var _binding: ActivityMainBinding? = null
    private val binding get() = checkNotNull(_binding)

    private val sharingNotificationReceiver = SharingNotificationReceiver()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        setClickListeners()
    }

    override fun onStart() {
        super.onStart()
        registerReceiver(sharingNotificationReceiver, IntentFilter())
    }

    override fun onStop() {
        super.onStop()
        unregisterReceiver(sharingNotificationReceiver)
    }

    private fun setClickListeners() {
        binding.btnShare.setOnClickListener {
            val sendIntent: Intent = Intent().apply {
                action = Intent.ACTION_SEND
                putExtra(Intent.EXTRA_TEXT, "Sharing from a POC App")
                type = "text/plain"
            }
            val receiveIntent = Intent(applicationContext, SharingNotificationReceiver::class.java)
            receiveIntent.putExtra("check", "value received")

            val pendingIntent = PendingIntent.getBroadcast(
                applicationContext,
                25,
                receiveIntent,
                PendingIntent.FLAG_IMMUTABLE
            )

            val shareIntent =
                Intent.createChooser(sendIntent, "Share Text", pendingIntent.intentSender)
            startActivity(shareIntent)
        }
    }
}

Here is my Broadcast receiver.

package com.upstox.android.shubhampoc.share

import android.content.BroadcastReceiver
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.Intent.EXTRA_CHOSEN_COMPONENT

class SharingNotificationReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context?, intent: Intent?) {
        val clickedComponent : ComponentName? = intent?.getParcelableExtra(EXTRA_CHOSEN_COMPONENT);
        println("shubhamnoti intent : $clickedComponent")
        println("shubhamnoti intent : ${intent?.getStringExtra("check")}")
    }
}

And my android.manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.upstox.android.shubhampoc">

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.ShubhamPOC"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:theme="@style/Theme.ShubhamPOC.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver
            android:name=".share.SharingNotificationReceiver"
            android:exported="false">
        </receiver>
    </application>
</manifest>

The problem I am facing is I am getting Intent.extras as null in broadcast receiver. Is there a way to get the clicked app component name from android sharesheet.

I am expecting the component name of app clicked from android sharesheet. But Intent.extras is null in broadcast receiver and if i pass a custom extra just for checking then intent.extras has only that custom extra in it.

To be precise i am expecting override fun onReceive(context: Context, intent: Intent) { ... val clickedComponent : ComponentName = intent.getParcelableExtra(EXTRA_CHOSEN_COMPONENT); }
as mentioned in android documentation.


问:
Problem with Ruby Sequel retrieval of datetimes with daylights saving time
The Ruby Sequel gem allows retrieval of datetimes with either no timezone conversion, conversion to local timezone or conversion to timezone.   In all three cases we get unusable results at the conversion to daylights savings in a situation where timezone settings on the windows client OS clashes with timezone set in Ruby.  For example:

```<code>require 'sequel'
require_relative './ojdbc8.jar'

username = 'username'
password = 'password'
host = 'host'
port = 1521
sid = 'ORCL'

connection_string = "jdbc:oracle:thin:#{username}/#{password}@#{host}:#{port}:#{sid}"
puts "connection_string: #{connection_string}"
ENV['TZ'] = 'Etc/GMT-10'
# ENV['TZ'] = '+10:00'

db = Sequel.connect(connection_string)
db.drop_table :d
db.create_table :d do
    primary_key :id
    DateTime :DATETIME, unique: true, null: false
    Integer :HOUR, null: false
end

# Using Time with TZ set to GMT+10
d = db[:d]
(1..4).each do|hour|
    t = Time.new(2022, 10, 2, hour, 0, 0)
    puts "time: #{t}"
    d.insert(DATETIME: t, HOUR: hour)
end

sql = "SELECT * FROM d"

Sequel.default_timezone = :utc
dataset = db[sql]
puts "UTC timezone"
dataset.each do |row|
    puts "row: #{row}"
end

Sequel.default_timezone = :local
dataset = db[sql]
puts "Local timezone..."
dataset.each do |row|
    puts "row: #{row}"
end

Sequel.default_timezone = nil
dataset = db[sql]
puts "nil timezone (no conversion)..."
dataset.each do |row|
    puts "row: #{row}"
end
</code>```

Running the above with Windows Timezone of (UTC+10) Canberra, Melbourne, Sydney and Adjust for Daylights Savings set to true will result in the below:

```<code>time: 2022-10-02 01:00:00 +1000
time: 2022-10-02 02:00:00 +1000
time: 2022-10-02 03:00:00 +1000
time: 2022-10-02 04:00:00 +1000
UTC timezone
row: {:id=>1, :datetime=>2022-10-02 01:00:00 UTC, :hour=>1}
row: {:id=>2, :datetime=>2022-10-02 03:00:00 UTC, :hour=>2}
row: {:id=>3, :datetime=>2022-10-02 03:00:00 UTC, :hour=>3}
row: {:id=>4, :datetime=>2022-10-02 04:00:00 UTC, :hour=>4}
Local timezone...
row: {:id=>1, :datetime=>2022-10-02 01:00:00 +1000, :hour=>1}
row: {:id=>2, :datetime=>2022-10-02 03:00:00 +1000, :hour=>2}
row: {:id=>3, :datetime=>2022-10-02 03:00:00 +1000, :hour=>3}
row: {:id=>4, :datetime=>2022-10-02 04:00:00 +1000, :hour=>4}
nil timezone (no conversion)...
row: {:id=>1, :datetime=>2022-10-02 01:00:00 +1000, :hour=>1}
row: {:id=>2, :datetime=>2022-10-02 03:00:00 +1000, :hour=>2}
row: {:id=>3, :datetime=>2022-10-02 03:00:00 +1000, :hour=>3}
row: {:id=>4, :datetime=>2022-10-02 04:00:00 +1000, :hour=>4}
</code>```

Note that in all cases, the Time object returned for hours 2 and 3 is the same.  Hour 2 is incorrect.   Given that the TZ environment variable is set explicitly in the code, it would be desirable if the :local option for Sequel.default_timezone = :local used that TZ timezone instead using other information from windows.  Note that if TZ variable is set to something not nil then Time on its own will honour that setting, over-riding the Windows setting.

The actual DATETIME column in the database has no timezone information.

I have also tried various options using the named_timezones extension but have the same problem as above.  This has included using the DateTime class rather than the Time class.

The only solution that we have found has been to use a TO_CHAR() function around the DATETIME column to cast it to a string.

Has anyone else solved this problem?

The above problem occurs when using JRuby 9.4.0.0 and a JDBC connection to Oracle.   I have used very similar code with MRI and SQLite and the problem as described does not occur.   With MRI, default_timezone = nil or :utc works fine and sort of works if :local and named_timezone works fine with both Datetime and Time classes.

Body:
The Ruby Sequel gem allows retrieval of datetimes with either no timezone conversion, conversion to local timezone or conversion to timezone.   In all three cases we get unusable results at the conversion to daylights savings in a situation where timezone settings on the windows client OS clashes with timezone set in Ruby.  For example:

require 'sequel'
require_relative './ojdbc8.jar'

username = 'username'
password = 'password'
host = 'host'
port = 1521
sid = 'ORCL'

connection_string = "jdbc:oracle:thin:#{username}/#{password}@#{host}:#{port}:#{sid}"
puts "connection_string: #{connection_string}"
ENV['TZ'] = 'Etc/GMT-10'
# ENV['TZ'] = '+10:00'

db = Sequel.connect(connection_string)
db.drop_table :d
db.create_table :d do
    primary_key :id
    DateTime :DATETIME, unique: true, null: false
    Integer :HOUR, null: false
end

# Using Time with TZ set to GMT+10
d = db[:d]
(1..4).each do|hour|
    t = Time.new(2022, 10, 2, hour, 0, 0)
    puts "time: #{t}"
    d.insert(DATETIME: t, HOUR: hour)
end

sql = "SELECT * FROM d"

Sequel.default_timezone = :utc
dataset = db[sql]
puts "UTC timezone"
dataset.each do |row|
    puts "row: #{row}"
end

Sequel.default_timezone = :local
dataset = db[sql]
puts "Local timezone..."
dataset.each do |row|
    puts "row: #{row}"
end

Sequel.default_timezone = nil
dataset = db[sql]
puts "nil timezone (no conversion)..."
dataset.each do |row|
    puts "row: #{row}"
end

Running the above with Windows Timezone of (UTC+10) Canberra, Melbourne, Sydney and Adjust for Daylights Savings set to true will result in the below:

time: 2022-10-02 01:00:00 +1000
time: 2022-10-02 02:00:00 +1000
time: 2022-10-02 03:00:00 +1000
time: 2022-10-02 04:00:00 +1000
UTC timezone
row: {:id=>1, :datetime=>2022-10-02 01:00:00 UTC, :hour=>1}
row: {:id=>2, :datetime=>2022-10-02 03:00:00 UTC, :hour=>2}
row: {:id=>3, :datetime=>2022-10-02 03:00:00 UTC, :hour=>3}
row: {:id=>4, :datetime=>2022-10-02 04:00:00 UTC, :hour=>4}
Local timezone...
row: {:id=>1, :datetime=>2022-10-02 01:00:00 +1000, :hour=>1}
row: {:id=>2, :datetime=>2022-10-02 03:00:00 +1000, :hour=>2}
row: {:id=>3, :datetime=>2022-10-02 03:00:00 +1000, :hour=>3}
row: {:id=>4, :datetime=>2022-10-02 04:00:00 +1000, :hour=>4}
nil timezone (no conversion)...
row: {:id=>1, :datetime=>2022-10-02 01:00:00 +1000, :hour=>1}
row: {:id=>2, :datetime=>2022-10-02 03:00:00 +1000, :hour=>2}
row: {:id=>3, :datetime=>2022-10-02 03:00:00 +1000, :hour=>3}
row: {:id=>4, :datetime=>2022-10-02 04:00:00 +1000, :hour=>4}

Note that in all cases, the Time object returned for hours 2 and 3 is the same.  Hour 2 is incorrect.   Given that the TZ environment variable is set explicitly in the code, it would be desirable if the :local option for Sequel.default_timezone = :local used that TZ timezone instead using other information from windows.  Note that if TZ variable is set to something not nil then Time on its own will honour that setting, over-riding the Windows setting.

The actual DATETIME column in the database has no timezone information.

I have also tried various options using the named_timezones extension but have the same problem as above.  This has included using the DateTime class rather than the Time class.

The only solution that we have found has been to use a TO_CHAR() function around the DATETIME column to cast it to a string.

Has anyone else solved this problem?

The above problem occurs when using JRuby 9.4.0.0 and a JDBC connection to Oracle.   I have used very similar code with MRI and SQLite and the problem as described does not occur.   With MRI, default_timezone = nil or :utc works fine and sort of works if :local and named_timezone works fine with both Datetime and Time classes.


问:
Why aren't the correct elements showing up given the correct date
I am working on a booking system where I add the times for a certain day to the database. In the code below you can see that the times are generated based on if its a weekend or a weekday. But when it gets added to the database, for some reason, it shifts backward one day. For example for Saturday, it produces Friday times and for Monday, it produces Sunday times. When I console.log(times) on line:149 and when I console.log(qSnap.docs[0].data().times) line:166 I get: .

Here is what my database looks like:
.

Why is it doing this?

```<code>function SThrityminP() {
  const style = {
    position: "absolute",
    top: "50%",
    left: "50%",
    transform: "translate(-50%, -50%)",
    width: 400,
    bgcolor: "background.paper",
    border: "2px solid #000",
    boxShadow: 24,
    p: 4,
  };

  // Form values
  const [date, setDate] = useState(null);
  const [email, setEmail] = useState("");
  const [name, setName] = useState("");
  const [age, setAge] = useState("");
  const [team, setTeam] = useState("");
  const [number, setNumber] = useState("");
  const [time, setTime] = useState("");
  const [open, setOpen] = useState(false);
  const [error, setError] = useState(false);

  const handleErrOpen = () => setError(true);
  const handleErrClose = () => setError(false);
  const handleOpen = () => setOpen(true);
  const handleClose = () => setOpen(false);

  // To show times on screen
  const [times, setTimes] = useState([]);

  const timesRef = collection(db, "30min-shooting-private-times");
  const formRef = collection(db, "30min-shooting-private");

  const createBooking = async () => {
    await addDoc(formRef, {
      name: name,
      date: date,
      email: email,
      number: number,
      team: team,
      age: age,
      time: time,
    });
  };

  const addTimesForNextThreeWeeks = async () => {
    // Get current date
    let currentDate = new Date();

    // Set times to generate for weekdays
    let times = [];

    // Check if current day is Monday
    if (create) {
      // Generate times for next three weeks
      for (let i = 0; i < 180; i++) {
        currentDate.setDate(currentDate.getDate() + 1);

        // Format date as string
        const formattedDate = currentDate.toISOString().slice(0, 10);

        // Check if current date is a Saturday or Sunday
        if (currentDate.getDay() === 0 || currentDate.getDay() === 6) {
          // Set times to generate for Saturdays and Sundays
          times = [
            "Select a Time",
            "7:00am",
            "7:30am",
            "8:00am",
            "8:30am",
            "9:00am",
            "9:30am",
            "1:00pm",
            "1:30pm",
            "2:00pm",
            "2:30pm",
            "3:00pm",
            "3:30pm",
            "4:00pm",
            "4:30pm",
            "5:00pm",
            "5:30pm",
            "6:00pm",
            "6:30pm",
            "7:00pm",
            "7:30pm",
            "8:00pm",
            "8:30pm",
          ];
        } else {
          // Set times to generate for weekdays
          times = [
            "Select a Time",
            "7:00am",
            "7:30am",
            "8:00am",
            "8:30am",
            "9:00am",
            "9:30am",
            "10:00am",
            "10:30am",
            "11:00am",
            "11:30am",
            "12:00pm",
            "12:30pm",
            "1:00pm",
            "1:30pm",
            "2:00pm",
            "2:30pm",
            "3:00pm",
            "3:30pm",
            "4:00pm",
            "4:30pm",
            "8:00pm",
            "8:30pm",
          ];
        }

        // Add the times for this date to the database
        await addDoc(timesRef, {
          date: formattedDate,
          times: times,
        });
      }
    }
  };

  console.log(times);

  const handleDateChange = async (selectedDate) => {
    setDate(selectedDate);
    if (selectedDate) {
      console.log(
        "Fetching data for date: ",
        selectedDate.toISOString().slice(0, 10)
      );

      const timeQuery = query(
        timesRef,
        where("date", "==", selectedDate.toISOString().slice(0, 10))
      );

      const qSnap = await getDocs(timeQuery);
      console.log(qSnap.docs[0].data().times);
      setTimes(qSnap.docs[0].data().times);
    }
  };

  const countFunction = async () => {
    const countSnap = getCountFromServer(timesRef);
    console.log((await countSnap).data().count);

    if ((await countSnap).data().count < 180) {
      addTimesForNextThreeWeeks();
    }
  };

  useEffect(() => {
    countFunction();
  }, []);

  const handleSubmit = async (e) => {
    e.preventDefault();

    if (
      name === "" ||
      email === "" ||
      date === null ||
      time === "" ||
      time === "Select a Time" ||
      age === "" ||
      team === "" ||
      number === ""
    ) {
      handleErrOpen();
    } else {
      handleOpen();
      createBooking();

      const readableDate = date.toLocaleDateString("en-US", {
        month: "long",
        day: "numeric",
        year: "numeric",
      });

      const service = "30min shooting clinic - private";

      const res = await fetch("/bookings", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          name,
          email,
          number,
          team,
          age,
          readableDate,
          time,
          service,
        }),
      });

      console.log(res);

      setName("");
      setEmail("");
      setDate(null);
      setNumber("");
      setTeam("");
      setTime("");
      setAge("");
    }

    const timeQuery = query(
      timesRef,
      where("date", "==", date.toISOString().slice(0, 10))
    );
    const qSnap = await getDocs(timeQuery);

    // Get the document ID and times array
    qSnap.forEach((doc) => {
      console.log("id: ", doc.id, "data: ", doc.data());
    });

    console.log(times);
    let updatedTimes = times.filter((t) => t !== time);
    if (times.length === 1) {
      updatedTimes = [];
    }
    console.log(updatedTimes);

    if (qSnap.size > 0) {
      const docId = qSnap.docs[0].id;
      const docRef = doc(timesRef, docId);
      await updateDoc(docRef, {
        times: updatedTimes,
      });
    }

    handleDateChange(date);
  };

  return (
    <div>
      <h1 class="text-3xl w-full text-center pt-10 font-bold">
        Book 30min Private Shooting Clinic
      </h1>
      <div class="flex flex-col items-center">
        <form onSubmit={handleSubmit} class="flex flex-col pt-10 w-3/4">
          <input
            type="text"
            name="name"
            placeholder="Name"
            value={name}
            onChange={(e) => setName(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="email"
            placeholder="Email"
            value={email}
            onChange={(e) => setEmail(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="number"
            placeholder="Phone Number"
            value={number}
            onChange={(e) => setNumber(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="team"
            placeholder="Team Name"
            value={team}
            onChange={(e) => setTeam(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="age"
            placeholder="Age"
            value={age}
            onChange={(e) => setAge(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <h2 class="text-center text-xl py-5 font-bold">
            Pick a Date and Time
          </h2>
          <p class="text-sm pb-5 text-center font-light">
            Please note that we only allow bookings up to 3 weeks in advance.
            Please choose a date within the next 3 weeks.
          </p>
          <p class="text-sm pb-7 text-center font-light">
            If there are no time slots available please select another date or
            try refreshing the page.
          </p>
          <p class="text-sm pb-7 text-center font-semibold">
            The available times for our Shooting Clinics are Mon-Fri: 7am-5pm,
            8-9pm and Sat-Sun: 7am-10am, 1-9pm.
          </p>
          <div class="pb-10">
            <DatePicker
              className="border-2 p-3 w-full border-gray rounded-lg"
              selected={date}
              onChange={handleDateChange}
              placeholderText="Select a Date"
            />
            <div class="pt-10">
              <select
                value={time}
                onChange={(e) => setTime(e.target.value)}
                placeholder="Text"
                className="border-2 p-3 mb-5 border-gray rounded-lg w-full"
              >
                {times.map((time) => (
                  <option key={time} value={time}>
                    {time}
                  </option>
                ))}
              </select>
            </div>
          </div>

          <button
            type="submit"
            class="bg-accent text-white font-semibold p-3 rounded-full"
          >
            Submit
          </button>
        </form>
        <Modal
          open={open}
          onClose={handleClose}
          aria-labelledby="modal-modal-title"
          aria-describedby="modal-modal-description"
        >
          <Box sx={style}>
            <Typography id="modal-modal-title" variant="h6" component="h2">
              Thanks For Booking!
            </Typography>
            <Typography id="modal-modal-description" sx={{ mt: 2, py: 3 }}>
              Please check your email for booking conformation.
            </Typography>
            <button
              onClick={handleClose}
              class="bg-blue text-white text-sm font-normal p-3 rounded-full w-full"
            >
              Close
            </button>
          </Box>
        </Modal>
        <Modal
          open={error}
          onClose={handleErrClose}
          aria-labelledby="modal-modal-title"
          aria-describedby="modal-modal-description"
        >
          <Box sx={style}>
            <Typography id="modal-modal-title" variant="h6" component="h2">
              Uh Oh!
            </Typography>
            <Typography id="modal-modal-description" sx={{ mt: 2, py: 3 }}>
              Please make sure all fields are filled in.
            </Typography>
            <button
              onClick={handleErrClose}
              class="bg-blue text-white text-sm font-normal p-3 rounded-full w-full"
            >
              Close
            </button>
          </Box>
        </Modal>
      </div>
    </div>
  );
}

export default SThrityminP;
</code>```

Body:
I am working on a booking system where I add the times for a certain day to the database. In the code below you can see that the times are generated based on if its a weekend or a weekday. But when it gets added to the database, for some reason, it shifts backward one day. For example for Saturday, it produces Friday times and for Monday, it produces Sunday times. When I console.log(times) on line:149 and when I console.log(qSnap.docs[0].data().times) line:166 I get: .

Here is what my database looks like:
.

Why is it doing this?

function SThrityminP() {
  const style = {
    position: "absolute",
    top: "50%",
    left: "50%",
    transform: "translate(-50%, -50%)",
    width: 400,
    bgcolor: "background.paper",
    border: "2px solid #000",
    boxShadow: 24,
    p: 4,
  };

  // Form values
  const [date, setDate] = useState(null);
  const [email, setEmail] = useState("");
  const [name, setName] = useState("");
  const [age, setAge] = useState("");
  const [team, setTeam] = useState("");
  const [number, setNumber] = useState("");
  const [time, setTime] = useState("");
  const [open, setOpen] = useState(false);
  const [error, setError] = useState(false);

  const handleErrOpen = () => setError(true);
  const handleErrClose = () => setError(false);
  const handleOpen = () => setOpen(true);
  const handleClose = () => setOpen(false);

  // To show times on screen
  const [times, setTimes] = useState([]);

  const timesRef = collection(db, "30min-shooting-private-times");
  const formRef = collection(db, "30min-shooting-private");

  const createBooking = async () => {
    await addDoc(formRef, {
      name: name,
      date: date,
      email: email,
      number: number,
      team: team,
      age: age,
      time: time,
    });
  };

  const addTimesForNextThreeWeeks = async () => {
    // Get current date
    let currentDate = new Date();

    // Set times to generate for weekdays
    let times = [];

    // Check if current day is Monday
    if (create) {
      // Generate times for next three weeks
      for (let i = 0; i < 180; i++) {
        currentDate.setDate(currentDate.getDate() + 1);

        // Format date as string
        const formattedDate = currentDate.toISOString().slice(0, 10);

        // Check if current date is a Saturday or Sunday
        if (currentDate.getDay() === 0 || currentDate.getDay() === 6) {
          // Set times to generate for Saturdays and Sundays
          times = [
            "Select a Time",
            "7:00am",
            "7:30am",
            "8:00am",
            "8:30am",
            "9:00am",
            "9:30am",
            "1:00pm",
            "1:30pm",
            "2:00pm",
            "2:30pm",
            "3:00pm",
            "3:30pm",
            "4:00pm",
            "4:30pm",
            "5:00pm",
            "5:30pm",
            "6:00pm",
            "6:30pm",
            "7:00pm",
            "7:30pm",
            "8:00pm",
            "8:30pm",
          ];
        } else {
          // Set times to generate for weekdays
          times = [
            "Select a Time",
            "7:00am",
            "7:30am",
            "8:00am",
            "8:30am",
            "9:00am",
            "9:30am",
            "10:00am",
            "10:30am",
            "11:00am",
            "11:30am",
            "12:00pm",
            "12:30pm",
            "1:00pm",
            "1:30pm",
            "2:00pm",
            "2:30pm",
            "3:00pm",
            "3:30pm",
            "4:00pm",
            "4:30pm",
            "8:00pm",
            "8:30pm",
          ];
        }

        // Add the times for this date to the database
        await addDoc(timesRef, {
          date: formattedDate,
          times: times,
        });
      }
    }
  };

  console.log(times);

  const handleDateChange = async (selectedDate) => {
    setDate(selectedDate);
    if (selectedDate) {
      console.log(
        "Fetching data for date: ",
        selectedDate.toISOString().slice(0, 10)
      );

      const timeQuery = query(
        timesRef,
        where("date", "==", selectedDate.toISOString().slice(0, 10))
      );

      const qSnap = await getDocs(timeQuery);
      console.log(qSnap.docs[0].data().times);
      setTimes(qSnap.docs[0].data().times);
    }
  };

  const countFunction = async () => {
    const countSnap = getCountFromServer(timesRef);
    console.log((await countSnap).data().count);

    if ((await countSnap).data().count < 180) {
      addTimesForNextThreeWeeks();
    }
  };

  useEffect(() => {
    countFunction();
  }, []);

  const handleSubmit = async (e) => {
    e.preventDefault();

    if (
      name === "" ||
      email === "" ||
      date === null ||
      time === "" ||
      time === "Select a Time" ||
      age === "" ||
      team === "" ||
      number === ""
    ) {
      handleErrOpen();
    } else {
      handleOpen();
      createBooking();

      const readableDate = date.toLocaleDateString("en-US", {
        month: "long",
        day: "numeric",
        year: "numeric",
      });

      const service = "30min shooting clinic - private";

      const res = await fetch("/bookings", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          name,
          email,
          number,
          team,
          age,
          readableDate,
          time,
          service,
        }),
      });

      console.log(res);

      setName("");
      setEmail("");
      setDate(null);
      setNumber("");
      setTeam("");
      setTime("");
      setAge("");
    }

    const timeQuery = query(
      timesRef,
      where("date", "==", date.toISOString().slice(0, 10))
    );
    const qSnap = await getDocs(timeQuery);

    // Get the document ID and times array
    qSnap.forEach((doc) => {
      console.log("id: ", doc.id, "data: ", doc.data());
    });

    console.log(times);
    let updatedTimes = times.filter((t) => t !== time);
    if (times.length === 1) {
      updatedTimes = [];
    }
    console.log(updatedTimes);

    if (qSnap.size > 0) {
      const docId = qSnap.docs[0].id;
      const docRef = doc(timesRef, docId);
      await updateDoc(docRef, {
        times: updatedTimes,
      });
    }

    handleDateChange(date);
  };

  return (

        Book 30min Private Shooting Clinic

        <form onSubmit={handleSubmit} class="flex flex-col pt-10 w-3/4">
          <input
            type="text"
            name="name"
            placeholder="Name"
            value={name}
            onChange={(e) => setName(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="email"
            placeholder="Email"
            value={email}
            onChange={(e) => setEmail(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="number"
            placeholder="Phone Number"
            value={number}
            onChange={(e) => setNumber(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="team"
            placeholder="Team Name"
            value={team}
            onChange={(e) => setTeam(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />
          <input
            type="text"
            name="age"
            placeholder="Age"
            value={age}
            onChange={(e) => setAge(e.target.value)}
            class="border-2 p-3 mb-5 border-gray rounded-lg"
          />

            Pick a Date and Time

            Please note that we only allow bookings up to 3 weeks in advance.
            Please choose a date within the next 3 weeks.

            If there are no time slots available please select another date or
            try refreshing the page.

            The available times for our Shooting Clinics are Mon-Fri: 7am-5pm,
            8-9pm and Sat-Sun: 7am-10am, 1-9pm.

            <DatePicker
              className="border-2 p-3 w-full border-gray rounded-lg"
              selected={date}
              onChange={handleDateChange}
              placeholderText="Select a Date"
            />

              <select
                value={time}
                onChange={(e) => setTime(e.target.value)}
                placeholder="Text"
                className="border-2 p-3 mb-5 border-gray rounded-lg w-full"
              >
                {times.map((time) => (
                  <option key={time} value={time}>
                    {time}
                  </option>
                ))}
              </select>

          <button
            type="submit"
            class="bg-accent text-white font-semibold p-3 rounded-full"
          >
            Submit
          </button>
        </form>
        <Modal
          open={open}
          onClose={handleClose}
          aria-labelledby="modal-modal-title"
          aria-describedby="modal-modal-description"
        >
          <Box sx={style}>
            <Typography id="modal-modal-title" variant="h6" component="h2">
              Thanks For Booking!
            </Typography>
            <Typography id="modal-modal-description" sx={{ mt: 2, py: 3 }}>
              Please check your email for booking conformation.
            </Typography>
            <button
              onClick={handleClose}
              class="bg-blue text-white text-sm font-normal p-3 rounded-full w-full"
            >
              Close
            </button>
          </Box>
        </Modal>
        <Modal
          open={error}
          onClose={handleErrClose}
          aria-labelledby="modal-modal-title"
          aria-describedby="modal-modal-description"
        >
          <Box sx={style}>
            <Typography id="modal-modal-title" variant="h6" component="h2">
              Uh Oh!
            </Typography>
            <Typography id="modal-modal-description" sx={{ mt: 2, py: 3 }}>
              Please make sure all fields are filled in.
            </Typography>
            <button
              onClick={handleErrClose}
              class="bg-blue text-white text-sm font-normal p-3 rounded-full w-full"
            >
              Close
            </button>
          </Box>
        </Modal>

  );
}

export default SThrityminP;


问:
How to install gcc4.8 on M1 Mac
So, for installing a particular software I needed to install gcc 4.8. I tried following the instruction here.
But running the command brew install gcc48 I get the following prompt

```<code>Warning: No available formula with the name "gcc48". Did you mean gcc@8, gcc, gcc@4.9, gcc@9, gcc@7, gcc@6 or gcc@5?
</code>```

Going to the homebrew website I see that till gcc@4.9 is supported. But even that doesn't work on my Mac.
It throws the following error:

```<code>Error: gcc@4.9 has been disabled because it is deprecated upstream!
</code>```

So, Is there any way to install it? I know that sudo apt still works on Linux systems for installing gcc. So, is there a way to install gcc-4.8 in Mac M1?

Title: How to install gcc4.8 on M1 Mac

Body:
So, for installing a particular software I needed to install gcc 4.8. I tried following the instruction here.
But running the command brew install gcc48 I get the following prompt

Warning: No available formula with the name "gcc48". Did you mean gcc@8, gcc, gcc@4.9, gcc@9, gcc@7, gcc@6 or gcc@5?

Going to the homebrew website I see that till gcc@4.9 is supported. But even that doesn't work on my Mac.
It throws the following error:

Error: gcc@4.9 has been disabled because it is deprecated upstream!

So, Is there any way to install it? I know that sudo apt still works on Linux systems for installing gcc. So, is there a way to install gcc-4.8 in Mac M1?


问:
accessing a package hosted in a same org without using oauth token
I have 2 repos under the same github organization, says they're repo1 and repo2.

In repo2's package.json I have this to install repo1

```<code>{
 ...
     "my-lib": "git+https://123456:x-oauth-basic@github.com/myOrgName/my-lib.git#v1.0.0"
 ...
}
</code>```

123456 is my token, but I'm looking for other way to install repo1 into repo2. I know another way is to publish to private npm registry but that's a bit overkill.

Body:
I have 2 repos under the same github organization, says they're repo1 and repo2.

In repo2's package.json I have this to install repo1

{
 ...
     "my-lib": "git+https://123456:x-oauth-basic@github.com/myOrgName/my-lib.git#v1.0.0"
 ...
}

123456 is my token, but I'm looking for other way to install repo1 into repo2. I know another way is to publish to private npm registry but that's a bit overkill.


问:
The other component are not showing exaclty on the right side of sidebar . How to fixed it?
```<code><Route path="/parentDashboard" element={<UserLayout />}>
          <Route
            path="/parentDashboard/parent/profile"
            element={<ParentProfile />}
          />
          <Route
            path="/parentDashboard/appointment/book"
            element={<BookAppointment />}
          />
          <Route path="/parentDashboard/add/child" element={<AddChildData />} />
          <Route
            path="/parentDashboard/view/child"
            element={<ViewChildData />}
          />
          <Route
            path="/parentDashboard/myRemainder/parent"
            element={<MyRemainder />}
          />
          <Route
            path="/parentDashboard/appointment/today"
            element={<TodayAppointment />}
          />
          <Route
            path="/parentDashboard/appointment/all"
            element={<AllAppointments />}
          />
        </Route>
</code>```

I have imported parentDashboard in UserLayout component as:

```<code>import React from "react";
import { Outlet } from "react-router-dom";
import "./UserLayout.css";
import ParentDashboard from "../ParentDashboard/ParentDashboard";

const UserLayout = () => {
  return (
    <>
      <div className="userdashboard_wrapper">
        <div className="userlayout">
          <ParentDashboard />
          <Outlet />
        </div>
      </div>
    </>
  );
};

export default UserLayout;
</code>```

and the parent dashboard i.e sidebar of the dashboard

```<code>import React from "react";
import {
  CDBSidebar,
  CDBSidebarContent,
  CDBSidebarFooter,
  CDBSidebarHeader,
  CDBSidebarMenu,
  CDBSidebarMenuItem,
} from "cdbreact";
import { NavLink } from "react-router-dom";

const ParentDashboard = () => {
  return (
    <div
      style={{ display: "flex", height: "100vh", overflow: "scroll initial" }}
    >
      <CDBSidebar textColor="#fff" backgroundColor="#4A148C;">
        <CDBSidebarHeader prefix={<i className="fa fa-bars fa-large"></i>}>
          <a
            href="/"
            className="text-decoration-none"
            style={{ color: "inherit" }}
          >
            Child Vaccine
          </a>
        </CDBSidebarHeader>

        <CDBSidebarContent className="sidebar-content">
          <CDBSidebarMenu>
            <NavLink
              to="/parentDashboard/parent/profile"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="user"> My Profile</CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/appointment/book"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="calendar-check">
                Book Appointment
              </CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/add/child"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="child">Add Child</CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/view/child"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="child">View Child</CDBSidebarMenuItem>
            </NavLink>

            <NavLink
              to="/parentDashboard/myRemainder/parent"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="bell">My Remainder</CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/appointment/today"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="calendar-check">
                Today Appointment
              </CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/appointment/all"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="calendar-check">
                All Appointment
              </CDBSidebarMenuItem>
            </NavLink>
          </CDBSidebarMenu>
        </CDBSidebarContent>

        <CDBSidebarFooter style={{ textAlign: "center" }}>
          <div
            style={{
              padding: "20px 5px",
            }}
          >
            Sidebar Footer
          </div>
        </CDBSidebarFooter>
      </CDBSidebar>
    </div>
  );
};

export default ParentDashboard;`
</code>```

the output is as follows :

```<code>output:[sidebar][1]
,[sidebar with one component][1]

</code>```

problems:
I want to make the other component is placed exaclty on the right side of sidebar, but all other component is going down the sidebar . How to fixed it ?? need help! . I only want to make other component exactly right of sidebar all other routing is working..

Body:
<Route path="/parentDashboard" element={<UserLayout />}>
          <Route
            path="/parentDashboard/parent/profile"
            element={<ParentProfile />}
          />
          <Route
            path="/parentDashboard/appointment/book"
            element={<BookAppointment />}
          />
          <Route path="/parentDashboard/add/child" element={<AddChildData />} />
          <Route
            path="/parentDashboard/view/child"
            element={<ViewChildData />}
          />
          <Route
            path="/parentDashboard/myRemainder/parent"
            element={<MyRemainder />}
          />
          <Route
            path="/parentDashboard/appointment/today"
            element={<TodayAppointment />}
          />
          <Route
            path="/parentDashboard/appointment/all"
            element={<AllAppointments />}
          />
        </Route>

I have imported parentDashboard in UserLayout component as:

import React from "react";
import { Outlet } from "react-router-dom";
import "./UserLayout.css";
import ParentDashboard from "../ParentDashboard/ParentDashboard";

const UserLayout = () => {
  return (
    <>

          <ParentDashboard />
          <Outlet />

    </>
  );
};

export default UserLayout;

and the parent dashboard i.e sidebar of the dashboard

import React from "react";
import {
  CDBSidebar,
  CDBSidebarContent,
  CDBSidebarFooter,
  CDBSidebarHeader,
  CDBSidebarMenu,
  CDBSidebarMenuItem,
} from "cdbreact";
import { NavLink } from "react-router-dom";

const ParentDashboard = () => {
  return (

      <CDBSidebar textColor="#fff" backgroundColor="#4A148C;">
        <CDBSidebarHeader prefix={}>

            Child Vaccine

        </CDBSidebarHeader>

        <CDBSidebarContent className="sidebar-content">
          <CDBSidebarMenu>
            <NavLink
              to="/parentDashboard/parent/profile"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="user"> My Profile</CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/appointment/book"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="calendar-check">
                Book Appointment
              </CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/add/child"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="child">Add Child</CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/view/child"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="child">View Child</CDBSidebarMenuItem>
            </NavLink>

            <NavLink
              to="/parentDashboard/myRemainder/parent"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="bell">My Remainder</CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/appointment/today"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="calendar-check">
                Today Appointment
              </CDBSidebarMenuItem>
            </NavLink>
            <NavLink
              to="/parentDashboard/appointment/all"
              activeclassname="activeClicked"
            >
              <CDBSidebarMenuItem icon="calendar-check">
                All Appointment
              </CDBSidebarMenuItem>
            </NavLink>
          </CDBSidebarMenu>
        </CDBSidebarContent>

        <CDBSidebarFooter style={{ textAlign: "center" }}>

            Sidebar Footer

        </CDBSidebarFooter>
      </CDBSidebar>

  );
};

export default ParentDashboard;`

the output is as follows :

output:[sidebar][1]
,[sidebar with one component][1]

problems:
I want to make the other component is placed exaclty on the right side of sidebar, but all other component is going down the sidebar . How to fixed it ?? need help! . I only want to make other component exactly right of sidebar all other routing is working..