问:
Docker React Issue / Bug ? ( Docker building React images with stale code)
Basically I've setup a webapp with this stack: db: MySQL , frontend: React.js, backend: FastAPI (Python)

It's SSL Secure (Since the domain is being Mitigated thru by Cloudflare)

NGINX is used for Service endpoints api.domain.com is the API & domain.com for the frontend and some SSL keys stuff.

Even though this is quote on quote "Production", I'm still running a react development server for prototyping.

**PROBLEM:**

I'm running this project on a VPS, when I update the frontend on the VPS then delete all docker containers and images via the commands:

```<code>docker rm -vf $(docker ps -aq) #Delete all containers and volumes
docker rmi -f $(docker images -aq) #Delete all images
</code>```

The changes still remain old, the caching on my browser is disabled aswell and i've tried multiple methods of clearing cache, it's not that.

The bundle.js webpack file still has it's old changes when being received from React,  Specifically, I edited some Endpoint constants for production & that constant is stale in bundle.js! when changing stuff for the backend (Python files) it's working just fine and updated upon CMDS: docker-compose up -d & docker-compose up but react is acting up)

I've tried:
docker-compose pull
docker-compose build --no-cache
docker-compose
Made sure all my frontend files where saved infact.

no luck..

The API is running fine on HTTPS & React.js is also running fine, but the changes are just stale, it's very weird.

docker-compose.yml

version: "3.9"

services:
  db:
    image: mysql:${MYSQL_VERSION}
    restart: always
    environment:
      - MYSQL_DATABASE=${MYSQL_DB}
      - MYSQL_USER=${MYSQL_USERNAME}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    ports:
      - "${MYSQL_PORT}:${MYSQL_PORT}"
    expose:
      - "${MYSQL_PORT}"
    volumes:
      - db:/var/lib/mysql
    networks:
      - mysql_network

  backend:
    container_name: fastapi-backend
    build: ./backend/app
    volumes:
      - ./backend:/code
    ports:
      - "${FASTAPI_PORT}:${FASTAPI_PORT}"
    env_file:
      - .env
    depends_on:
      - db
    networks:
      - mysql_network
      - backend
    restart: always

  frontend:
    container_name: react-frontend
    build: ./frontend/client
    ports:
      - "${REACT_PORT}:${REACT_PORT}"
    depends_on:
      - backend
    networks:
      - backend
    restart: always

volumes:
  db:
    driver: local

networks:
  backend:
    driver: bridge
  mysql_network:
    driver: bridge

```

This was working for my last release, for some reason it just stopped updating, docker is creating the images fine just with stale code...

This is being ran on Ubuntu 22.04 (Debian-like Linux Distribution)

Body:
Basically I've setup a webapp with this stack: db: MySQL , frontend: React.js, backend: FastAPI (Python)

It's SSL Secure (Since the domain is being Mitigated thru by Cloudflare)

NGINX is used for Service endpoints api.domain.com is the API & domain.com for the frontend and some SSL keys stuff.

Even though this is quote on quote "Production", I'm still running a react development server for prototyping.

**PROBLEM:**

I'm running this project on a VPS, when I update the frontend on the VPS then delete all docker containers and images via the commands:

docker rm -vf $(docker ps -aq) #Delete all containers and volumes
docker rmi -f $(docker images -aq) #Delete all images

The changes still remain old, the caching on my browser is disabled aswell and i've tried multiple methods of clearing cache, it's not that.

The bundle.js webpack file still has it's old changes when being received from React,  Specifically, I edited some Endpoint constants for production & that constant is stale in bundle.js! when changing stuff for the backend (Python files) it's working just fine and updated upon CMDS: docker-compose up -d & docker-compose up but react is acting up)

I've tried:
docker-compose pull
docker-compose build --no-cache
docker-compose
Made sure all my frontend files where saved infact.

no luck..

The API is running fine on HTTPS & React.js is also running fine, but the changes are just stale, it's very weird.

docker-compose.yml

version: "3.9"

services:
  db:
    image: mysql:${MYSQL_VERSION}
    restart: always
    environment:
      - MYSQL_DATABASE=${MYSQL_DB}
      - MYSQL_USER=${MYSQL_USERNAME}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    ports:
      - "${MYSQL_PORT}:${MYSQL_PORT}"
    expose:
      - "${MYSQL_PORT}"
    volumes:
      - db:/var/lib/mysql
    networks:
      - mysql_network

  backend:
    container_name: fastapi-backend
    build: ./backend/app
    volumes:
      - ./backend:/code
    ports:
      - "${FASTAPI_PORT}:${FASTAPI_PORT}"
    env_file:
      - .env
    depends_on:
      - db
    networks:
      - mysql_network
      - backend
    restart: always

  frontend:
    container_name: react-frontend
    build: ./frontend/client
    ports:
      - "${REACT_PORT}:${REACT_PORT}"
    depends_on:
      - backend
    networks:
      - backend
    restart: always

volumes:
  db:
    driver: local

networks:
  backend:
    driver: bridge
  mysql_network:
    driver: bridge

This was working for my last release, for some reason it just stopped updating, docker is creating the images fine just with stale code...

This is being ran on Ubuntu 22.04 (Debian-like Linux Distribution)


来源: stackexchange

问:
What does it mean? ;[result] = bla bla bla
this is the code:

```<code>let result

if (session.isLegacy) {
    result = await session.onWhatsApp(jid)
} else {
    ;[result] = await session.onWhatsApp(jid)
}
</code>```

He defined the result inside square brackets, and semicolon on the left side

I know the Destructuring, but why put the semicolon on the left side?

ContentLicense: CC BY-SA 4.0

Body:
this is the code:

let result

if (session.isLegacy) {
    result = await session.onWhatsApp(jid)
} else {
    ;[result] = await session.onWhatsApp(jid)
}

He defined the result inside square brackets, and semicolon on the left side

I know the Destructuring, but why put the semicolon on the left side?


问:
Not able to set font color of card header using Bulma sass variable's $card-header-color
My npm project: Vue 2 with Bulma as the CSS framework

I am trying to create a card component and want to change the color of the header's text that is inside a div with class card-header. However, the color of the text just won't change.

Component.vue

```<code><template>
  <div class="card">
    <div class="card-header p-3">MON</div>
    <div class="card-content">
      <slot></slot>
    </div>
  </div>
</template>
</code>```

main.scss

i have used sass variable $card-header-color: white; but it does not change the text color. How do i do this?

```<code>....
$card-radius: 0;
$card-shadow: transparent;
$card-header-color: white;
$card-header-shadow: transparent;
$card-header-background-color: black;

@import "../node_modules/bulma/sass/utilities/_all.sass";
@import "../node_modules/bulma/sass/base/_all.sass";
@import "../node_modules/bulma/sass/elements/container.sass";
@import "../node_modules/bulma/sass/helpers/_all.sass";
@import "../node_modules/bulma/sass/components/card.sass";

</code>```

I know I would be able to achieve this using pure CSS by overwriting the styles of that element but wanted to know why using $card-header-color won't work in my case.

I hope to be able to achieve the desired result using SASS variable $card-header-color as documented in the Bulma docs. under the variables section of the card component.

https://bulma.io/documentation/components/card/

Body:
My npm project: Vue 2 with Bulma as the CSS framework

I am trying to create a card component and want to change the color of the header's text that is inside a div with class card-header. However, the color of the text just won't change.

Component.vue

<template>

MON

      <slot></slot>

</template>

main.scss

i have used sass variable $card-header-color: white; but it does not change the text color. How do i do this?

....
$card-radius: 0;
$card-shadow: transparent;
$card-header-color: white;
$card-header-shadow: transparent;
$card-header-background-color: black;

@import "../node_modules/bulma/sass/utilities/_all.sass";
@import "../node_modules/bulma/sass/base/_all.sass";
@import "../node_modules/bulma/sass/elements/container.sass";
@import "../node_modules/bulma/sass/helpers/_all.sass";
@import "../node_modules/bulma/sass/components/card.sass";

I know I would be able to achieve this using pure CSS by overwriting the styles of that element but wanted to know why using $card-header-color won't work in my case.

I hope to be able to achieve the desired result using SASS variable $card-header-color as documented in the Bulma docs. under the variables section of the card component.

https://bulma.io/documentation/components/card/


问:
qrcode-vue3 CORS issue intermittently
I am using this package - qrcode-vue3 in my Laravel Vue project.

I am creating a QR code in various places of the app, each of which contains an logo image supplied via the component options:

```<code><template>
    <QRCodeVue3
        v-bind="qrOptions"
    />
</template>

<script>
import QRCodeVue3 from "qrcode-vue3";
import {computed} from "vue";
import {useStore} from "vuex";

export default {
    name: "QrGenerator",
    components: {
        QRCodeVue3,
    },
    props: {
        qrData: {
            type: String,
            default: undefined,
        },
        withSquareLogo: {
            type: Boolean,
            default: true,
        },
        width: {
            type: Number,
            default: 300,
        },
        height: {
            type: Number,
            default: 300,
        },
        download: {
            type: Boolean,
            default: true,
        },
        downloadFileName: {
            type: String,
            default: undefined,
        },
    },
    setup(props) {
        const store = useStore();

        const colors = computed(() => store.getters['whiteLabel/colors']);
        const logos = computed(() => store.getters['whiteLabel/logos']);

        const qrOptions = computed( () => ({
            "backgroundOptions": {
                "color": "#ffffff"
            },
            "backgroundOptionsHelper": {
                "colorType": {
                    "gradient": false,
                    "single": true
                },
                "gradient": {
                    "color1": "#ffffff",
                    "color2": "#ffffff",
                    "linear": true,
                    "radial": false,
                    "rotation": "0"
                }
            },
            "cornersDotOptions": {
                "color": "#000000",
                "type": ""
            },
            "cornersDotOptionsHelper": {
                "colorType": {
                    "gradient": false,
                    "single": true
                },
                "gradient": {
                    "color1": "#000000",
                    "color2": "#000000",
                    "linear": true,
                    "radial": false,
                    "rotation": "0"
                }
            },
            "cornersSquareOptions": {
                "color": "#000000",
                "type": "extra-rounded"
            },
            "cornersSquareOptionsHelper": {
                "colorType": {
                    "gradient": false,
                    "single": true
                },
                "gradient": {
                    "color1": "#000000",
                    "color2": "#000000",
                    "linear": true,
                    "radial": false,
                    "rotation": "0"
                }
            },
            "value": props.qrData,
            "dotsOptions": {
                "color": colors.value.primary_color,
                "type": "extra-rounded"
            },
            "dotsOptionsHelper": {
                "colorType": {
                    "gradient": false,
                    "single": true
                },
                "gradient": {
                    "color1": colors.value.primary_color,
                    "color2": colors.value.primary_color,
                    "linear": true,
                    "radial": false,
                    "rotation": "0"
                }
            },
            "image": logos.value.square,
            "imageOptions": {
                "hideBackgroundDots": true,
                "imageSize": 0.4,
                "margin": 0,
                "crossOrigin": "Anonymous"
            },
            "margin": 0,
            "qrOptions": {
                "errorCorrectionLevel": "Q",
                "mode": "Byte",
                "typeNumber": "0"
            },
            "download": false,
            "height": props.height,
            "width": props.width
        }));

        return {
            logos,
            colors,
            qrOptions,
        }
    }
};
</code>```

This works OK for some of the time, with logo loading into the QR code. The logo is in a static assets S3 bucket, that is public access and allow-origins of "*". The domain to the static assets bucket (https://static.myapp.com.au) is being proxied via CloudFlare.

But for some of the time I get a CORS error as the component is mounting and generating the QR:

```<code>Access to image at 'https://static.myapp.com.au/logo_square.png' from origin 'https://lins.myapp.com.au' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.  index.js?f95a:1
GET https://static.myapp.com.au/logo_square.png net::ERR_FAILED 200
</code>```

It has wasted a bunch of time now but without luck in finding the solution. It will work consecutively for a number of tries (say 20 times), then try again some minutes later and Bang! CORS error.

Thanks

Title: qrcode-vue3 CORS issue intermittently

Body:
I am using this package - qrcode-vue3 in my Laravel Vue project.

I am creating a QR code in various places of the app, each of which contains an logo image supplied via the component options:

<template>
    <QRCodeVue3
        v-bind="qrOptions"
    />
</template>


问:
ValueError: Input 0 of layer "max_pooling2d" is incompatible with the layer: expected ndim=4, found ndim=5
This is my code:

```<code>model = Sequential()
model.add(Conv2D(32, (2, 2), activation = "relu", input_shape = (400, 600, 900, 3)))
model.add(MaxPooling2D(2, 2))
model.add(Conv2D(64, (3, 3), activation = "relu"))
model.add(MaxPooling2D(2, 2))

model.add(Flatten())
model.add(Dense(32, activation='relu'))
model.add(Dense(540))

model.compile(optimizer="adam", loss=tf.keras.losses.SparseCategoricalCrossentropy() , metrics=["accuracy"])
model.fit(images, masks, batch_size=30, epochs = 5)
</code>```

I have a simple CNN model which takes in 400 images of sizes 600 x 900 with 3 color channels for RGB, and my corresponding outputs are 400 images of size 600 x 900 (no color channels as its greyscale).

I keep getting errors when I run compile the model, my terminal instantly kills the process each time the code reaches the first Dense layer, before that CPU and GPU usage wasnt particularly high, Ive also tried it on Google Colab to monitor the RAM usage and it was perfectly below the threshold level before it reaches the Dense layer.

Where is my mistake?

Body:
This is my code:

model = Sequential()
model.add(Conv2D(32, (2, 2), activation = "relu", input_shape = (400, 600, 900, 3)))
model.add(MaxPooling2D(2, 2))
model.add(Conv2D(64, (3, 3), activation = "relu"))
model.add(MaxPooling2D(2, 2))

model.add(Flatten())
model.add(Dense(32, activation='relu'))
model.add(Dense(540))

model.compile(optimizer="adam", loss=tf.keras.losses.SparseCategoricalCrossentropy() , metrics=["accuracy"])
model.fit(images, masks, batch_size=30, epochs = 5)

I have a simple CNN model which takes in 400 images of sizes 600 x 900 with 3 color channels for RGB, and my corresponding outputs are 400 images of size 600 x 900 (no color channels as its greyscale).

I keep getting errors when I run compile the model, my terminal instantly kills the process each time the code reaches the first Dense layer, before that CPU and GPU usage wasnt particularly high, Ive also tried it on Google Colab to monitor the RAM usage and it was perfectly below the threshold level before it reaches the Dense layer.

Where is my mistake?


问:
I have coming numeric data in one column continuously in real time in csv dataframe. i want to save that data as 70k data point in each column
I have coming numeric data in one column continuously in real time in csv dataframe. i want to save that data as 70k data point in each column

data is spike power in numeric form. i want to save that data as 70k data point in each column.


问:
Can't update data in Sqlite3 php
I'm trying  to make simple api using php .
everything goes smoothly except  updating .
here is my code code for index (route):

```<code>$router->post('/api/update/{id}', function ($id) use ($product) {
 //   $_POST['id'] = $id;
    echo $product->update($_POST);
    //var_dump($_POST);
});
</code>```

and here is my code update method in products class :

```<code>public function update(array $data) {
        /** @var TYPE_NAME $id */
        $query = $this->db->prepare("UPDATE products SET name= ?, price= ? ,amount= ? WHERE id= ?");
        $query->execute(array($data['name'], $data['price'], $data['amount'],$data['id']));
        return json_encode(["msg" => "The Product was updated successfully."]);
        //return json_encode($data);
    }
</code>```

when I make post request  I get this error :

Warning:  Undefined array key "name" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

Warning:  Undefined array key "price" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

Warning:  Undefined array key "amount" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

Warning:  Undefined array key "id" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

{"msg":"The Product was updated successfully."}

I try to update  product  data in my SQLITE3 databases.

Title: Can't update data in Sqlite3 php

Body:
I'm trying  to make simple api using php .
everything goes smoothly except  updating .
here is my code code for index (route):

$router->post('/api/update/{id}', function ($id) use ($product) {
 //   $_POST['id'] = $id;
    echo $product->update($_POST);
    //var_dump($_POST);
});

and here is my code update method in products class :

public function update(array $data) {
        /** @var TYPE_NAME $id */
        $query = $this->db->prepare("UPDATE products SET name= ?, price= ? ,amount= ? WHERE id= ?");
        $query->execute(array($data['name'], $data['price'], $data['amount'],$data['id']));
        return json_encode(["msg" => "The Product was updated successfully."]);
        //return json_encode($data);
    }

when I make post request  I get this error :

Warning:  Undefined array key "name" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

Warning:  Undefined array key "price" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

Warning:  Undefined array key "amount" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

Warning:  Undefined array key "id" in /storage/emulated/0/www/products_manager/app/Products.php on line 52

{"msg":"The Product was updated successfully."}

I try to update  product  data in my SQLITE3 databases.


问:
Change font family to math italic in ggplot element_text
I have an R code chunk in an LyX file that creates a graph. I would like to label the axes of this graph in a math italic font. It seems to me that the thing to do is to add a theme with an entry along the lines of:

```<code>axis.title = element_text(family = "XXX", face = "italic", size = 14))
</code>```

But regardless of what I try, I keep getting the following error message

```<code>In grid.call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
      font family not found in Windows font database
</code>```

How can I select the same font that LyX uses for mathematics, and independently of the operating system?

Body:
I have an R code chunk in an LyX file that creates a graph. I would like to label the axes of this graph in a math italic font. It seems to me that the thing to do is to add a theme with an entry along the lines of:

axis.title = element_text(family = "XXX", face = "italic", size = 14))

But regardless of what I try, I keep getting the following error message

In grid.call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
      font family not found in Windows font database

How can I select the same font that LyX uses for mathematics, and independently of the operating system?


问:
Create Matrix in python with same index and column names
I need to create a cohort matrix that shows the percentage increase in unique customer count through years. Below is an example dataframe that has the year and unique customer count information and the example output I am trying to obtain:

example_df = pd.DataFrame({"year" : [2020, 2021, 2022], "customer_count" : [270, 280, 350]})
example_output =  pd.DataFrame({"2020":[0, 3.7, 29.63], "2021":[3.7, 0, 25], "2022":[29.63, 25, 0]}, index = [2020, 2021, 2022])
```

Currently, I manually calculate the increase in client counts but my data starts from 1985 and manual computation does not work in the actual case. How can I create such an output in python? Additionally, is there any way to turn the output into a format as below:

Body:
I need to create a cohort matrix that shows the percentage increase in unique customer count through years. Below is an example dataframe that has the year and unique customer count information and the example output I am trying to obtain:

example_df = pd.DataFrame({"year" : [2020, 2021, 2022], "customer_count" : [270, 280, 350]})
example_output =  pd.DataFrame({"2020":[0, 3.7, 29.63], "2021":[3.7, 0, 25], "2022":[29.63, 25, 0]}, index = [2020, 2021, 2022])

Currently, I manually calculate the increase in client counts but my data starts from 1985 and manual computation does not work in the actual case. How can I create such an output in python? Additionally, is there any way to turn the output into a format as below:


问:
Error while specifying compileSdkversion in React Native Expo App
I have built a React Native app using Expo. Testing works fine in the emulator, but when I try to do an Android build I have errors. When I use the command npx expo run:android, I get the following error:

```<code>FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script 'C:\Users\thish\OneDrive\Desktop\MottozPrinter\node_modules\expo-modules-autolinking\scripts\android\autolinking_implementation.gradle' line: 272

* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-modules-core'.
   > Failed to notify project evaluation listener.
      > The filename, directory name, or volume label syntax is incorrect
      > Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> compileSdkVersion is not specified. Please add it to build.gradle
</code>```

Here is my build.gradle android configuration:

Body:
I have built a React Native app using Expo. Testing works fine in the emulator, but when I try to do an Android build I have errors. When I use the command npx expo run:android, I get the following error:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script 'C:\Users\thish\OneDrive\Desktop\MottozPrinter\node_modules\expo-modules-autolinking\scripts\android\autolinking_implementation.gradle' line: 272

* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-modules-core'.
   > Failed to notify project evaluation listener.
      > The filename, directory name, or volume label syntax is incorrect
      > Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> compileSdkVersion is not specified. Please add it to build.gradle

Here is my build.gradle android configuration:


问:
How to define multiple types for input field in graphql nestjs
In the below code I want to define multiple types for the field value ,  current implementation only allows the first type (i.e., String).  but how can i define to expect any of these three types as input argument.

```<code>
@InputType()
class RangeInput implements RangeInterface {
  @Field(type => String)
  start: string;

  @Field(type => String)
  end: string;
}

@InputType()
class KeyValuePair implements KeyValuePairInterface {
  @Field()
  key: string;

  @Field(() => [String, RangeInput, Number)
  value: string[] | RangeInput | number[];

  @Field(() => Boolean)
  matchExact: boolean;

  @Field(() => FilterType)
  filterType: FilterType;
}
</code>```

I tried

```<code>@Field(() => [String, RangeInput, Number)
</code>```
```<code>@Field(() => [Object)
</code>```
```<code>@Field(() => [JSON)
</code>```

Body:
In the below code I want to define multiple types for the field value ,  current implementation only allows the first type (i.e., String).  but how can i define to expect any of these three types as input argument.

@InputType()
class RangeInput implements RangeInterface {
  @Field(type => String)
  start: string;

  @Field(type => String)
  end: string;
}

@InputType()
class KeyValuePair implements KeyValuePairInterface {
  @Field()
  key: string;

  @Field(() => [String, RangeInput, Number)
  value: string[] | RangeInput | number[];

  @Field(() => Boolean)
  matchExact: boolean;

  @Field(() => FilterType)
  filterType: FilterType;
}

I tried

@Field(() => [String, RangeInput, Number)

@Field(() => [Object)

@Field(() => [JSON)


问:
How do I populate two variables using foreach in js?
```<code>function populateTable(data,monthly) {
            var table = $('#file_export').DataTable();
            table.clear().draw();
            data.forEach(element => {
                table.row.add([
                    element.date,
                    element.dailycount,
                    // monthly.monthlycount,

                ]).draw(false);
            });

        }
</code>```

the following query returns the result of only the data variable, but i need a record of monthly too.It may be the case that the rows of both data and monthly won't be equal.what is the best idea to populate both results in a table.

Body:
function populateTable(data,monthly) {
            var table = $('#file_export').DataTable();
            table.clear().draw();
            data.forEach(element => {
                table.row.add([
                    element.date,
                    element.dailycount,
                    // monthly.monthlycount,

                ]).draw(false);
            });

        }

the following query returns the result of only the data variable, but i need a record of monthly too.It may be the case that the rows of both data and monthly won't be equal.what is the best idea to populate both results in a table.


问:
Efficient approach or algorithm to search all rectangle that cover a point on Cartesian coordinate system?
I have a set of data which contains a list of array. Each array contains 4 value of coordinates which forms a rectangle.

i.e. the start and end point(Xs, Xe) on X-axis; and the start and end point(Ys, Ye) on y-axis.

```<code> Xs|Xe|Ys|Ye
--------------
[[10,15,5,8],
 [9,12,5,8],
 [1,20,1,20]]
</code>```

, for example.

And now I had a point(x,y).

To get all the rectangles that will cover the point, I simply loop through all array and compare one by one.

related_rectangles = []
for rectangle in dataset:
    if x > rectangle[0] and x < rectangle[1] and y > rectangle[2] and y < rectangle[3]:
        related_rectangles.append(rectangle)
```

The complexity should be O(n).

The question is, is there any algorithm or data structure that could reduce the complexity of searching? Especially for the case that all rectangles are squares.

Thanks.

Body:
I have a set of data which contains a list of array. Each array contains 4 value of coordinates which forms a rectangle.

i.e. the start and end point(Xs, Xe) on X-axis; and the start and end point(Ys, Ye) on y-axis.

 Xs|Xe|Ys|Ye
--------------
[[10,15,5,8],
 [9,12,5,8],
 [1,20,1,20]]

, for example.

And now I had a point(x,y).

To get all the rectangles that will cover the point, I simply loop through all array and compare one by one.

related_rectangles = []
for rectangle in dataset:
    if x > rectangle[0] and x < rectangle[1] and y > rectangle[2] and y < rectangle[3]:
        related_rectangles.append(rectangle)

The complexity should be O(n).

The question is, is there any algorithm or data structure that could reduce the complexity of searching? Especially for the case that all rectangles are squares.

Thanks.


问:
Reproducible shuffle on Postgres
Is there an equivalent of MySQL rand(seed) in Postgres but in one statement because there is no way for me to guarantee that setseed() will be executed just before the random() in the same db instance. Also there is just too much columns to use a union.

Title: Reproducible shuffle on Postgres


问:
How to make docx2pdf work on Google Colab to convert Docx to PDF automatically
I am getting following error when I tried to convert docx to PDF using docx2pdf imported from docx

Google colab code:

```<code>!pip install docx2pdf
from docx2pdf import convert as doc2pdf
doc2pdf('My_document.docx')
</code>```

Present output:

```<code>docx2pdf is not implemented for linux as it requires Microsoft Word to be installed
</code>```

If it cannot work, can you suggest another package that I can use to convert the docx to PDF on the Google colab automatically?

Body:
I am getting following error when I tried to convert docx to PDF using docx2pdf imported from docx

Google colab code:

!pip install docx2pdf
from docx2pdf import convert as doc2pdf
doc2pdf('My_document.docx')

Present output:

docx2pdf is not implemented for linux as it requires Microsoft Word to be installed

If it cannot work, can you suggest another package that I can use to convert the docx to PDF on the Google colab automatically?


问:
JBoss JBoss EAP 7.4.7.GA, Caused by: java.lang.NullPointerException: overflowAction is null
trying to deploy a Java app with JBoss EAP 7.4.7.GA Image , but getting below error , tried to increase no of threads, and timeout in Java options.

-Xmx2048m -Xms1024m -Dorg.jboss.server.bootstrap.maxThreads=60 -Djboss.as.management.blocking.timeout=600

```<code>2022-12-30 00:19:55,850 WARNING retrying as app-sec framework configuration failed with error:
Return Code: 1
StdOut:
Failed to connect to the controller: Timeout waiting for the system to boot.

StdErr:

00:20:07,136 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[
    ("core-service" => "management"),
    ("management-interface" => "http-interface")
]'
Failed to invoke setter setOverflowAction with value null
.java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.lambda$rollback$2(AbstractPropertyConfiguration.java:255)
        at org.jboss.logmanager.config.WrappedAction.execute(WrappedAction.java:61)
        at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.rollback(AbstractPropertyConfiguration.java:235)
        at org.jboss.logmanager.config.LogContextConfigurationImpl.doForget(LogContextConfigurationImpl.java:355)
        at org.jboss.logmanager.config.LogContextConfigurationImpl.forget(LogContextConfigurationImpl.java:319)
        at org.jboss.as.logging.logmanager.ConfigurationPersistence.forget(ConfigurationPersistence.java:341)
        at org.jboss.as.logging.logmanager.ConfigurationPersistence.rollback(ConfigurationPersistence.java:349)
        at org.jboss.as.logging.LoggingOperations$CommitOperationStepHandler$1.handleResult(LoggingOperations.java:152)
        at org.jboss.as.controller.AbstractOperationContext$Step.invokeResultHandler(AbstractOperationContext.java:1581)
        at org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1563)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1520)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1493)
        at org.jboss.as.controller.AbstractOperationContext$Step.access$400(AbstractOperationContext.java:1367)
        at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:447)
        at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NullPointerException: overflowAction is null
        at org.jboss.logmanager.handlers.AsyncHandler.setOverflowAction(AsyncHandler.java:117)
        ... 28 more
</code>```

Body:
trying to deploy a Java app with JBoss EAP 7.4.7.GA Image , but getting below error , tried to increase no of threads, and timeout in Java options.

-Xmx2048m -Xms1024m -Dorg.jboss.server.bootstrap.maxThreads=60 -Djboss.as.management.blocking.timeout=600

2022-12-30 00:19:55,850 WARNING retrying as app-sec framework configuration failed with error:
Return Code: 1
StdOut:
Failed to connect to the controller: Timeout waiting for the system to boot.

StdErr:

00:20:07,136 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'add' at address '[
    ("core-service" => "management"),
    ("management-interface" => "http-interface")
]'
Failed to invoke setter setOverflowAction with value null
.java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.lambda$rollback$2(AbstractPropertyConfiguration.java:255)
        at org.jboss.logmanager.config.WrappedAction.execute(WrappedAction.java:61)
        at org.jboss.logmanager.config.AbstractPropertyConfiguration$1.rollback(AbstractPropertyConfiguration.java:235)
        at org.jboss.logmanager.config.LogContextConfigurationImpl.doForget(LogContextConfigurationImpl.java:355)
        at org.jboss.logmanager.config.LogContextConfigurationImpl.forget(LogContextConfigurationImpl.java:319)
        at org.jboss.as.logging.logmanager.ConfigurationPersistence.forget(ConfigurationPersistence.java:341)
        at org.jboss.as.logging.logmanager.ConfigurationPersistence.rollback(ConfigurationPersistence.java:349)
        at org.jboss.as.logging.LoggingOperations$CommitOperationStepHandler$1.handleResult(LoggingOperations.java:152)
        at org.jboss.as.controller.AbstractOperationContext$Step.invokeResultHandler(AbstractOperationContext.java:1581)
        at org.jboss.as.controller.AbstractOperationContext$Step.handleResult(AbstractOperationContext.java:1563)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeInternal(AbstractOperationContext.java:1520)
        at org.jboss.as.controller.AbstractOperationContext$Step.finalizeStep(AbstractOperationContext.java:1493)
        at org.jboss.as.controller.AbstractOperationContext$Step.access$400(AbstractOperationContext.java:1367)
        at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:447)
        at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NullPointerException: overflowAction is null
        at org.jboss.logmanager.handlers.AsyncHandler.setOverflowAction(AsyncHandler.java:117)
        ... 28 more


问:
Scroll bar freezing issue in ASP.NET MVC project
I have an MVC project written with JQuery. There is a modal in this project that opens other pages with an iframe inside. My problem is that when the iframe is closed, I can scroll the page with the mouse wheel or scroll bar. But when the iframe is opened, the page freezes when I try to scroll with the scroll bar. The freezing passes when I scroll with the mouse wheel. What could be the reason?

I have reviewed the code and there is nothing in the JQuery events that could cause this. The library we are using to open the modal is not causing it either, because the dropdown scroll bar can freeze as well. I have suspicions that it could be caused by CSS, but I don't know where to look because there are so many CSS files.


问:
Picker creation in SwiftUI
I am trying to build a custom picker, but I have encountered a problem. I have created cell, EntityType and picker itself. This code suppose to update selectedEntityType and then change the main view. It's not updating the EntityType, therefore not changing view. I don't provide MainView because it's not the problem, it's not updating Entity. Can someone explain what's wrong?</p>
```<code>
import Foundation

enum EntityType: String, Identifiable, CaseIterable {
    case all
    case album
    case song

    var id: String {
        self.rawValue
    }

    func name() -> String {
        switch self {
        case .all:
            return "Stories for falling asleep"
        case .album:
            return "Sounds of nature"
        case .song:
            return "Meditations for sleep"

        }
    }
}

</code>```
```<code>import SwiftUI

struct ReusableNavigationBarCell: View {

    var text: String

    var body: some View {

        Button {

        } label: {

            ZStack {

                Text(text)
                    .padding()
                    .foregroundColor(.white)
                    .background(Rectangle()
                        .fill(Color("active"))
                        .cornerRadius(8)
                        .frame(height: 36))

            }
        }
    }
}

struct ReusableNavigationBarCell_Previews: PreviewProvider {
    static var previews: some View {
        ReusableNavigationBarCell(text: "Stories for falling asleep")

    }
}

</code>```
```<code>import SwiftUI

struct ReusableNavigationBar: View {

    @State var selectedEntityType = EntityType.all

    let rows = Array(repeating: GridItem(.fixed(30), spacing: 0, alignment: .leading), count: 1)

    var body: some View {
        ScrollView(.horizontal, showsIndicators: false) {
            LazyHGrid(rows: rows, spacing: 8) {

                ForEach(EntityType.allCases, id: \.self) { type in
                    ReusableNavigationBarCell(text: type.name())
                        .tag(type)
                        .onTapGesture {
                            selectedEntityType = type
                        }
                }

            }
        }
        .frame(height: 38)
        .padding(.bottom, 10)
        .padding(.horizontal, 10.0)
    }
}

struct ReusableNavigationBar_Previews: PreviewProvider {
    static var previews: some View {
        ReusableNavigationBar()
            .background(.yellow)
    }
}

</code>```

Title: Picker creation in SwiftUI

Body:
I am trying to build a custom picker, but I have encountered a problem. I have created cell, EntityType and picker itself. This code suppose to update selectedEntityType and then change the main view. It's not updating the EntityType, therefore not changing view. I don't provide MainView because it's not the problem, it's not updating Entity. Can someone explain what's wrong?

import Foundation

enum EntityType: String, Identifiable, CaseIterable {
    case all
    case album
    case song

    var id: String {
        self.rawValue
    }

    func name() -> String {
        switch self {
        case .all:
            return "Stories for falling asleep"
        case .album:
            return "Sounds of nature"
        case .song:
            return "Meditations for sleep"

        }
    }
}

import SwiftUI

struct ReusableNavigationBarCell: View {

    var text: String

    var body: some View {

        Button {

        } label: {

            ZStack {

                Text(text)
                    .padding()
                    .foregroundColor(.white)
                    .background(Rectangle()
                        .fill(Color("active"))
                        .cornerRadius(8)
                        .frame(height: 36))

            }
        }
    }
}

struct ReusableNavigationBarCell_Previews: PreviewProvider {
    static var previews: some View {
        ReusableNavigationBarCell(text: "Stories for falling asleep")

    }
}

import SwiftUI

struct ReusableNavigationBar: View {

    @State var selectedEntityType = EntityType.all

    let rows = Array(repeating: GridItem(.fixed(30), spacing: 0, alignment: .leading), count: 1)

    var body: some View {
        ScrollView(.horizontal, showsIndicators: false) {
            LazyHGrid(rows: rows, spacing: 8) {

                ForEach(EntityType.allCases, id: \.self) { type in
                    ReusableNavigationBarCell(text: type.name())
                        .tag(type)
                        .onTapGesture {
                            selectedEntityType = type
                        }
                }

            }
        }
        .frame(height: 38)
        .padding(.bottom, 10)
        .padding(.horizontal, 10.0)
    }
}

struct ReusableNavigationBar_Previews: PreviewProvider {
    static var previews: some View {
        ReusableNavigationBar()
            .background(.yellow)
    }
}


问:
How to create an endpoint using the model trained by Vertex AI?
I trained a model using Google Cloud Vertex AI. I have a dataset containing different videos and model does the video classification of these videos. In the Google Cloud Platform, I can find accuracy of the given videos after model has been trained. However, I could not find a way to create an Endpoint which is required to implement my model to the project.

In other words, I have a model trained by Google Cloud’s Vertex AI and I want to create an Endpoint which accepts a request with video and returns the accuracy according to the trained model. Google Cloud provides a way to do it using Endpoints but as shown below, following
error occurs.
This model cannot be deployed to an Endpoint

I could not find any documents on why this error is given to me. On the other hand, when I download the given model, code requires input type as below with the video;

“RESNETISH_V3: float32 Tensor, shape=(None, 128)”.

I do not know what is this variable type and this is basically where I am stuck. I need help deploying my trained model to any serverless environment, create a code handling posted video and return the accuracy and class of the given video to the request.


问:
What is the best practice to re-use token as Auth to multiple resource servers?
I have a Nextjs app that is using next-auth and I want to enable sign in with Google.

I also have a nodejs server (fastify) that has its own credential authentication and issues JWT. This is the resource server.

The flow with Google auth is like this:

Client authenticate with Auth server (in this case Google)

Client get the token

I should then use this token for a specific endpoint in my resource server that will return a new token from my resource server

The question is at step 3, what is the best practice in this case for my resource server to verify the JWT from google? Is it a good practice to call google token validation API or just try to decode the JWT with public key and verify?

Also, do I need to encrypt the JWT token with private and public key between the NextJS app and my Node app?


问:
How to automatically update the date in cell in one columns when a change is made to a cell in a another column
So basically I have a column in my spreadsheet that tracks the status of bearing conditions. 800+ bearings spread across 8 or so sheets (different areas of a facility) and will continue to increase in the future.

There is a corresponding column that tracks the date that the status last changed.

I have several active x controls and user forms on a dashboard/homepage for the work book that allow the user to make these changes automatically, however I would like to be able to go into the sheets and manually change the status (drop down list) and have the date in corresponding cell change automatically.

I found some code I modified and it appears to work which is good

```<code>    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'Updated by Extendoffice 2017/10/12
    Dim xRg As Range, xCell As Range
    On Error Resume Next
    If (Target.Count = 1) Then
        If (Not Application.Intersect(Target, Me.Range("G5:G80")) Is Nothing) Then _
            Target.Offset(0, 1) = Date
        Application.EnableEvents = False
        Set xRg = Application.Intersect(Target.Dependents, Me.Range("G5:G80"))
        If (Not xRg Is Nothing) Then
            For Each xCell In xRg
                xCell.Offset(0, 1) = Date
            Next
        End If
        Application.EnableEvents = True
    End If
End Sub
</code>```

Having got the code working as I wanted I realised I would like it to to add the date to additional cells in that row but dependent on what the cell is changed to (for example if the cell is change to "Good" also add the current date in a cell offset by 4).

I have modified the code further and it now also adding the date too cells dependent on what the change value was.

```<code>    Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    Dim xRg As Range, xCell As Range
    Dim UpperIndex As Integer
    Dim LowerIndex As Integer
    Dim Rows As Integer

    Set tbl = ThisWorkbook.Worksheets("Route 1").ListObjects("Route_1_Table")
    Rows = tbl.Range.Rows.Count
    UpperIndex = 5
    LowerIndex = Rows - 3

    On Error Resume Next
    If (Target.Count = 1) Then
        If (Not Application.Intersect(Target, Me.Range("G" & UpperIndex & ":G" & LowerIndex)) Is Nothing) Then _
            Target.Offset(0, 1) = Date
            If Target.Value = "Good" Then _
            Target.Offset(0, 5) = Date
            If Target.Value = "Pending Baseline" Then _
            Target.Offset(0, 4) = Date
    End If
End Sub
</code>```

As you can see I removed the last section of the code but I dont know what it did, any ideas?

Body:
So basically I have a column in my spreadsheet that tracks the status of bearing conditions. 800+ bearings spread across 8 or so sheets (different areas of a facility) and will continue to increase in the future.

There is a corresponding column that tracks the date that the status last changed.

I have several active x controls and user forms on a dashboard/homepage for the work book that allow the user to make these changes automatically, however I would like to be able to go into the sheets and manually change the status (drop down list) and have the date in corresponding cell change automatically.

I found some code I modified and it appears to work which is good

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'Updated by Extendoffice 2017/10/12
    Dim xRg As Range, xCell As Range
    On Error Resume Next
    If (Target.Count = 1) Then
        If (Not Application.Intersect(Target, Me.Range("G5:G80")) Is Nothing) Then _
            Target.Offset(0, 1) = Date
        Application.EnableEvents = False
        Set xRg = Application.Intersect(Target.Dependents, Me.Range("G5:G80"))
        If (Not xRg Is Nothing) Then
            For Each xCell In xRg
                xCell.Offset(0, 1) = Date
            Next
        End If
        Application.EnableEvents = True
    End If
End Sub

Having got the code working as I wanted I realised I would like it to to add the date to additional cells in that row but dependent on what the cell is changed to (for example if the cell is change to "Good" also add the current date in a cell offset by 4).

I have modified the code further and it now also adding the date too cells dependent on what the change value was.

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    Dim xRg As Range, xCell As Range
    Dim UpperIndex As Integer
    Dim LowerIndex As Integer
    Dim Rows As Integer

    Set tbl = ThisWorkbook.Worksheets("Route 1").ListObjects("Route_1_Table")
    Rows = tbl.Range.Rows.Count
    UpperIndex = 5
    LowerIndex = Rows - 3

    On Error Resume Next
    If (Target.Count = 1) Then
        If (Not Application.Intersect(Target, Me.Range("G" & UpperIndex & ":G" & LowerIndex)) Is Nothing) Then _
            Target.Offset(0, 1) = Date
            If Target.Value = "Good" Then _
            Target.Offset(0, 5) = Date
            If Target.Value = "Pending Baseline" Then _
            Target.Offset(0, 4) = Date
    End If
End Sub

As you can see I removed the last section of the code but I dont know what it did, any ideas?


问:
How to layer Image Transformer before ConfigMap generator
I have an app that consume a k8s cronjob manifest as a template and I store it as configmap. I want to update the container image in the cronjob template using Kustomize image transformer and generate configmap using Kustomize configmap generator. Here is what I've done:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - cronjob-template-a.yaml
  - cronjob-template-b.yaml
  - cronjob-template-c.yaml

images:
  - name: image/a
    newTag: v1.0.0
  - name: image/b
    newTag: v1.0.0
  - name: image/c
    newTag: v1.0.0

configMapGenerator:
  - name: generated-config-map
    files:
      - cronjob-template-a.yaml
      - cronjob-template-b.yaml
      - cronjob-template-c.yaml
```

When run kustomize build, the generated configmap not updated by the image transformer and the cronjob template is being rendered. How to update the cronjob template container image first before generating the configmap? Also how to prevent the cronjob template being rendered?

Body:
I have an app that consume a k8s cronjob manifest as a template and I store it as configmap. I want to update the container image in the cronjob template using Kustomize image transformer and generate configmap using Kustomize configmap generator. Here is what I've done:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - cronjob-template-a.yaml
  - cronjob-template-b.yaml
  - cronjob-template-c.yaml

images:
  - name: image/a
    newTag: v1.0.0
  - name: image/b
    newTag: v1.0.0
  - name: image/c
    newTag: v1.0.0

configMapGenerator:
  - name: generated-config-map
    files:
      - cronjob-template-a.yaml
      - cronjob-template-b.yaml
      - cronjob-template-c.yaml

When run kustomize build, the generated configmap not updated by the image transformer and the cronjob template is being rendered. How to update the cronjob template container image first before generating the configmap? Also how to prevent the cronjob template being rendered?


问:
How to use AppKit WKWebView in a Mac Catalyst App?
I'm working on a Mac Catalyst App and using a WKWebView there. I found lots of issue in the behaviour of WKWebView like text selection issue, copy paste issue etc.

To check if it is related to WKWebView I created a Mac App project and created a WKWebView there by importing AppKit WebKit and didn't found any issue mentioned above.

So as per my knowledge there is some difference in UIKit -> WebKit -> WKWebView and AppKit -> WebKit -> WKWebView.

How can I use AppKit's WebKit in my UIKit Mac Catalyst App ?


问:
Trying to define a blobfile
I'm trying to define this filename,because the filename always shows an error if I run the code.

Here is my code so far:

```<code>function createDownloadLink(blob) {

    var url = URL.createObjectURL(blob);
    var au = document.createElement('audio');
    var li = document.createElement('li');
    var link = document.createElement('a');

    //name of .wav file to use during upload and download (without extendion)
    var filename = new Date().toISOString();

    //add controls to the <audio> element
    au.controls = true;
    au.src = url;

    //save to disk link
    link.href = url;
    link.download = filename+".wav"; //download forces the browser to donwload the file using the  filename
    link.innerHTML = "Download to Local";

    //add the new audio element to li
    li.appendChild(au);

    //add the filename to the li
    li.appendChild(document.createTextNode(filename+".wav "))

    //add the save to disk link to li
    li.appendChild(link);

    //upload link
    var upload = document.createElement('a');
    upload.href="#";
    upload.innerHTML = "Upload";
    upload.addEventListener("click", function(event){
         uploadRecordedFile(blob,filename);
    })
    li.appendChild(document.createTextNode (" "))//add a space in between
    //li.appendChild(upload)//add the upload link to li

    //add the li element to the ol
    recordingsList.appendChild(li);

    uploadRecordedFile(blobfilename);
}
</code>```

The uploadRecordedFile(blobfilename) is not define

I'm designing a recorder where if you click the stop button,the recording would save as a json file.

Title: Trying to define a blobfile

Body:
I'm trying to define this filename,because the filename always shows an error if I run the code.

Here is my code so far:

function createDownloadLink(blob) {

    var url = URL.createObjectURL(blob);
    var au = document.createElement('audio');
    var li = document.createElement('li');
    var link = document.createElement('a');

    //name of .wav file to use during upload and download (without extendion)
    var filename = new Date().toISOString();

    //add controls to the <audio> element
    au.controls = true;
    au.src = url;

    //save to disk link
    link.href = url;
    link.download = filename+".wav"; //download forces the browser to donwload the file using the  filename
    link.innerHTML = "Download to Local";

    //add the new audio element to li
    li.appendChild(au);

    //add the filename to the li
    li.appendChild(document.createTextNode(filename+".wav "))

    //add the save to disk link to li
    li.appendChild(link);

    //upload link
    var upload = document.createElement('a');
    upload.href="#";
    upload.innerHTML = "Upload";
    upload.addEventListener("click", function(event){
         uploadRecordedFile(blob,filename);
    })
    li.appendChild(document.createTextNode (" "))//add a space in between
    //li.appendChild(upload)//add the upload link to li

    //add the li element to the ol
    recordingsList.appendChild(li);

    uploadRecordedFile(blobfilename);
}

The uploadRecordedFile(blobfilename) is not define

I'm designing a recorder where if you click the stop button,the recording would save as a json file.


问:
how to upload a pdf in to localfolder and send via email in codeigniter
unable to upload a pdf file to my local folder using codeigniter

I have tried every possible ways to upload a PDF file but i have failed to upload it.The ultimate use of uploading file is to send the attachment along with the mail ,I am getting all other data inside the mail except the PDF.

```<code>public function resume_send(){

    $img = $this->input->post('resume');
    $config['upload_path'] = './uploads/';
         $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
         $config['max_size'] = '1000';
         $config['max_width'] = '1024';
         $config['max_height'] = '768';
         $config['encrypt_name'] = TRUE;
         $this->load->library('upload', $config);
       // $this->upload->do_upload('resume'); exit;
             if($_POST || $_FILES){
            if(!$this->upload->do_upload('resume')){

                    echo $this->upload->display_errors('<p>', '</p>');
                      } else {

                     $w = $this->upload->data();
                     $data = array(
                         'resume' => $w['file_name'],
                         );
                 }
             }
}
</code>```

my view page is like

```<code><div class="col-6 col-md-6">
              <i>Upload Resume</i>
              <input style="margin-bottom: 0 !important;padding: 0 !important;margin-top: 15px !important;" type="file" name="resume"  required>
           </div>
</code>```

the file i wish to save in upload  folder or without saving also i should get this attachment via email.Any help would be appreciated

folder structure

Body:
unable to upload a pdf file to my local folder using codeigniter

I have tried every possible ways to upload a PDF file but i have failed to upload it.The ultimate use of uploading file is to send the attachment along with the mail ,I am getting all other data inside the mail except the PDF.

public function resume_send(){

    $img = $this->input->post('resume');
    $config['upload_path'] = './uploads/';
         $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
         $config['max_size'] = '1000';
         $config['max_width'] = '1024';
         $config['max_height'] = '768';
         $config['encrypt_name'] = TRUE;
         $this->load->library('upload', $config);
       // $this->upload->do_upload('resume'); exit;
             if($_POST || $_FILES){
            if(!$this->upload->do_upload('resume')){

                    echo $this->upload->display_errors('
', '
');
                      } else {

                     $w = $this->upload->data();
                     $data = array(
                         'resume' => $w['file_name'],
                         );
                 }
             }
}

my view page is like

              Upload Resume
              <input style="margin-bottom: 0 !important;padding: 0 !important;margin-top: 15px !important;" type="file" name="resume"  required>

the file i wish to save in upload  folder or without saving also i should get this attachment via email.Any help would be appreciated

folder structure


问:
How to convert 'time' input to 24hr format in Android WebView?
Trying to create an android app to host a local html file, which contain input of type 'time', with the help of WebView component. By default, it is displayed in 12hr format.

Tried setting max attribute of the input to '23:59'. Also changed the system time format of phone to 24hr. No change! Also could not find any method in WebSettings class of android.

MainActivity.java

package com.zinco.poolmanager3;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.JavascriptInterface;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements  KeyEvent.Callback {

    WebView myWebView;
    WebSettings webSettings;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myWebView = (WebView) findViewById(R.id.webview);
        myWebView.setWebViewClient(new MyWebViewClient());
        webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setAllowFileAccess(true);
        webSettings.setDomStorageEnabled(true);
        myWebView.addJavascriptInterface(new WebAppInterface(this), "Android");
        myWebView.loadUrl("file:///android_asset/index.html");
    }

    /** Class to override loading of web page in default browser */
    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
            Log.i("[WebClient]:", String.format("%s %s", request.getUrl().getHost(), request.getUrl().getScheme()));
            if ("file".equals(request.getUrl().getScheme())) {
                // This is my website, so do not override; let my WebView load the page
                return false;
            }
            // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
            Intent intent = new Intent(Intent.ACTION_VIEW, request.getUrl());
            startActivity(intent);
            return true;
        }
    }

    /** Class to interface webView javascript to native android api */
    public class WebAppInterface {
        Context mContext;

        /** Instantiate the interface and set the context */
        WebAppInterface(Context c) {
            mContext = c;
        }

        /** Show a toast from the web page */
        /** Access the method in js a <Android.showToast('msg')> */
        @JavascriptInterface
        public void showToast(String toast) {
            Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
        }
    }

    /** Interface to navigate webpage on key press */
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Check if the key event was the Back button and if there's history
        if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
            myWebView.goBack();
            return true;
        }
        // If it wasn't the Back key or there's no web page history, bubble up to the default
        // system behavior (probably exit the activity)
        return super.onKeyDown(keyCode, event);
    }
}
```
<h1>activity_main.xml</h1>
```<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>
```
<h1>index.html</h1>
<pre class="lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
    <title>PoolManager3 - Settings</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <style>

    html {
        background: linear-gradient(180deg, #00388e, #888afb, #fff);
        background-attachment: fixed;
        background-repeat: no-repeat
    }
        /* Style the tab */
        .tab {
            overflow: hidden;
            border: 1px solid #ccc;
            background-color: #f1f1f1;
        }

        /* Style the buttons that are used to open the tab content */
        .tab button {
            background-color: inherit;
            float: left;
            border: none;
            outline: none;
            cursor: pointer;
            padding: 14px 16px;
            transition: 0.3s;
        }

        /* Change background color of buttons on hover */
        .tab button:hover {
            background-color: #ddd;
        }

        /* Create an active/current tablink class */
        .tab button.active {
            background-color: #ccc;
        }

        /* Style the tab content */
        .tabcontent {
            display: none;
            padding: 6px 12px;
            border: 1px solid #ccc;
            border-top: none;
        }
    </style>

    <style>
        .action-btn {
            font-size: 18px;
            background-color: #fff;
            color: #1e8bff;
            border: 2px solid;
            border-radius: 15px;
            height: 30px;
            padding: 2px 10px;
            float: right;
            margin: 1px 10px;
        }
        .action-input {
            background: none;
            border: none;
            border-bottom: 1px solid blue;
        }
        .action-input:focus,
        .action-input:focus-visible {
            outline: none;
            border-bottom-width: 2px !important;
        }

        /* Auto tab */
        #auto-device-container .list {
            padding: 10px;
            background: linear-gradient(90deg, #0544a6 , #2178ff);
            margin-top: 5px;
        }
        #auto-device-container .list:active {
            background: linear-gradient(90deg, #0544a6 70%, #2178ff) !important;
        }
        #device-profile {
            position: absolute;
            top: 76px;
            left: 0;
            right: 0;
            margin: 0 20px;
            background-color: #7f8dfbf0;
            padding: 10px;
            min-height: 300px;
        }
        #device-profile .device-start-time,
        #device-profile .device-stop-time {
            max-width: 100px;
            height: 30px;
        }

        /* Manual tab */
        #manual input[type="time"] {
            height: 30px;
        }
        #manual input[type="checkbox"] {
            height: 25px;
            width: 25px;
        }
    </style>
</head>

<body>
<!-- Tab links -->
<div class="tab">
    <button class="tablinks" onclick="openTab(event, 'manual')">Manual<br>Mode</button>
    <button class="tablinks" onclick="openTab(event, 'auto')">Auto<br>Mode</button>
    <button class="tablinks" onclick="openTab(event, 'e-ocr')">E-OCR<br>Limit</button>
    <button class="tablinks" onclick="openTab(event, 'wifi')">Wi-Fi<br>Settings</button>
</div>

<!-- Tab content -->
<div id="manual" class="tabcontent">
    <table>
        <tr>
            <th>Devices</th>
            <th>Event</th>
            <th>Time[Hrs.]</th>
        </tr>
        <tr device-id="pump1">
            <td>Pump 1</td>
            <td><input type="checkbox" disabled></td>
            <td><input type="time" onchange="validateEvent(this);"></td>
        </tr>
        <tr device-id="pump2">
            <td>Pump 2</td>
            <td><input type="checkbox" disabled></td>
            <td><input type="time" onchange="validateEvent(this);"></td>
        </tr>
        <tr device-id="doz">
            <td>Dosing</td>
            <td><input type="checkbox" disabled></td>
            <td><input type="time" onchange="validateEvent(this);"></td>
        </tr>
        <tr device-id="light">
            <td>Pool Lights</td>
            <td><input type="checkbox" disabled></td>
            <td><input type="time" onchange="validateEvent(this);"></td>
        </tr>
        <tr device-id="aux1">
            <td>Aux. Load 1</td>
            <td><input type="checkbox" disabled></td>
            <td><input type="time" onchange="validateEvent(this);"></td>
        </tr>
        <tr device-id="aux2">
            <td>Aux. Load 2</td>
            <td><input type="checkbox" disabled></td>
            <td><input type="time" onchange="validateEvent(this);" min="00:00" max="23:59"></td>
        </tr>
    </table>

    <div style="position: absolute; bottom: 20px; left: 0; right: 0;">
        <button id="manual-home" class="action-btn">HOME</button>
        <button id="manual-update" class="action-btn">UPDATE</button>
    </div>
</div>

<div id="auto" class="tabcontent">
    <h2>Pool Devices</h2>
    <div id="auto-device-container">
        <div class="list" group-id="pump">Pump</div>
        <div class="list" group-id="doz">Dosing Pump</div>
        <div class="list" group-id="light">Pool Lights</div>
        <div class="list" group-id="aux1">Aux. Load 1</div>
        <div class="list" group-id="aux2">Aux. Load 2</div>
    </div>
    <div id="device-profile" tabindex="0" style="display: none;">
        <h2 id="device-name">Pump</h2>
        <span onclick="closeDeviceProfile()" style="position: absolute;
                top: 10px; right: 10px; font-size: 24px;">X</span>
        <table>
            <tr>
                <th>Schedule</th>
                <th>Start</th>
                <th>Stop</th>
            </tr>
            <tr>
                <td>1</td>
                <td><input type="time" class="device-start-time" min="00:00" max="23:59"></td>
                <td><input type="time" class="device-stop-time" min="00:00" max="23:59"></td>
            </tr>
            <tr>
                <td>2</td>
                <td><input type="time" class="device-start-time" min="00:00" max="23:59"></td>
                <td><input type="time" class="device-stop-time" min="00:00" max="23:59"></td>
            </tr>
            <tr>
                <td>3</td>
                <td><input type="time" class="device-start-time" min="00:00" max="23:59"></td>
                <td><input type="time" class="device-stop-time" min="00:00" max="23:59"></td>
            </tr>
            <tr>
                <td>4</td>
                <td><input type="time" class="device-start-time" min="00:00" max="23:59"></td>
                <td><input type="time" class="device-stop-time" min="00:00" max="23:59"></td>
            </tr>
        </table>
        <div style="position: relative; top: 15px; /*bottom: 20px; left: 0; right: 0;*/">
            <button id="auto-home" class="action-btn">HOME</button>
            <button id="auto-update" class="action-btn">UPDATE</button>
        </div>
    </div>
</div>

<div id="e-ocr" class="tabcontent">
    <h3>E-OCR Limit</h3>
    <p>Under construction.</p>
</div>

<div id="wifi" class="tabcontent">
    <div>
        <table style="border-spacing: 0 30px;">
            <tr>
                <td>SSID</td>
                <td>:</td>
                <td id="ssid"><input type="text" class="action-input" maxlength="25"></td>
            </tr>

            <tr>
                <td>SSID Pwd</td>
                <td>:</td>
                <td id="psw"><input type="password" class="action-input" maxlength="25"></td>
            </tr>
        </table>
    </div>
    <div style="position: absolute; bottom: 20px; left: 0; right: 0;">
        <button id="wifi-reset" class="action-btn">RESET</button>
        <button id="wifi-update" class="action-btn">UPDATE</button>
    </div>
</div>

<script>
        // Utility funcions
        function validateEvent(timeInput) {
            if (!timeInput) return;
            const eventCheckBox = timeInput.parentElement.parentElement.querySelector('td input[type="checkbox"]');
            if (!eventCheckBox) return;
            if (!timeInput.value) {
                eventCheckBox.checked = false;
                eventCheckBox.disabled = true;
                return;
            }
            eventCheckBox.disabled = false;
        }

        // Function to process schedule data as required before sending to PoolManager (esp)
        function processDataForESP(data, mode) {
            mode = mode || 'manual';
            if (mode == 'manual') {
                Object.keys(data).forEach((device) => {
                    data[device].time = data[device].time || "00:00";
                });
            }
            return data;
        }
    </script>

<script>
        // Auto tab
        const labelDeviceName = document.querySelector('#device-name');
        const deviceLists = document.querySelectorAll('#auto-device-container .list');
        const deviceProfilePanel = document.querySelector('#device-profile');
        const autoUpdateButton = document.querySelector('#auto-update');
        let autoSchedules = localStorage.getItem('autoSchedules') || {};
        try {
            autoSchedules = JSON.parse(autoSchedules);
        } catch {
            autoSchedules = {};
        }

        Array.from(deviceLists).forEach((listItem) => {
            listItem.onclick = () => {
                device = listItem.innerHTML;
                groupId = listItem.getAttribute('group-id');
                labelDeviceName.innerHTML = device;
                deviceProfilePanel.setAttribute('group-id', groupId);
                const deviceProfileRows = Array.from(deviceProfilePanel.querySelectorAll('table tr:not(:first-child)'));
                const schedules = autoSchedules[groupId] || [];
                deviceProfileRows.forEach((row, index) => {
                    const inputs = row.querySelectorAll('input[type="time"]')
                    inputs[0].value = (schedules[index] || {}).start;
                    inputs[1].value = (schedules[index] || {}).stop;
                });
                openDeviceProfile(groupId);
                // deviceProfilePanel.style.display = "block";
                // deviceProfilePanel.focus();
            }
        });

        deviceProfilePanel.addEventListener('keydown', (event) => {
            if (event.key === 'Escape') closeDeviceProfile(); // deviceProfilePanel.style.display = 'none';
        });

        autoUpdateButton.addEventListener('click', () => {
            const deviceName = labelDeviceName.innerHTML;
            const groupId = deviceProfilePanel.getAttribute('group-id');
            const deviceProfileRows = Array.from(deviceProfilePanel.querySelectorAll('table tr:not(:first-child)'));
            const schedules = [];
            deviceProfileRows.forEach((row) => {
                const inputs = row.querySelectorAll('input[type="time"]')
                const startTime = inputs[0].value;
                const stopTime = inputs[1].value;
                if (startTime && stopTime) {
                    schedules.push({start: startTime, stop: stopTime});
                }
            });
            console.log("[SCHEDULES]:", schedules)

            autoSchedules[groupId] = schedules;
            localStorage.setItem('autoSchedules', JSON.stringify(autoSchedules))
            // deviceProfilePanel.style.display = 'none';
            closeDeviceProfile();
            try {
                const groupId = deviceProfilePanel.getAttribute('group-id');
                const groupSpecificSchedule = {[groupId]: autoSchedules[groupId] || {}}
                Android.wsSend(JSON.stringify(groupSpecificSchedule));
                console.log(JSON.stringify(autoSchedules));
                window.top.postMessage({function: 'popBlockingMessage',
                    parameters: ['Waiting', 'Please acknowledge from the device']}, '*');
                setTimeout(() => window.top.postMessage({function: 'dismissBlockingMessage'}, '*'), 5000);
            } catch { console.log(autoSchedules); }
        });

        function openDeviceProfile(groupId) {
            deviceProfilePanel.style.display = "block";
            deviceProfilePanel.focus();
            try { Android.wsSend('auto-' + groupId); }
            catch { console.log('[SCREEN]:', 'auto-' + groupId) }
        }

        function closeDeviceProfile() {
            deviceProfilePanel.style.display = "none";
            try { Android.wsSend('auto'); }
            catch { console.log('[SCREEN]:', 'auto') }
        }

        // Manual tab
        const manualUpdateButton = document.querySelector('#manual-update');
        let manualSchedules = localStorage.getItem('manualSchedules') || {};
        const deviceRows = Array.from(document.querySelectorAll('#manual table tr:not(:first-child)'));
        try {
            manualSchedules = JSON.parse(manualSchedules);
        } catch {
            manualSchedules = {};
        }

        deviceRows.forEach((row) => {
            const deviceId = row.getAttribute('device-id');
            const input = row.querySelector('input[type="time"]');
            const event = row.querySelector('input[type="checkbox"]');
            const schedule = manualSchedules[deviceId] || {}
            input.value = schedule.time;
            event.checked = schedule.event || false;
            input.dispatchEvent(new Event('change'));
        });

        manualUpdateButton.addEventListener('click', () => {
            const schedules = {};
            deviceRows.forEach((row) => {
                const deviceId = row.getAttribute('device-id');
                const input = row.querySelector('input[type="time"]');
                const event = row.querySelector('input[type="checkbox"]');
                schedules[deviceId] = {'time': input.value, 'event': !event.disabled && event.checked};
            });
            manualSchedules = schedules;
            localStorage.setItem('manualSchedules', JSON.stringify(manualSchedules));
            try {
                Android.wsSend(JSON.stringify(processDataForESP(manualSchedules)));
                console.log(JSON.stringify(manualSchedules));
                window.top.postMessage({function: 'popBlockingMessage',
                    parameters: ['Waiting', 'Please acknowledge from the device']}, '*');
                setTimeout(() => window.top.postMessage({function: 'dismissBlockingMessage'}, '*'), 2000);
            } catch { console.log(manualSchedules); }
        });

        // Wifi tab
        document.querySelector('#wifi-reset').onclick = () => {

        }
    </script>

<script>
        window.addEventListener('message', (event) => {
            console.log(event.data);
        });
    </script>

<script>
        function openTab(evt, tabName) {
            // Declare all variables
            var i, tabcontent, tablinks;

            // Get all elements with class="tabcontent" and hide them
            tabcontent = document.getElementsByClassName("tabcontent");
            for (i = 0; i < tabcontent.length; i++) {
                tabcontent[i].style.display = "none";
            }

            // Get all elements with class="tablinks" and remove the class "active"
            tablinks = document.getElementsByClassName("tablinks");
            for (i = 0; i < tablinks.length; i++) {
                tablinks[i].className = tablinks[i].className.replace(" active", "");
            }

            // Show the current tab, and add an "active" class to the button that opened the tab
            document.getElementById(tabName).style.display = "block";
            evt.currentTarget.className += " active";

            // inform Pool Manager (esp) about which screen app is on
            try { Android.wsSend(tabName) } catch { console.log('[SCREEN]:', tabName) }
        }

        document.querySelector('.tablinks').click()
    </script>
</body>
</html>
</code>```

Android project structure

App screenshot

Body:
Trying to create an android app to host a local html file, which contain input of type 'time', with the help of WebView component. By default, it is displayed in 12hr format.

Tried setting max attribute of the input to '23:59'. Also changed the system time format of phone to 24hr. No change! Also could not find any method in WebSettings class of android.

MainActivity.java

package com.zinco.poolmanager3;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.JavascriptInterface;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements  KeyEvent.Callback {

    WebView myWebView;
    WebSettings webSettings;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myWebView = (WebView) findViewById(R.id.webview);
        myWebView.setWebViewClient(new MyWebViewClient());
        webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setAllowFileAccess(true);
        webSettings.setDomStorageEnabled(true);
        myWebView.addJavascriptInterface(new WebAppInterface(this), "Android");
        myWebView.loadUrl("file:///android_asset/index.html");
    }

    /** Class to override loading of web page in default browser */
    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
            Log.i("[WebClient]:", String.format("%s %s", request.getUrl().getHost(), request.getUrl().getScheme()));
            if ("file".equals(request.getUrl().getScheme())) {
                // This is my website, so do not override; let my WebView load the page
                return false;
            }
            // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
            Intent intent = new Intent(Intent.ACTION_VIEW, request.getUrl());
            startActivity(intent);
            return true;
        }
    }

    /** Class to interface webView javascript to native android api */
    public class WebAppInterface {
        Context mContext;

        /** Instantiate the interface and set the context */
        WebAppInterface(Context c) {
            mContext = c;
        }

        /** Show a toast from the web page */
        /** Access the method in js a <Android.showToast('msg')> */
        @JavascriptInterface
        public void showToast(String toast) {
            Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
        }
    }

    /** Interface to navigate webpage on key press */
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Check if the key event was the Back button and if there's history
        if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
            myWebView.goBack();
            return true;
        }
        // If it wasn't the Back key or there's no web page history, bubble up to the default
        // system behavior (probably exit the activity)
        return super.onKeyDown(keyCode, event);
    }
}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

index.html

<!DOCTYPE html>

    <title>PoolManager3 - Settings</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <button class="tablinks" onclick="openTab(event, 'manual')">Manual
Mode</button>
    <button class="tablinks" onclick="openTab(event, 'auto')">Auto
Mode</button>
    <button class="tablinks" onclick="openTab(event, 'e-ocr')">E-OCR
Limit</button>
    <button class="tablinks" onclick="openTab(event, 'wifi')">Wi-Fi
Settings</button>

            Devices
            Event
            Time[Hrs.]

            Pump 1
            <input type="checkbox" disabled>
            <input type="time" onchange="validateEvent(this);">

            Pump 2
            <input type="checkbox" disabled>
            <input type="time" onchange="validateEvent(this);">

            Dosing
            <input type="checkbox" disabled>
            <input type="time" onchange="validateEvent(this);">

            Pool Lights
            <input type="checkbox" disabled>
            <input type="time" onchange="validateEvent(this);">

            Aux. Load 1
            <input type="checkbox" disabled>
            <input type="time" onchange="validateEvent(this);">

            Aux. Load 2
            <input type="checkbox" disabled>
            <input type="time" onchange="validateEvent(this);" min="00:00" max="23:59">

        <button id="manual-home" class="action-btn">HOME</button>
        <button id="manual-update" class="action-btn">UPDATE</button>

Pool Devices

Pump

Dosing Pump

Pool Lights

Aux. Load 1

Aux. Load 2

Pump

        X

                Schedule
                Start
                Stop

                1
                <input type="time" class="device-start-time" min="00:00" max="23:59">
                <input type="time" class="device-stop-time" min="00:00" max="23:59">

                2
                <input type="time" class="device-start-time" min="00:00" max="23:59">
                <input type="time" class="device-stop-time" min="00:00" max="23:59">

                3
                <input type="time" class="device-start-time" min="00:00" max="23:59">
                <input type="time" class="device-stop-time" min="00:00" max="23:59">

                4
                <input type="time" class="device-start-time" min="00:00" max="23:59">
                <input type="time" class="device-stop-time" min="00:00" max="23:59">

            <button id="auto-home" class="action-btn">HOME</button>
            <button id="auto-update" class="action-btn">UPDATE</button>

E-OCR Limit

Under construction.

                SSID
                :
                <input type="text" class="action-input" maxlength="25">

                SSID Pwd
                :
                <input type="password" class="action-input" maxlength="25">

        <button id="wifi-reset" class="action-btn">RESET</button>
        <button id="wifi-update" class="action-btn">UPDATE</button>

Android project structure

App screenshot


问:
Why does the address come out false when using hashcode in Java?
```<code>public static class test2 {

    String name;
    int age;

    public test2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        test2 test1 = (test2) o;
        return age == test1.age && Objects.equals(name, test1.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

}
</code>```
```<code>test2 test5 = new test2("hello", 222);
test2 test6 = new test2("hello", 222);

System.out.println(test5);
System.out.println(test6);

System.out.println(test5.hashCode());
System.out.println(test6.hashCode());

System.out.println(test5.equals(test6));
System.out.println(test5 == test6);
</code>```

Result

Main$test2@38db4c11
Main$test2@38db4c11
953895953
953895953
true
false \<------------ why?
```

I was expecting true, but for ==, why do I get false when comparing?

Body:
public static class test2 {

    String name;
    int age;

    public test2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        test2 test1 = (test2) o;
        return age == test1.age && Objects.equals(name, test1.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

}

test2 test5 = new test2("hello", 222);
test2 test6 = new test2("hello", 222);

System.out.println(test5);
System.out.println(test6);

System.out.println(test5.hashCode());
System.out.println(test6.hashCode());

System.out.println(test5.equals(test6));
System.out.println(test5 == test6);

Result

Main$test2@38db4c11
Main$test2@38db4c11
953895953
953895953
true
false \<------------ why?

I was expecting true, but for ==, why do I get false when comparing?


问:
Passing Context Processors as parameters in decorator call in django
Is there a way that I can access a context processor value and pass it as parameters to a decorator. Or can I pass request object as parameter to this decorator call.

For example like this:

```<code>@method_decorator(csp_replace(FRAME_ANCESTORS=[context_processor]),name="dispatch")
</code>```

Body:
Is there a way that I can access a context processor value and pass it as parameters to a decorator. Or can I pass request object as parameter to this decorator call.

For example like this:

@method_decorator(csp_replace(FRAME_ANCESTORS=[context_processor]),name="dispatch")


问:
flutter app not loading properly after releasing
VS Code Build Output.:

App Output without problem:

App after some time:

this happens when I close and open app for 2 or 3 times:

If anybody can solve this problem please help me.


问:
Fresh installation of postgres sql asks for password and Fails
Ive been trying to install postgresql (postgresql@11 ) through brew , it does get installed , but when i do psql in the terminal to enter postgres prompt I'm hit with a password field , and I don't know what password it requires ( I've tried any and all passwords ).

Ive tried the following :

psql -U root

psql -U postgres

psql -U my-username

all the above always ask for a password and simply give this error

FATAL:  password authentication failed for user <given-name>

I've also tried to install manually where i am hit with the same thing

Ive also ran initDb command with a Data directory specified

The env variables are also set like so in my ~/.zprofile ( visible in $PATH)

export PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt$ export PATH="/opt/homebrew/opt/postgresql@11/bin:$PATH"

Im using a Macbook Pro with MacOs Monterney 12.6.1 ( Mac M1 chip )

Its been a big headache for the past hour and any help would be greatly appreciated

If a fresh install is the crct solution please do mention how to uninstall and properly install postgres ( Ive done it quite a few time for now , but still think i might be missing something trivial )


问:
IIS Access another file of another server denied
I use C# to have a IIS on server A. And the part of code is to get data from another server B (get fiel from \serverB\C$\folder\file.txt). I have already granted the full controll to everyone and serverA$. However the IIS write a log that "Exception: Access to the path '\serverB\C$\folder\file.txt' is denied. ".</p>


问:
MongoDB + Hapi JS + Role Based Access Control (RBAC)
Am currently learning  HapiJs development, developing an Interview Process (i.e. HRM), and want to implement Role Based Access Control (RBAC) for that. How do I set up roles & permission on MongoDB?

I want 3 roles  :

ADMIN

MANAGER

USER

ADMIN- similar to Manager, can do anything in the application. C, R, U, D permissions for the Interview Process and other users too. Can Create an Interview Process & assign them to any MANAGER or USER directly. Update or Delete either an Interview Process or a User at any time.

MANAGER - similar to Admin, has the power to do anything on his Data - C,R,U,D for the Interview Process. Can create any USER. Can only Read & add comments for Interview Processes created by ADMIN &  assigned to him/her.

USER - Can only Read and add comments to the Interview Process assigned to him/her.

To sum it up :

```<code>ADMIN - C, R, U, D [Global Level]
MANAGER - C, R, U, D [Private] + R, U [Assigned to him]
USER - R, U [Assigned to him]
</code>```

I understand that I need to have USERS & ROLES collections. Where ROLES in turn should have PERMISSIONS etc. How do I wire them all?

Body:
Am currently learning  HapiJs development, developing an Interview Process (i.e. HRM), and want to implement Role Based Access Control (RBAC) for that. How do I set up roles & permission on MongoDB?

I want 3 roles  :

ADMIN

MANAGER

USER

ADMIN- similar to Manager, can do anything in the application. C, R, U, D permissions for the Interview Process and other users too. Can Create an Interview Process & assign them to any MANAGER or USER directly. Update or Delete either an Interview Process or a User at any time.

MANAGER - similar to Admin, has the power to do anything on his Data - C,R,U,D for the Interview Process. Can create any USER. Can only Read & add comments for Interview Processes created by ADMIN &  assigned to him/her.

USER - Can only Read and add comments to the Interview Process assigned to him/her.

To sum it up :

ADMIN - C, R, U, D [Global Level]
MANAGER - C, R, U, D [Private] + R, U [Assigned to him]
USER - R, U [Assigned to him]

I understand that I need to have USERS & ROLES collections. Where ROLES in turn should have PERMISSIONS etc. How do I wire them all?