问:
descriptor '_get_current_object' for 'LocalProxy' objects doesn't apply to a 'LocalProxy' object
I am trying to build a database using flask-sqlalchemy. I am pretty new to sql database development and so I tried a basic example that I found on the documentation website see implementation below. I am running this on a mac with the following packages installed:

flask == 2.2.2,
flask_sqlalchemy == 3.0.2

When I run db.create_all() I get the following error: descriptor '_get_current_object' for 'LocalProxy' objects doesn't apply to a 'LocalProxy' object

Does anyone know an easy fix, thanks really appreciate it!

```<code>from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///users.sqlite3"

db = SQLAlchemy(app)

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String, unique=True, nullable=False)
    email = db.Column(db.String)

db.create_all()
</code>```

I searched stack and github to see if it was a known problem. I am having trouble finding resources to fix it. I also tried installing an earlier version of flask... issue did not resolve.

Body:
I am trying to build a database using flask-sqlalchemy. I am pretty new to sql database development and so I tried a basic example that I found on the documentation website see implementation below. I am running this on a mac with the following packages installed:

flask == 2.2.2,
flask_sqlalchemy == 3.0.2

When I run db.create_all() I get the following error: descriptor '_get_current_object' for 'LocalProxy' objects doesn't apply to a 'LocalProxy' object

Does anyone know an easy fix, thanks really appreciate it!

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///users.sqlite3"

db = SQLAlchemy(app)

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String, unique=True, nullable=False)
    email = db.Column(db.String)

db.create_all()

I searched stack and github to see if it was a known problem. I am having trouble finding resources to fix it. I also tried installing an earlier version of flask... issue did not resolve.


来源: stackexchange

问:
How to show popover on the empty input on the submit?
NOTE: I googled it before asking a question in here.

I am checking the input before submitting the form using javascript, I want to show a popover on the top of the input if the value of input is empty for the purpose that the user might miss the empty required fields. I am using Javascript because there is no way I could show the popover in the code behind of webforms.

Now, I tried this solution I found here in stackoverflow jquery show popover if input's value is empty to my code. and it does not do anything and no error on the console.

Here is my code:

```<code>                const inputs = document.querySelectorAll('input');

                const requiredFields = Array.from(inputs).filter(input => input.required);

                var counter = 0;
                var isValid = false;

                for (let i = 0; i <= requiredFields.length - 1; i++) {
                    //skip if the field is disabled
                    if (!requiredFields[i].disabled) {
                        //check the field if required (the input field should be set to `required`)
                        if (requiredFields[i].required) {
                            //check if the value is not null
                            if (requiredFields[i].value === '') {

                                //Show popover
                                requiredFields[i].popover({
                                    title: 'Warning!',
                                    content: 'Value can not be empty',
                                    placement: 'bottom'
                                }).popover('show');

                                isValid = false;
                                break;
                            }
                        }
                    }
                    counter += 1;
                }
</code>```

How can I possibly trigger the popover when the input value is empty? Can someone lead me to correct way to solve this?

Regards,

ContentLicense: CC BY-SA 4.0

Body:
NOTE: I googled it before asking a question in here.

I am checking the input before submitting the form using javascript, I want to show a popover on the top of the input if the value of input is empty for the purpose that the user might miss the empty required fields. I am using Javascript because there is no way I could show the popover in the code behind of webforms.

Now, I tried this solution I found here in stackoverflow jquery show popover if input's value is empty to my code. and it does not do anything and no error on the console.

Here is my code:

                const inputs = document.querySelectorAll('input');

                const requiredFields = Array.from(inputs).filter(input => input.required);

                var counter = 0;
                var isValid = false;

                for (let i = 0; i <= requiredFields.length - 1; i++) {
                    //skip if the field is disabled
                    if (!requiredFields[i].disabled) {
                        //check the field if required (the input field should be set to `required`)
                        if (requiredFields[i].required) {
                            //check if the value is not null
                            if (requiredFields[i].value === '') {

                                //Show popover
                                requiredFields[i].popover({
                                    title: 'Warning!',
                                    content: 'Value can not be empty',
                                    placement: 'bottom'
                                }).popover('show');

                                isValid = false;
                                break;
                            }
                        }
                    }
                    counter += 1;
                }

How can I possibly trigger the popover when the input value is empty? Can someone lead me to correct way to solve this?

Regards,


问:
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl)
same question, but exec gradlew clean assemble in terminal still throw error.

```<code>java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl)
        at com.sun.tools.javac.util.Assert.error(Assert.java:133)
        at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1042)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
        at com.sun.tools.javac.code.TypeAnnotations$1.run(TypeAnnotations.java:127)
        at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:152)
        at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
        at com.sun.tools.javac.comp.Enter.complete(Enter.java:512)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
        at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
        at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:83)
        at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:31)
        at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:47)
        ... 25 more
</code>```

My environment:

compileSdkVersion 31

classpath "com.android.tools.build:gradle:4.0.1"

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"

distributionUrl=gradle-6.1.1-all.zip

Gradle JDK:Android Studio default JDK(version 11.0.10)

Android Studio: Arctic Fox | 2020.3.1 Patch 2

Any advise? Thanks in advance.

Body:
same question, but exec gradlew clean assemble in terminal still throw error.

java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl)
        at com.sun.tools.javac.util.Assert.error(Assert.java:133)
        at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1066)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1042)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:275)
        at com.sun.tools.javac.code.TypeAnnotations$1.run(TypeAnnotations.java:127)
        at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:152)
        at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
        at com.sun.tools.javac.comp.Enter.complete(Enter.java:512)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
        at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
        at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:83)
        at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:31)
        at org.jetbrains.kotlin.kapt3.base.Kapt.kapt(Kapt.kt:47)
        ... 25 more

My environment:

compileSdkVersion 31

classpath "com.android.tools.build:gradle:4.0.1"

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"

distributionUrl=gradle-6.1.1-all.zip

Gradle JDK:Android Studio default JDK(version 11.0.10)

Android Studio: Arctic Fox | 2020.3.1 Patch 2

Any advise? Thanks in advance.


问:
Azure Durable Functions, Cannot access entity state from activity
While using Azure Durable functions and attempting to learn it I have created an orchestrator that is going to read a state of an entity, and then call other activities to perform other logic after. Pretty straightforward I thought.

Inside the orchestrator, it can read and see the entity. everything works fine. It calls the follow on activity as normal. Inside the activity I cannot read the state that the orchestrator just read?

here is the orchestrator

```<code>const df = require("durable-functions");

module.exports = df.orchestrator(function* (context) {
  context.log("MsgOrch started ");
  let incomingMessage = context.df.getInput();
  const entityId = new df.EntityId("", `1`);
  const lockState = yield context.df.callEntity(entityId, "get");

  if('fromApi' in incomingMessage){
    yield context.df.callActivity("Unlock", incomingMessage); //unlock the activity, need to call the activity to send the message through the websocket
  }
  else if(lockState.isLocked && lockState.lockHolder === incomingMessage.localEmail){
      yield context.df.callEntity(entityId, "update");
  }else if (!lockState.isLocked){
    yield context.df.callActivity("Lock", incomingMessage);
  }

});
</code>```

the entity

```<code>const df = require("durable-functions");

module.exports = df.entity(function (context) {
  context.log(`Hello ${context.df.entityKey}!`)
  context.log(context.bindings);
  let currentValue = context.df.getState(newLockedObject);
  switch (context.df.operationName) {
    case "get":
      context.df.return(currentValue);
      break;
    case "lock":
      context.df.setState({
        locked: true,
        lockHolder: 'jim',
        seconds: getEpochSeconds(),
      });
      break;
    case "unlock":
      context.df.setState({
        locked: false,
        lockHolder: null,
      });
      break;
      case "update":
        currentValue.seconds = getEpochSeconds();
        context.df.setState(currentValue);
        break;
  }
});
</code>```

and the activity that is called by the orchestrator.

```<code> const df = require("durable-functions");
module.exports = async function (context) {
  const client = df.getClient(context);
  const entityId = new df.EntityId("lockedstate", `1`);
  const lockState = await client.readEntityState(entityId);
  context.log(lockState);
  return `Locked ${context.bindings.incomingMessage.id}!`;
};
</code>```

state of the program while at the start of the if statement in the orchestrator

then the state of the program within the "lock" activity

according to the documentation at

readEntityState should read the same state as the orchestrator correct?

I've tried changed the identifiers of the Entity ID from something dynamically created from the input from the HTTPtrigger to something that as you can see I have just hard coded.

Been touring through the documentation on the Azure site but I seem to be implementing this correctly?

when I created the tutorial counter project they had it was working just fine.

Body:
While using Azure Durable functions and attempting to learn it I have created an orchestrator that is going to read a state of an entity, and then call other activities to perform other logic after. Pretty straightforward I thought.

Inside the orchestrator, it can read and see the entity. everything works fine. It calls the follow on activity as normal. Inside the activity I cannot read the state that the orchestrator just read?

here is the orchestrator

const df = require("durable-functions");

module.exports = df.orchestrator(function* (context) {
  context.log("MsgOrch started ");
  let incomingMessage = context.df.getInput();
  const entityId = new df.EntityId("", `1`);
  const lockState = yield context.df.callEntity(entityId, "get");

  if('fromApi' in incomingMessage){
    yield context.df.callActivity("Unlock", incomingMessage); //unlock the activity, need to call the activity to send the message through the websocket
  }
  else if(lockState.isLocked && lockState.lockHolder === incomingMessage.localEmail){
      yield context.df.callEntity(entityId, "update");
  }else if (!lockState.isLocked){
    yield context.df.callActivity("Lock", incomingMessage);
  }

});

the entity

const df = require("durable-functions");

module.exports = df.entity(function (context) {
  context.log(`Hello ${context.df.entityKey}!`)
  context.log(context.bindings);
  let currentValue = context.df.getState(newLockedObject);
  switch (context.df.operationName) {
    case "get":
      context.df.return(currentValue);
      break;
    case "lock":
      context.df.setState({
        locked: true,
        lockHolder: 'jim',
        seconds: getEpochSeconds(),
      });
      break;
    case "unlock":
      context.df.setState({
        locked: false,
        lockHolder: null,
      });
      break;
      case "update":
        currentValue.seconds = getEpochSeconds();
        context.df.setState(currentValue);
        break;
  }
});

and the activity that is called by the orchestrator.

 const df = require("durable-functions");
module.exports = async function (context) {
  const client = df.getClient(context);
  const entityId = new df.EntityId("lockedstate", `1`);
  const lockState = await client.readEntityState(entityId);
  context.log(lockState);
  return `Locked ${context.bindings.incomingMessage.id}!`;
};

state of the program while at the start of the if statement in the orchestrator

then the state of the program within the "lock" activity

according to the documentation at

readEntityState should read the same state as the orchestrator correct?

I've tried changed the identifiers of the Entity ID from something dynamically created from the input from the HTTPtrigger to something that as you can see I have just hard coded.

Been touring through the documentation on the Azure site but I seem to be implementing this correctly?

when I created the tutorial counter project they had it was working just fine.


问:
Twilio trying to check if subscriber is already on the list
I am trying to get check incoming numbers to see if the are already members on my Twilio when a user texts back "subscribe".  However it keeps breaking.  I am trying to have it return to user variable ( broadcastAlreadySubMessage ).  Please take a look at code lines 59 - 67

```<code>/* global module, exports, require, process, console */

// Response strings - update these to change the copy in the messages
const helpMessage = 'Thy help is here! Text "subscribe" to subscribe. Reply "stop" to stop getting messages, and "start" to receive them again.';
const subscribeSuccessMessage = 'You are now subscribed!';
const subscribeFailMessage = "Dang it. We couldn't subscribe you - try again later?";
const broadcastNotAuthorizedMessage = 'Failed to broadcast';
const broadcastSuccessMessage = 'Success! Your text will be sent immediately.';
const broadcastFailMessage = 'Well this is awkward. Your message failed to send, try again later.';
const broadcastAlreadySubMessage = 'you are already subscribed.';

// Helper class for commands
class Command {
  // Create a new instance with necessary arguments from the incoming SMS
  constructor(event, context) {
    this.fromNumber = event.From;
    this.body = event.Body || '';
    this.event = event;
    this.context = context;

    const client = this.context.getTwilioClient();
    this.notify = client.notify.services(process.env.BROADCAST_NOTIFY_SERVICE_SID);

    /*
     * Occassionally, US numbers will be passed without the preceding
     * country code - check for this eventuality and fix it
     */
    if (this.fromNumber.indexOf('+') !== 0) {
      this.fromNumber = `+1${this.fromNumber}`;
    }
  }

  // Get an array of arguments after the first word for a command
  get commandArguments() {
    return this.body.trim().split(' ').slice(1);
  }

  // Get the full text after the command with spaces reinserted
  get commandText() {
    return this.commandArguments.join(' ');
  }

  // Execute command async (to be overridden by subclasses)
  run(callback) {
    callback(null, 'Command not implemented.');
  }
}

/* Subclasses for supported commands */

class HelpCommand extends Command {
  run(callback) {
    callback(null, helpMessage);
  }
}

class SubscribeCommand extends Command {
  //bindingResult = client.notify.v1.services(process.env.BROADCAST_NOTIFY_SERVICE_SID).bindings.list().then((bindings) => {
    bindingResult = this.notify.bindings.list().then((bindings) => {
    bindings.forEach(b => {
      if(b.identity === this.fromNumber) {
        // incoming number
        return true;
      }
    });
    return false;
  });

  run(callback) {

    //execute logic to return "you are already subscribed" message
    // bindingResult.then((r) => {
    //   callback(null, broadcastAlreadySubMessage);
    // });

    console.log(bindingResult);

    // Create a new SMS Notify binding for this user's phone number
    this.notify.bindings
      .create({
        identity: this.fromNumber,
        bindingType: 'sms',
        address: this.fromNumber,
      })
      .then(() => {
        callback(null, subscribeSuccessMessage);
      })
      .catch((err) => {
        console.error(err);
        callback(err, subscribeFailMessage);
      });
  }
}

class BroadcastCommand extends Command {
  constructor(event, context) {
    super(event, context);
    this.adminNumbers = context.BROADCAST_ADMIN_NUMBERS;
  }

  // eslint-disable-next-line consistent-return
  run(callback) {
    /*
     * Check if sender is in list of admins, stored in the system environment
     * as a comma-separated string
     */
    if (this.adminNumbers.indexOf(this.fromNumber) < 0) {
      return callback(null, broadcastNotAuthorizedMessage);
    }

    // Create a new Notification for all bindings with the text of the message
    this.notify.notifications
      .create({
        tag: 'all',
        body: this.commandText,
      })
      .then(() => {
        callback(null, broadcastSuccessMessage);
      })
      .catch((err) => {
        console.error(err);
        callback(err, broadcastFailMessage);
      });
  }
}

// Handle incoming SMS commands
exports.handler = (context, event, callback) => {
  // Get command text from incoming SMS body
  let cmd = event.Body || '';
  cmd = cmd.trim().split(' ')[0].toLowerCase();

  // Choose other commands as appropriate
  const CommandClasses = {
    subscribe: SubscribeCommand,
    broadcast: BroadcastCommand,
  };
  const CommandClass = CommandClasses[cmd] || HelpCommand;
  const cmdInstance = new CommandClass(event, context);

  // Execute command
  cmdInstance.run((_err, message) => {
    const twiml = new Twilio.twiml.MessagingResponse();
    twiml.message(message);
    callback(null, twiml);
  });
};

</code>```

I tried entering the code between lines 59 through 67 and got an error message. Any help will be appreciated.

Body:
I am trying to get check incoming numbers to see if the are already members on my Twilio when a user texts back "subscribe".  However it keeps breaking.  I am trying to have it return to user variable ( broadcastAlreadySubMessage ).  Please take a look at code lines 59 - 67

/* global module, exports, require, process, console */

// Response strings - update these to change the copy in the messages
const helpMessage = 'Thy help is here! Text "subscribe" to subscribe. Reply "stop" to stop getting messages, and "start" to receive them again.';
const subscribeSuccessMessage = 'You are now subscribed!';
const subscribeFailMessage = "Dang it. We couldn't subscribe you - try again later?";
const broadcastNotAuthorizedMessage = 'Failed to broadcast';
const broadcastSuccessMessage = 'Success! Your text will be sent immediately.';
const broadcastFailMessage = 'Well this is awkward. Your message failed to send, try again later.';
const broadcastAlreadySubMessage = 'you are already subscribed.';

// Helper class for commands
class Command {
  // Create a new instance with necessary arguments from the incoming SMS
  constructor(event, context) {
    this.fromNumber = event.From;
    this.body = event.Body || '';
    this.event = event;
    this.context = context;

    const client = this.context.getTwilioClient();
    this.notify = client.notify.services(process.env.BROADCAST_NOTIFY_SERVICE_SID);

    /*
     * Occassionally, US numbers will be passed without the preceding
     * country code - check for this eventuality and fix it
     */
    if (this.fromNumber.indexOf('+') !== 0) {
      this.fromNumber = `+1${this.fromNumber}`;
    }
  }

  // Get an array of arguments after the first word for a command
  get commandArguments() {
    return this.body.trim().split(' ').slice(1);
  }

  // Get the full text after the command with spaces reinserted
  get commandText() {
    return this.commandArguments.join(' ');
  }

  // Execute command async (to be overridden by subclasses)
  run(callback) {
    callback(null, 'Command not implemented.');
  }
}

/* Subclasses for supported commands */

class HelpCommand extends Command {
  run(callback) {
    callback(null, helpMessage);
  }
}

class SubscribeCommand extends Command {
  //bindingResult = client.notify.v1.services(process.env.BROADCAST_NOTIFY_SERVICE_SID).bindings.list().then((bindings) => {
    bindingResult = this.notify.bindings.list().then((bindings) => {
    bindings.forEach(b => {
      if(b.identity === this.fromNumber) {
        // incoming number
        return true;
      }
    });
    return false;
  });

  run(callback) {

    //execute logic to return "you are already subscribed" message
    // bindingResult.then((r) => {
    //   callback(null, broadcastAlreadySubMessage);
    // });

    console.log(bindingResult);

    // Create a new SMS Notify binding for this user's phone number
    this.notify.bindings
      .create({
        identity: this.fromNumber,
        bindingType: 'sms',
        address: this.fromNumber,
      })
      .then(() => {
        callback(null, subscribeSuccessMessage);
      })
      .catch((err) => {
        console.error(err);
        callback(err, subscribeFailMessage);
      });
  }
}

class BroadcastCommand extends Command {
  constructor(event, context) {
    super(event, context);
    this.adminNumbers = context.BROADCAST_ADMIN_NUMBERS;
  }

  // eslint-disable-next-line consistent-return
  run(callback) {
    /*
     * Check if sender is in list of admins, stored in the system environment
     * as a comma-separated string
     */
    if (this.adminNumbers.indexOf(this.fromNumber) < 0) {
      return callback(null, broadcastNotAuthorizedMessage);
    }

    // Create a new Notification for all bindings with the text of the message
    this.notify.notifications
      .create({
        tag: 'all',
        body: this.commandText,
      })
      .then(() => {
        callback(null, broadcastSuccessMessage);
      })
      .catch((err) => {
        console.error(err);
        callback(err, broadcastFailMessage);
      });
  }
}

// Handle incoming SMS commands
exports.handler = (context, event, callback) => {
  // Get command text from incoming SMS body
  let cmd = event.Body || '';
  cmd = cmd.trim().split(' ')[0].toLowerCase();

  // Choose other commands as appropriate
  const CommandClasses = {
    subscribe: SubscribeCommand,
    broadcast: BroadcastCommand,
  };
  const CommandClass = CommandClasses[cmd] || HelpCommand;
  const cmdInstance = new CommandClass(event, context);

  // Execute command
  cmdInstance.run((_err, message) => {
    const twiml = new Twilio.twiml.MessagingResponse();
    twiml.message(message);
    callback(null, twiml);
  });
};

I tried entering the code between lines 59 through 67 and got an error message. Any help will be appreciated.


问:
Why do I report an error when I execute npm run build
enter image description here

I want to execute npm run build to package into a dist folder, but when I execute this command, an error is reported. Is it related to the node version? I tried node versions 18.13.0 and 16.19.0, but it didn’t work.


问:
Add background to dfsu plot (mikeio)
I would like to add background to a dfsu(mesh) plot but I have no idea to do it.
I have tried many ways and it seems like no effectiveness.

Is there any way to add a background to that plot?

I have tried saving separately 2 figures (1 for background and 1 for main plot) and pasting them on the matplotlib plot. This method could not control the actual coordinate of these 2 figures. I also tried plotting background directly to the dfsu plot, but it just replaced colorbar by the background figured.

Title: Add background to dfsu plot (mikeio)


问:
Gerrit: Is there a way push code like git but must to be review?
Git:

```<code>1. make changes
2. git commit
3. git push origin HEAD:refs/heads/x   # Important!!!
</code>```

Gerrit:

```<code>1. make changes
2. git commit
3. git push origin HEAD:refs/for/x    # Important!!!
4. gerrit: review & submit
</code>```

I want to know is there a way make procedure to:

```<code>1. make changes
2. git commit
3. git push origin HEAD:refs/heads/x
4. gerrit: review & submit
</code>```

Because so many ui tools not support gerrit way, but i want to review code. Thx.

Body:
Git:

1. make changes
2. git commit
3. git push origin HEAD:refs/heads/x   # Important!!!

Gerrit:

1. make changes
2. git commit
3. git push origin HEAD:refs/for/x    # Important!!!
4. gerrit: review & submit

I want to know is there a way make procedure to:

1. make changes
2. git commit
3. git push origin HEAD:refs/heads/x
4. gerrit: review & submit

Because so many ui tools not support gerrit way, but i want to review code. Thx.


问:
Stream parsing tweets
The bottom line is to listen to a specific user and transfer his tweets with minimal delay to the telegram bot.
To implement this task, I use the Twiipi library in which, as I understand it, there are 2 most important types of authentication for me:

On behalf of the user - 900 requests in 15 minutes (i.e. 1 request in 1 second)

On behalf of the application - 300 requests in 15 minutes (i.e. 1 request in 3 seconds)
I authenticate my script on behalf of the user using the OAuth1UserHandler function (listed below).
But despite this, the delay in speed appears after 7.5 minutes of work, given that the script for interacting with twitter resources runs once every 1.5 seconds. That is one way or another Authentication of my script takes place on behalf of the application. But despite this, I just made a second bot that starts after 7 minutes of the previous one, thereby updating the time for the previous one to work. My main problem is that the performance of parsing tweet data drops (acceptable speed is a maximum of 1.5 seconds, delays sometimes last 13 seconds).
Please tell me what I'm doing wrong or how can I solve my problem better?

code of one of 2 bots

```<code>import tweepy
import datetime
import time

from notifiers import get_notifier
from re import sub

TOKEN = 'telegram token here'
USER_ID = telegram user id here
ADMIN_ID = teelgram my id here for check work bots

auth = tweepy.OAuth1UserHandler(
    consumer_key="consumer key",
    consumer_secret="consumer secret",
    access_token="access token",
    access_token_secret="access token secret",
)
api = tweepy.API(auth)

# auth.set_access_token(access_token, access_token_secret)
print("###############    Tokens connected    ###############")

user = 'whose username we will listen to'
username_object = api.get_user(screen_name=user)

def listening_to_the_user():
    print('        We start listening to the user...')
    print('        When a user posts a tweet, you will hear an audio notification...')

    seconds_left = 60*10
    while seconds_left >= 0:
        for i in api.user_timeline(user_id=username_object.id, screen_name=user, count=1):
            tweet_post = i.created_at
            tweet_text = sub(r"https?://t.co[^,\s]+,?", "", i.text)

        tweet_time_information = [tweet_post.day, tweet_post.month, tweet_post.year, tweet_post.hour, tweet_post.minute]
        now = datetime.datetime.now()
        current_time = [now.day, now.month, now.year, now.hour, now.minute]

        if tweet_time_information == current_time:

            telegram = get_notifier('telegram')

            notification_about_tweet = f'{user}⬇'
            notification_about_tweet_time = f'{tweet_post.day}.{tweet_post.month}.{tweet_post.year}, {tweet_post.hour}:{tweet_post.minute}.{tweet_post.second}'
            notification_about_current_time = f'{now.day}.{now.month}.{now.year}, {now.hour}:{now.minute}.{now.second}'
            telegram.notify(token=TOKEN, chat_id=USER_ID, message=notification_about_tweet)
            telegram.notify(token=TOKEN, chat_id=USER_ID, message=tweet_text)

            try:
                entities = i.extended_entities
                itr = entities['media']
                for img_dict in range(len(itr)):
                    telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=(entities['media'][img_dict]['media_url_https']))
            except:
                entities = 0

            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=notification_about_tweet)
            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=tweet_text)
            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=notification_about_tweet_time)
            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=notification_about_current_time)

            try:
                entities = i.extended_entities
                itr = entities['media']
                for img_dict in range(len(itr)):
                    telegram.notify(token=TOKEN, chat_id=USER_ID,
                                    message=(entities['media'][img_dict]['media_url_https']))
            except:
                entities = 0

            seconds_left -= 60
            time.sleep(60)
        seconds_left -= 1.5
        time.sleep(1.5)

listening_to_the_user()
</code>```

Initially, I tried to use bearer_token for authentication, but this literally did not affect the operation of my program in any way and I simply reduced it to those tokens that are now in it.
I rummaged through the documentation in search of an answer to my question, but in search I only thought of the script calling the second bot after 7 minutes of the previous one, and so they worked in turn

Title: Stream parsing tweets

Body:
The bottom line is to listen to a specific user and transfer his tweets with minimal delay to the telegram bot.
To implement this task, I use the Twiipi library in which, as I understand it, there are 2 most important types of authentication for me:

On behalf of the user - 900 requests in 15 minutes (i.e. 1 request in 1 second)

On behalf of the application - 300 requests in 15 minutes (i.e. 1 request in 3 seconds)
I authenticate my script on behalf of the user using the OAuth1UserHandler function (listed below).
But despite this, the delay in speed appears after 7.5 minutes of work, given that the script for interacting with twitter resources runs once every 1.5 seconds. That is one way or another Authentication of my script takes place on behalf of the application. But despite this, I just made a second bot that starts after 7 minutes of the previous one, thereby updating the time for the previous one to work. My main problem is that the performance of parsing tweet data drops (acceptable speed is a maximum of 1.5 seconds, delays sometimes last 13 seconds).
Please tell me what I'm doing wrong or how can I solve my problem better?

code of one of 2 bots

import tweepy
import datetime
import time

from notifiers import get_notifier
from re import sub

TOKEN = 'telegram token here'
USER_ID = telegram user id here
ADMIN_ID = teelgram my id here for check work bots

auth = tweepy.OAuth1UserHandler(
    consumer_key="consumer key",
    consumer_secret="consumer secret",
    access_token="access token",
    access_token_secret="access token secret",
)
api = tweepy.API(auth)

# auth.set_access_token(access_token, access_token_secret)
print("###############    Tokens connected    ###############")

user = 'whose username we will listen to'
username_object = api.get_user(screen_name=user)

def listening_to_the_user():
    print('        We start listening to the user...')
    print('        When a user posts a tweet, you will hear an audio notification...')

    seconds_left = 60*10
    while seconds_left >= 0:
        for i in api.user_timeline(user_id=username_object.id, screen_name=user, count=1):
            tweet_post = i.created_at
            tweet_text = sub(r"https?://t.co[^,\s]+,?", "", i.text)

        tweet_time_information = [tweet_post.day, tweet_post.month, tweet_post.year, tweet_post.hour, tweet_post.minute]
        now = datetime.datetime.now()
        current_time = [now.day, now.month, now.year, now.hour, now.minute]

        if tweet_time_information == current_time:

            telegram = get_notifier('telegram')

            notification_about_tweet = f'{user}⬇'
            notification_about_tweet_time = f'{tweet_post.day}.{tweet_post.month}.{tweet_post.year}, {tweet_post.hour}:{tweet_post.minute}.{tweet_post.second}'
            notification_about_current_time = f'{now.day}.{now.month}.{now.year}, {now.hour}:{now.minute}.{now.second}'
            telegram.notify(token=TOKEN, chat_id=USER_ID, message=notification_about_tweet)
            telegram.notify(token=TOKEN, chat_id=USER_ID, message=tweet_text)

            try:
                entities = i.extended_entities
                itr = entities['media']
                for img_dict in range(len(itr)):
                    telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=(entities['media'][img_dict]['media_url_https']))
            except:
                entities = 0

            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=notification_about_tweet)
            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=tweet_text)
            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=notification_about_tweet_time)
            telegram.notify(token=TOKEN, chat_id=ADMIN_ID, message=notification_about_current_time)

            try:
                entities = i.extended_entities
                itr = entities['media']
                for img_dict in range(len(itr)):
                    telegram.notify(token=TOKEN, chat_id=USER_ID,
                                    message=(entities['media'][img_dict]['media_url_https']))
            except:
                entities = 0

            seconds_left -= 60
            time.sleep(60)
        seconds_left -= 1.5
        time.sleep(1.5)

listening_to_the_user()

Initially, I tried to use bearer_token for authentication, but this literally did not affect the operation of my program in any way and I simply reduced it to those tokens that are now in it.
I rummaged through the documentation in search of an answer to my question, but in search I only thought of the script calling the second bot after 7 minutes of the previous one, and so they worked in turn


问:
React Native BottomTabNavigator Icon remove
explanatory photo

I want to remove the 'X' mark in the picture and move it to the alarm part at the top. Is it possible?

Can I move the bottom navigation button to the header?

<Tab.Navigator
        screenOptions={{
          headerRight: () => (
            <NotiIconBtn onPress={() => navigate("Tabs", { screen: "Alarm" })}>
              <NotiIcon source={require("../public/img/notiIcon.png")} />
            </NotiIconBtn>
          ),
      >
        <Tab.Screen
          name="MyPage"
          component={MyPage}
          options={{
            headerShown: true,
            headerBackTitleVisible: true,
            title: "마이페이지",
            tabBarIcon: ({ focused, color, size }) => {
              return !focused ? (
                <>

                  <Text>마이페이지</Text>
                </>
              ) : (
                <>

                  <ActiveText>마이페이지</ActiveText>
                </>
              );
            },
          }}
        />
        skip
          .
          .
          .
        <Tab.Screen name="Alarm" component={Alarm} />
      </Tab.Navigator>
```


问:
Not loading External JavaScript File on Frist Loading after refreshing the page it gets loaded in Angular
I have issue in a Angular app. I try to Load External JS File Angular Component But Problem is When Page Loading Frist time External JavaScript File Not Loading Properly after second Reload it is working .
I try to Load External JS File in Child Component Not Index.html .
I Create New Component Name as External-script-Loader-Component That Component I try to Load as Child Component in My Component .My Problem is When I am visited Page External JS File Not Working Properly After I try to Reload it is Working</p>


问:
UnsupportedError (Unsupported operation: Platform._operatingSystem)
I try to work with firebaseStorage in flutter Web but I have a problem when I send the image to storage, because that send me a message like "UnsupportedError (Unsupported operation: Platform._operatingSystem)" and I dont know how to fix, also, I configure all firebase in my proyect but I dont know If i have to add firebase hosting and more, I would like to know how to fix
this is my code

```<code>String imagePath = '';
    if (image.path != '')
      imagePath = await setImage(image: image, random_id: randomId);

Future<String> setImage({
    required File image,
    required String random_id,
  }) async {
    final Reference reference = _storage.ref().child("imageSave");
    TaskSnapshot updateImage = await reference.child(random_id).putFile(image);
    String link = await updateImage.ref.getDownloadURL();
    return link;
  }
</code>```

I added flutterFire or firebase cli to my project but nothing happens I keep with error "UnsupportedError (Unsupported operation: Platform._operatingSystem)"

Body:
I try to work with firebaseStorage in flutter Web but I have a problem when I send the image to storage, because that send me a message like "UnsupportedError (Unsupported operation: Platform._operatingSystem)" and I dont know how to fix, also, I configure all firebase in my proyect but I dont know If i have to add firebase hosting and more, I would like to know how to fix
this is my code

String imagePath = '';
    if (image.path != '')
      imagePath = await setImage(image: image, random_id: randomId);

Future<String> setImage({
    required File image,
    required String random_id,
  }) async {
    final Reference reference = _storage.ref().child("imageSave");
    TaskSnapshot updateImage = await reference.child(random_id).putFile(image);
    String link = await updateImage.ref.getDownloadURL();
    return link;
  }

I added flutterFire or firebase cli to my project but nothing happens I keep with error "UnsupportedError (Unsupported operation: Platform._operatingSystem)"


问:
how to prevent the use of 'unsafe-eval' to CSP (Content Security Policy) becuase of prizmDoc viewer-asset underscore.min.js file (..new function..)
I have integrated the prizmDoc to our angular application and working perfectly in my local env. But in our STG I got an error saying 'unsafe-eval' is not allowed. According to prizmDoc v13.22 updated documentation, we must allow "script-src unsafe-eval" in Content Security Policy, but unfortunately we are not permitted to include 'unsafe-eval' to our CSP. Is there any other way I can convert the code 'new function' that making an error? Thank you in advance.

Link to viewer-asset files(css,js) of prizmDoc 13.22 -
viewer-assets

Here is the error in my console:

```<code>main.93f7f0f31b5d6421.js:1 ERROR EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' *.datadoghq-browser-agent.com".

at new Function (<anonymous>)
at Function.template (underscore.min.js:6:15234)
at new Viewer (viewer.js:230:17)
at $.fn.pccViewer (viewer.js:14118:20)
at T1.displayFile (main.93f7f0f31b5d6421.js:1:1946385)
at re._next (main.93f7f0f31b5d6421.js:1:1945936)
at re.__tryOrUnsub (main.93f7f0f31b5d6421.js:1:411612)
at re.next (main.93f7f0f31b5d6421.js:1:410711)
at re._next (main.93f7f0f31b5d6421.js:1:409695)
at re.next (main.93f7f0f31b5d6421.js:1:409361)
</code>```

Here is the documentation of prizmDoc v13.22
prizmDoc v13.22

I tried to use other version of prizmDoc viewer-assets but no luck.

Body:
I have integrated the prizmDoc to our angular application and working perfectly in my local env. But in our STG I got an error saying 'unsafe-eval' is not allowed. According to prizmDoc v13.22 updated documentation, we must allow "script-src unsafe-eval" in Content Security Policy, but unfortunately we are not permitted to include 'unsafe-eval' to our CSP. Is there any other way I can convert the code 'new function' that making an error? Thank you in advance.

Link to viewer-asset files(css,js) of prizmDoc 13.22 -
viewer-assets

Here is the error in my console:

main.93f7f0f31b5d6421.js:1 ERROR EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' *.datadoghq-browser-agent.com".

at new Function (<anonymous>)
at Function.template (underscore.min.js:6:15234)
at new Viewer (viewer.js:230:17)
at $.fn.pccViewer (viewer.js:14118:20)
at T1.displayFile (main.93f7f0f31b5d6421.js:1:1946385)
at re._next (main.93f7f0f31b5d6421.js:1:1945936)
at re.__tryOrUnsub (main.93f7f0f31b5d6421.js:1:411612)
at re.next (main.93f7f0f31b5d6421.js:1:410711)
at re._next (main.93f7f0f31b5d6421.js:1:409695)
at re.next (main.93f7f0f31b5d6421.js:1:409361)

Here is the documentation of prizmDoc v13.22
prizmDoc v13.22

I tried to use other version of prizmDoc viewer-assets but no luck.


问:
Laravel validation error message show only short form
I got used to request to validate before entering the API side function itself, but recently, when I moved the controller function to services then, the error message became like the below sample.

```<code>{
    "message": "validation.min.string",
    "errors": {
        "password": [
            "validation.min.string"
        ]
    }
}
</code>```

But when I use the same way build in the new project, the error message show as usual as below

```<code>{
    "message": "The name must only contain letters.",
    "errors": {
        "name": [
            "The name must only contain letters."
        ]
    }
 }
</code>```

I found that I had added an en language file under res resources\lang\en, which caused this issue, so may I know how I can change back to this version without removing the en file? Thanks

Body:
I got used to request to validate before entering the API side function itself, but recently, when I moved the controller function to services then, the error message became like the below sample.

{
    "message": "validation.min.string",
    "errors": {
        "password": [
            "validation.min.string"
        ]
    }
}

But when I use the same way build in the new project, the error message show as usual as below

{
    "message": "The name must only contain letters.",
    "errors": {
        "name": [
            "The name must only contain letters."
        ]
    }
 }

I found that I had added an en language file under res resources\lang\en, which caused this issue, so may I know how I can change back to this version without removing the en file? Thanks


问:
Nginx Ingress Controller not curling localhost on worker nodes
CentOS 7, 3 VMs -- 1 master and 2 workers, Kubernetes 1.26 (kubelet is 1.25.5.0), cri-dockerd, Calico CNI

```<code># kubectl get nodes -o wide
NAME        STATUS   ROLES           AGE     VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                KERNEL-VERSION                CONTAINER-RUNTIME
rxxxx-vm1   Ready    control-plane   4h48m   v1.25.5   10.253.137.20   <none>        CentOS Linux 7 (Core)   3.10.0-1160.80.1.el7.x86_64   docker://20.10.22
rxxxx-vm2   Ready    <none>          4h27m   v1.25.5   10.253.137.17   <none>        CentOS Linux 7 (Core)   3.10.0-1160.80.1.el7.x86_64   docker://20.10.22
rxxxx-vm3   Ready    <none>          4h27m   v1.25.5   10.253.137.10   <none>        CentOS Linux 7 (Core)   3.10.0-1160.80.1.el7.x86_64   docker://20.10.22
</code>```

NGINX Ingress controller is deployed as a daemonset:

```<code># kubectl get po -A -o wide
NAMESPACE          NAME                                       READY   STATUS    RESTARTS   AGE     IP              NODE        NOMINATED NODE   READINESS GATES
calico-apiserver   calico-apiserver-685568b969-b8mfr          1/1     Running   0          4h50m   172.17.0.6      rxxxx-vm1   <none>           <none>
calico-apiserver   calico-apiserver-685568b969-xrj2h          1/1     Running   0          4h50m   172.17.0.7      rxxxx-vm1   <none>           <none>
calico-system      calico-kube-controllers-67df98bdc8-2zdnj   1/1     Running   0          4h51m   172.17.0.4      rxxxx-vm1   <none>           <none>
calico-system      calico-node-498bb                          1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
calico-system      calico-node-sblv9                          1/1     Running   0          4h30m   10.253.137.17   rxxxx-vm2   <none>           <none>
calico-system      calico-node-zkn28                          1/1     Running   0          4h29m   10.253.137.10   rxxxx-vm3   <none>           <none>
calico-system      calico-typha-76c8f59f87-mq52d              1/1     Running   0          4h29m   10.253.137.10   rxxxx-vm3   <none>           <none>
calico-system      calico-typha-76c8f59f87-zk6jr              1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        coredns-787d4945fb-6mq5k                   1/1     Running   0          4h51m   172.17.0.3      rxxxx-vm1   <none>           <none>
kube-system        coredns-787d4945fb-kmqcv                   1/1     Running   0          4h51m   172.17.0.2      rxxxx-vm1   <none>           <none>
kube-system        etcd-rxxxx-vm1                             1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-apiserver-rxxxx-vm1                   1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-controller-manager-rxxxx-vm1          1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-proxy-g9dbt                           1/1     Running   0          4h29m   10.253.137.10   rxxxx-vm3   <none>           <none>
kube-system        kube-proxy-mnzks                           1/1     Running   0          4h30m   10.253.137.17   rxxxx-vm2   <none>           <none>
kube-system        kube-proxy-n98xb                           1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-scheduler-rxxxx-vm1                   1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
nginx-ingress      nginx-ingress-2chhn                        1/1     Running   0          4h29m   172.17.0.2      rxxxx-vm3   <none>           <none>
nginx-ingress      nginx-ingress-95h7s                        1/1     Running   0          4h30m   172.17.0.2      rxxxx-vm2   <none>           <none>
nginx-ingress      nginx-ingress-wbxng                        1/1     Running   0          4h51m   172.17.0.5      rxxxx-vm1   <none>           <none>
play               apple-app                                  1/1     Running   0          4h45m   172.17.0.8      rxxxx-vm1   <none>           <none>
play               banana-app                                 1/1     Running   0          4h45m   172.17.0.9      rxxxx-vm1   <none>           <none>
tigera-operator    tigera-operator-7795f5d79b-hmm5g           1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
</code>```

Services:

```<code># kubectl get svc -A -o wide
NAMESPACE          NAME                              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE     SELECTOR
calico-apiserver   calico-api                        ClusterIP   10.111.117.42   <none>        443/TCP                  6h34m   apiserver=true
calico-system      calico-kube-controllers-metrics   ClusterIP   10.99.121.254   <none>        9094/TCP                 6h35m   k8s-app=calico-kube-controllers
calico-system      calico-typha                      ClusterIP   10.104.50.90    <none>        5473/TCP                 6h35m   k8s-app=calico-typha
default            kubernetes                        ClusterIP   10.96.0.1       <none>        443/TCP                  6h36m   <none>
kube-system        kube-dns                          ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   6h36m   k8s-app=kube-dns
play               apple-service                     ClusterIP   10.98.78.251    <none>        5678/TCP                 6h29m   app=apple
play               banana-service                    ClusterIP   10.103.87.112   <none>        5678/TCP                 6h29m   app=banana
</code>```

Service details:

```<code># kubectl -n play describe svc apple-service
Name:              apple-service
Namespace:         play
Labels:            <none>
Annotations:       <none>
Selector:          app=apple
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.98.78.251
IPs:               10.98.78.251
Port:              <unset>  5678/TCP
TargetPort:        5678/TCP
Endpoints:         172.17.0.8:5678
Session Affinity:  None
Events:            <none>
</code>```

Endpoints:

```<code># kubectl get ep -A
NAMESPACE          NAME                              ENDPOINTS                                               AGE
calico-apiserver   calico-api                        172.17.0.6:5443,172.17.0.7:5443                         6h39m
calico-system      calico-kube-controllers-metrics   172.17.0.4:9094                                         6h39m
calico-system      calico-typha                      10.253.137.10:5473,10.253.137.20:5473                   6h40m
default            kubernetes                        10.253.137.20:6443                                      6h40m
kube-system        kube-dns                          172.17.0.2:53,172.17.0.3:53,172.17.0.2:53 + 3 more...   6h40m
play               apple-service                     172.17.0.8:5678                                         6h34m
play               banana-service                    172.17.0.9:5678                                         6h34m
</code>```

Endpoint details:

```<code># kubectl -n play describe ep apple-service
Name:         apple-service
Namespace:    play
Labels:       <none>
Annotations:  endpoints.kubernetes.io/last-change-trigger-time: 2023-01-11T20:21:27Z
Subsets:
  Addresses:          172.17.0.8
  NotReadyAddresses:  <none>
  Ports:
    Name     Port  Protocol
    ----     ----  --------
    <unset>  5678  TCP

Events:  <none>
</code>```

Ingress resource:

```<code># kubectl get ing -A -o wide
NAMESPACE   NAME              CLASS   HOSTS       ADDRESS   PORTS   AGE
play        example-ingress   nginx   localhost             80      6h30m
</code>```

Ingress details:

```<code># kubectl -n play describe ing example-ingress
Name:             example-ingress
Labels:           <none>
Namespace:        play
Address:
Ingress Class:    nginx
Default backend:  <default>
Rules:
  Host        Path  Backends
  ----        ----  --------
  localhost
              /apple    apple-service:5678 (172.17.0.8:5678)
              /banana   banana-service:5678 (172.17.0.9:5678)
Annotations:  ingress.kubernetes.io/rewrite-target: /
Events:       <none>
</code>```

QUESTION:
While curl -kL http://localhost/apple on master node returns apple the same command produces below output on worker nodes:

```<code><html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.23.2</center>
</body>
</html>
</code>```

My understanding is that if the ingress controller pod is running on every node, then localhost should be resolved as this is defined as host in ingress resource definition. Is this understanding incorrect? If not, what am I doing wrong?

When I look at the corresponding node's ingress controller's pod's logs, I see this:

```<code>2023/01/12 03:02:05 [error] 68#68: *11 connect() failed (113: No route to host) while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET /apple HTTP/1.1", upstream: "http://172.17.0.8:5678/apple", host: "localhost"
172.17.0.1 - - [12/Jan/2023:03:02:05 +0000] "GET /apple HTTP/1.1" 502 157 "-" "curl/7.29.0" "-"
</code>```

Body:
CentOS 7, 3 VMs -- 1 master and 2 workers, Kubernetes 1.26 (kubelet is 1.25.5.0), cri-dockerd, Calico CNI

# kubectl get nodes -o wide
NAME        STATUS   ROLES           AGE     VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE                KERNEL-VERSION                CONTAINER-RUNTIME
rxxxx-vm1   Ready    control-plane   4h48m   v1.25.5   10.253.137.20   <none>        CentOS Linux 7 (Core)   3.10.0-1160.80.1.el7.x86_64   docker://20.10.22
rxxxx-vm2   Ready    <none>          4h27m   v1.25.5   10.253.137.17   <none>        CentOS Linux 7 (Core)   3.10.0-1160.80.1.el7.x86_64   docker://20.10.22
rxxxx-vm3   Ready    <none>          4h27m   v1.25.5   10.253.137.10   <none>        CentOS Linux 7 (Core)   3.10.0-1160.80.1.el7.x86_64   docker://20.10.22

NGINX Ingress controller is deployed as a daemonset:

# kubectl get po -A -o wide
NAMESPACE          NAME                                       READY   STATUS    RESTARTS   AGE     IP              NODE        NOMINATED NODE   READINESS GATES
calico-apiserver   calico-apiserver-685568b969-b8mfr          1/1     Running   0          4h50m   172.17.0.6      rxxxx-vm1   <none>           <none>
calico-apiserver   calico-apiserver-685568b969-xrj2h          1/1     Running   0          4h50m   172.17.0.7      rxxxx-vm1   <none>           <none>
calico-system      calico-kube-controllers-67df98bdc8-2zdnj   1/1     Running   0          4h51m   172.17.0.4      rxxxx-vm1   <none>           <none>
calico-system      calico-node-498bb                          1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
calico-system      calico-node-sblv9                          1/1     Running   0          4h30m   10.253.137.17   rxxxx-vm2   <none>           <none>
calico-system      calico-node-zkn28                          1/1     Running   0          4h29m   10.253.137.10   rxxxx-vm3   <none>           <none>
calico-system      calico-typha-76c8f59f87-mq52d              1/1     Running   0          4h29m   10.253.137.10   rxxxx-vm3   <none>           <none>
calico-system      calico-typha-76c8f59f87-zk6jr              1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        coredns-787d4945fb-6mq5k                   1/1     Running   0          4h51m   172.17.0.3      rxxxx-vm1   <none>           <none>
kube-system        coredns-787d4945fb-kmqcv                   1/1     Running   0          4h51m   172.17.0.2      rxxxx-vm1   <none>           <none>
kube-system        etcd-rxxxx-vm1                             1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-apiserver-rxxxx-vm1                   1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-controller-manager-rxxxx-vm1          1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-proxy-g9dbt                           1/1     Running   0          4h29m   10.253.137.10   rxxxx-vm3   <none>           <none>
kube-system        kube-proxy-mnzks                           1/1     Running   0          4h30m   10.253.137.17   rxxxx-vm2   <none>           <none>
kube-system        kube-proxy-n98xb                           1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
kube-system        kube-scheduler-rxxxx-vm1                   1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>
nginx-ingress      nginx-ingress-2chhn                        1/1     Running   0          4h29m   172.17.0.2      rxxxx-vm3   <none>           <none>
nginx-ingress      nginx-ingress-95h7s                        1/1     Running   0          4h30m   172.17.0.2      rxxxx-vm2   <none>           <none>
nginx-ingress      nginx-ingress-wbxng                        1/1     Running   0          4h51m   172.17.0.5      rxxxx-vm1   <none>           <none>
play               apple-app                                  1/1     Running   0          4h45m   172.17.0.8      rxxxx-vm1   <none>           <none>
play               banana-app                                 1/1     Running   0          4h45m   172.17.0.9      rxxxx-vm1   <none>           <none>
tigera-operator    tigera-operator-7795f5d79b-hmm5g           1/1     Running   0          4h51m   10.253.137.20   rxxxx-vm1   <none>           <none>

Services:

# kubectl get svc -A -o wide
NAMESPACE          NAME                              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE     SELECTOR
calico-apiserver   calico-api                        ClusterIP   10.111.117.42   <none>        443/TCP                  6h34m   apiserver=true
calico-system      calico-kube-controllers-metrics   ClusterIP   10.99.121.254   <none>        9094/TCP                 6h35m   k8s-app=calico-kube-controllers
calico-system      calico-typha                      ClusterIP   10.104.50.90    <none>        5473/TCP                 6h35m   k8s-app=calico-typha
default            kubernetes                        ClusterIP   10.96.0.1       <none>        443/TCP                  6h36m   <none>
kube-system        kube-dns                          ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   6h36m   k8s-app=kube-dns
play               apple-service                     ClusterIP   10.98.78.251    <none>        5678/TCP                 6h29m   app=apple
play               banana-service                    ClusterIP   10.103.87.112   <none>        5678/TCP                 6h29m   app=banana

Service details:

# kubectl -n play describe svc apple-service
Name:              apple-service
Namespace:         play
Labels:            <none>
Annotations:       <none>
Selector:          app=apple
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.98.78.251
IPs:               10.98.78.251
Port:              <unset>  5678/TCP
TargetPort:        5678/TCP
Endpoints:         172.17.0.8:5678
Session Affinity:  None
Events:            <none>

Endpoints:

# kubectl get ep -A
NAMESPACE          NAME                              ENDPOINTS                                               AGE
calico-apiserver   calico-api                        172.17.0.6:5443,172.17.0.7:5443                         6h39m
calico-system      calico-kube-controllers-metrics   172.17.0.4:9094                                         6h39m
calico-system      calico-typha                      10.253.137.10:5473,10.253.137.20:5473                   6h40m
default            kubernetes                        10.253.137.20:6443                                      6h40m
kube-system        kube-dns                          172.17.0.2:53,172.17.0.3:53,172.17.0.2:53 + 3 more...   6h40m
play               apple-service                     172.17.0.8:5678                                         6h34m
play               banana-service                    172.17.0.9:5678                                         6h34m

Endpoint details:

# kubectl -n play describe ep apple-service
Name:         apple-service
Namespace:    play
Labels:       <none>
Annotations:  endpoints.kubernetes.io/last-change-trigger-time: 2023-01-11T20:21:27Z
Subsets:
  Addresses:          172.17.0.8
  NotReadyAddresses:  <none>
  Ports:
    Name     Port  Protocol
    ----     ----  --------
    <unset>  5678  TCP

Events:  <none>

Ingress resource:

# kubectl get ing -A -o wide
NAMESPACE   NAME              CLASS   HOSTS       ADDRESS   PORTS   AGE
play        example-ingress   nginx   localhost             80      6h30m

Ingress details:

# kubectl -n play describe ing example-ingress
Name:             example-ingress
Labels:           <none>
Namespace:        play
Address:
Ingress Class:    nginx
Default backend:  <default>
Rules:
  Host        Path  Backends
  ----        ----  --------
  localhost
              /apple    apple-service:5678 (172.17.0.8:5678)
              /banana   banana-service:5678 (172.17.0.9:5678)
Annotations:  ingress.kubernetes.io/rewrite-target: /
Events:       <none>

QUESTION:
While curl -kL http://localhost/apple on master node returns apple the same command produces below output on worker nodes:

<title>502 Bad Gateway</title>

502 Bad Gateway

nginx/1.23.2

My understanding is that if the ingress controller pod is running on every node, then localhost should be resolved as this is defined as host in ingress resource definition. Is this understanding incorrect? If not, what am I doing wrong?

When I look at the corresponding node's ingress controller's pod's logs, I see this:

2023/01/12 03:02:05 [error] 68#68: *11 connect() failed (113: No route to host) while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET /apple HTTP/1.1", upstream: "http://172.17.0.8:5678/apple", host: "localhost"
172.17.0.1 - - [12/Jan/2023:03:02:05 +0000] "GET /apple HTTP/1.1" 502 157 "-" "curl/7.29.0" "-"


问:
Renaming all files and folders in directory with ROT13 using batch file
First time poster, apologies if my formatting is incorrect.

I recently stumbled upon this batch script that uses JREPL:

```<code>@echo off
For /R %%G IN (.) DO (
pushd %1 .
call :sub
popd
exit /b

:sub  Subroutine needed to guarantee %-f0 gives the correct value
setlocal
set "find=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
set "repl=NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
set "p=/(.*)/"
set "prepl={$1}"
for /f "delims=" %%C in (
  'cmd /c "for %%F in (*) do @if "%%~fF" neq "%~f0" echo ren "%%F" "/%%~nF/%%~xF""^|jrepl find repl /t "" /p p /prepl "{$1}" /v'
) do echo %%C&%%C
)
</code>```

And it works great for encrypting the names of files but I want it to do the folders and sub-folders as well. This is because I want to obfuscate the names of my files for privacy reasons when uploading them onto a cloud for remote access.

I have tried several backup/encryption utilities that offer filename encryption but they cannot be opened unless you use the same utility, and I need other devices without access to the utility to be able to open them.

Body:
First time poster, apologies if my formatting is incorrect.

I recently stumbled upon this batch script that uses JREPL:

@echo off
For /R %%G IN (.) DO (
pushd %1 .
call :sub
popd
exit /b

:sub  Subroutine needed to guarantee %-f0 gives the correct value
setlocal
set "find=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
set "repl=NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
set "p=/(.*)/"
set "prepl={$1}"
for /f "delims=" %%C in (
  'cmd /c "for %%F in (*) do @if "%%~fF" neq "%~f0" echo ren "%%F" "/%%~nF/%%~xF""^|jrepl find repl /t "" /p p /prepl "{$1}" /v'
) do echo %%C&%%C
)

And it works great for encrypting the names of files but I want it to do the folders and sub-folders as well. This is because I want to obfuscate the names of my files for privacy reasons when uploading them onto a cloud for remote access.

I have tried several backup/encryption utilities that offer filename encryption but they cannot be opened unless you use the same utility, and I need other devices without access to the utility to be able to open them.


问:
Linux signal handler established with SIGINFO doesn't result in signals being queued reliablly
It is my program

```<code>void handler (int signo, siginfo_t * info, void *) {
    printf("signo = %d\n", signo);
}

int main() {
    struct sigaction act;
    act.sa_flags = 0;
    act.sa_flags |= SA_RESTART;
    act.sa_flags |= SA_SIGINFO;
    act.sa_sigaction = handler;
    sigaction(SIGQUIT, &act, NULL);

    // block quit signal
    sigset_t newmask;
    sigaddset(&newmask, SIGQUIT);
    sigprocmask(SIG_BLOCK, &newmask, NULL);

    printf("send quit signals many times to me\n");
    sleep(20);

    // pending?
    sigset_t pending_set;
    sigpending(&pending_set);
    if(sigismember(&pending_set, SIGQUIT)) {
        printf("pending\n");
    } else {
        printf("not pending\n");
    }

    // unblock quit signal
    sigprocmask(SIG_UNBLOCK, &newmask, NULL);
    while(1);
}
</code>```

This is what I do while sleeping

```<code>[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$
</code>```

After a long time, the program output this

```<code>[markity@mycom theory]$ ./main
send quit signals many times to me
pending
signo = 3

</code>```

It shows that while blocking, only one signal is reserved and the others are discarded. But I learned from APUE that a signal established with SIGINFO will make reliable queue. Do I misunderstand this?

This is the original text from APUE

[Edit]

this is my expected output

```<code>send quit signals many times to me
pending
signo = 3
signo = 3
signo = 3
signo = 3
signo = 3
signo = 3
signo = 3

</code>```

Body:
It is my program

void handler (int signo, siginfo_t * info, void *) {
    printf("signo = %d\n", signo);
}

int main() {
    struct sigaction act;
    act.sa_flags = 0;
    act.sa_flags |= SA_RESTART;
    act.sa_flags |= SA_SIGINFO;
    act.sa_sigaction = handler;
    sigaction(SIGQUIT, &act, NULL);

    // block quit signal
    sigset_t newmask;
    sigaddset(&newmask, SIGQUIT);
    sigprocmask(SIG_BLOCK, &newmask, NULL);

    printf("send quit signals many times to me\n");
    sleep(20);

    // pending?
    sigset_t pending_set;
    sigpending(&pending_set);
    if(sigismember(&pending_set, SIGQUIT)) {
        printf("pending\n");
    } else {
        printf("not pending\n");
    }

    // unblock quit signal
    sigprocmask(SIG_UNBLOCK, &newmask, NULL);
    while(1);
}

This is what I do while sleeping

[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$ kill -QUIT 3676
[markity@mycom ~]$

After a long time, the program output this

[markity@mycom theory]$ ./main
send quit signals many times to me
pending
signo = 3

It shows that while blocking, only one signal is reserved and the others are discarded. But I learned from APUE that a signal established with SIGINFO will make reliable queue. Do I misunderstand this?

This is the original text from APUE

[Edit]

this is my expected output

send quit signals many times to me
pending
signo = 3
signo = 3
signo = 3
signo = 3
signo = 3
signo = 3
signo = 3


问:
constructor of abstract class and constructor of a class who extend it
With this kind of structure

```<code>public abstract class BallService {

    private RuleRepository ruleRepository;

    public BallService(RuleRepository ruleRepository) {
        this.ruleRepository = ruleRepository;
    }
}

@Component
public class BasketballService extends BallService {

    @Autowired
    public BasketballService(RuleRepository ruleRepository) {
        super(ruleRepository);
    }
}
</code>```

Is there any annotation who can be used to avoid to write theses two constructor

Body:
With this kind of structure

public abstract class BallService {

    private RuleRepository ruleRepository;

    public BallService(RuleRepository ruleRepository) {
        this.ruleRepository = ruleRepository;
    }
}

@Component
public class BasketballService extends BallService {

    @Autowired
    public BasketballService(RuleRepository ruleRepository) {
        super(ruleRepository);
    }
}

Is there any annotation who can be used to avoid to write theses two constructor


问:
building docker container for selenium-chrome tests
I try to build docker image for use it in gitlab-ci
What already written:

```<code>FROM ubuntu:latest as ubuntu
FROM php:8.1-cli as php
FROM node:14.15.0-stretch AS node
FROM selenium/standalone-chrome:latest

COPY --from=ubuntu /bin /bin
COPY --from=php /app /app
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

# EXPOSE 4444
# EXPOSE 7900

LABEL miekrif uzvar-selenium

ENTRYPOINT ["/bin/bash"]
</code>```

What I wanted to achieve: I have a stage in .gitlab-ci.yml with the following points:

```<code>test-dev:
  stage: test
  image: miekrif/uzavr-selenium:latest
  script:
    - npm i
    - npm run prod
    - nohup /opt/bin/start-selenium-standalone.sh &
    - npx mocha tests/js/screenshots-* --timeout 50000
    - npx playwright test tests/js/pw_*
    - php artisan test
</code>```

What I want to achive: Current job maked for test our project, I couldn't think of another way to start selenium\standalone-chrome so that npx could run tests because it refers to 127.0.0.1

Currently I have following failure:

```<code>/usr/bin/sh: /usr/bin/sh: cannot execute binary file
</code>```

Body:
I try to build docker image for use it in gitlab-ci
What already written:

FROM ubuntu:latest as ubuntu
FROM php:8.1-cli as php
FROM node:14.15.0-stretch AS node
FROM selenium/standalone-chrome:latest

COPY --from=ubuntu /bin /bin
COPY --from=php /app /app
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

# EXPOSE 4444
# EXPOSE 7900

LABEL miekrif uzvar-selenium

ENTRYPOINT ["/bin/bash"]

What I wanted to achieve: I have a stage in .gitlab-ci.yml with the following points:

test-dev:
  stage: test
  image: miekrif/uzavr-selenium:latest
  script:
    - npm i
    - npm run prod
    - nohup /opt/bin/start-selenium-standalone.sh &
    - npx mocha tests/js/screenshots-* --timeout 50000
    - npx playwright test tests/js/pw_*
    - php artisan test

What I want to achive: Current job maked for test our project, I couldn't think of another way to start selenium\standalone-chrome so that npx could run tests because it refers to 127.0.0.1

Currently I have following failure:

/usr/bin/sh: /usr/bin/sh: cannot execute binary file


问:
Node Js SQL syntax
i am a beginner programmer of nodejs with mysql. while making a crud application using node js with mysql ran into the problem with You have an error in your SQL syntax

when i trying to search the record what i tried so far i attached below.i couldn't find the error here.

Search

```<code>server.get('/api/student/:id',(req, res) => {
  var sql = "SELECT * FROM student WHERE id=" + req.params.id;

  con.query(sql, function (err, result, fields) {
          if (err) throw err;
          res.end(JSON.stringify(result));
      });
});
</code>```

i attached the full error below.

```<code>Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':3' at line 1
    at Query.Sequence._packetToError (E:\nodemysqll\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
    at Query.ErrorPacket (E:\nodemysqll\node_modules\mysql\lib\protocol\sequences\Query.js:79:18)
    at Protocol._parsePacket (E:\nodemysqll\node_modules\mysql\lib\protocol\Protocol.js:291:23)
    at Parser._parsePacket (E:\nodemysqll\node_modules\mysql\lib\protocol\Parser.js:433:10)
    at Parser.write (E:\nodemysqll\node_modules\mysql\lib\protocol\Parser.js:43:10)
    at Protocol.write (E:\nodemysqll\node_modules\mysql\lib\protocol\Protocol.js:38:16)
    at Socket.<anonymous> (E:\nodemysqll\node_modules\mysql\lib\Connection.js:88:28)
    at Socket.<anonymous> (E:\nodemysqll\node_modules\mysql\lib\Connection.js:526:10)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    --------------------
    at Protocol._enqueue (E:\nodemysqll\node_modules\mysql\lib\protocol\Protocol.js:144:48)
    at Connection.query (E:\nodemysqll\node_modules\mysql\lib\Connection.js:198:25)
    at E:\nodemysqll\server.js:76:19
    at Layer.handle [as handle_request] (E:\nodemysqll\node_modules\express\lib\router\layer.js:95:5)
    at next (E:\nodemysqll\node_modules\express\lib\router\route.js:144:13)
    at Route.dispatch (E:\nodemysqll\node_modules\express\lib\router\route.js:114:3)
    at Layer.handle [as handle_request] (E:\nodemysqll\node_modules\express\lib\router\layer.js:95:5)
    at E:\nodemysqll\node_modules\express\lib\router\index.js:284:15
    at param (E:\nodemysqll\node_modules\express\lib\router\index.js:365:14)
    at param (E:\nodemysqll\node_modules\express\lib\router\index.js:376:14) {
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':3' at line 1",
  sqlState: '42000',
  index: 0,
  sql: 'SELECT * FROM student WHERE id=:3'
</code>```

Title: Node Js SQL syntax

Body:
i am a beginner programmer of nodejs with mysql. while making a crud application using node js with mysql ran into the problem with You have an error in your SQL syntax

when i trying to search the record what i tried so far i attached below.i couldn't find the error here.

Search

server.get('/api/student/:id',(req, res) => {
  var sql = "SELECT * FROM student WHERE id=" + req.params.id;

  con.query(sql, function (err, result, fields) {
          if (err) throw err;
          res.end(JSON.stringify(result));
      });
});

i attached the full error below.

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':3' at line 1
    at Query.Sequence._packetToError (E:\nodemysqll\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
    at Query.ErrorPacket (E:\nodemysqll\node_modules\mysql\lib\protocol\sequences\Query.js:79:18)
    at Protocol._parsePacket (E:\nodemysqll\node_modules\mysql\lib\protocol\Protocol.js:291:23)
    at Parser._parsePacket (E:\nodemysqll\node_modules\mysql\lib\protocol\Parser.js:433:10)
    at Parser.write (E:\nodemysqll\node_modules\mysql\lib\protocol\Parser.js:43:10)
    at Protocol.write (E:\nodemysqll\node_modules\mysql\lib\protocol\Protocol.js:38:16)
    at Socket.<anonymous> (E:\nodemysqll\node_modules\mysql\lib\Connection.js:88:28)
    at Socket.<anonymous> (E:\nodemysqll\node_modules\mysql\lib\Connection.js:526:10)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    --------------------
    at Protocol._enqueue (E:\nodemysqll\node_modules\mysql\lib\protocol\Protocol.js:144:48)
    at Connection.query (E:\nodemysqll\node_modules\mysql\lib\Connection.js:198:25)
    at E:\nodemysqll\server.js:76:19
    at Layer.handle [as handle_request] (E:\nodemysqll\node_modules\express\lib\router\layer.js:95:5)
    at next (E:\nodemysqll\node_modules\express\lib\router\route.js:144:13)
    at Route.dispatch (E:\nodemysqll\node_modules\express\lib\router\route.js:114:3)
    at Layer.handle [as handle_request] (E:\nodemysqll\node_modules\express\lib\router\layer.js:95:5)
    at E:\nodemysqll\node_modules\express\lib\router\index.js:284:15
    at param (E:\nodemysqll\node_modules\express\lib\router\index.js:365:14)
    at param (E:\nodemysqll\node_modules\express\lib\router\index.js:376:14) {
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':3' at line 1",
  sqlState: '42000',
  index: 0,
  sql: 'SELECT * FROM student WHERE id=:3'


问:
Delphi Jedi components manual installation
I'm using Delphi CE 10.4, and it has the DCC32.exe disabled line compilation.
I'm trying to manually install Jedi components, in the readme of JCL it says that it's needed to open and edit included file to customize options, in my case, source\include\jcld27win32.inc.
I'm starting to learn Delphi, and I didn't understand whats is it is necessary to do in this file, and didn't find videos showing a manual installation.
Someone who already installed this way could help me?

Manual Installation Although it is not recommended, a manual
installation is possible. You will have to manually configure options
for the library. That is done by modifying an included file. For each
tool you want to install the JCL in, repeat the following steps:

Open and edit included file to customize options: ... For Delphi 10.4 and C++Builder 10.4 Win32: source\include\jcld27win32.inc ...

In the IDE, open and compile package Jcl.dpk (or Jcl.bpk for C++Builder) located in a subdirectory of the "packages" directory
matching your version of the IDE. This package doesn't have to be
installed since it doesn't provide any components.

If you want to install experts, open package JclBaseExpert.dpk and compile it, then you can install all the experts you want (packages
are located in the same directory).


问:
Log4j: Null object returned for IfLastModified in Delete
I am trying to use TimeBasedTriggeringPolicy for RollingFileAppender. Log4J (v2.18) is throwing NullPointerException due to AGE.

Error:

```<code>2023-01-12 08:05:00,903 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.rolling.action.IfLastModified for element IfLastModified: java.lang.NullPointerException: age java.lang.reflect.InvocationTargetException

Caused by: java.lang.NullPointerException: age
    at java.util.Objects.requireNonNull(Unknown Source)
    at org.apache.logging.log4j.core.appender.rolling.action.IfLastModified.<init>(IfLastModified.java:49)
    at org.apache.logging.log4j.core.appender.rolling.action.IfLastModified.createAgeCondition(IfLastModified.java:105)
    ... 23 more
</code>```

Log4j.properties file:

```<code>name= RollingFileLogConfig
appenders = console, rolling

# Log files location
property.basePath = ./logs

# Console appender
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l] - %msg%n

# RollingFileAppender name, pattern, path and rollover policy
appender.rolling.type = RollingFile
appender.rolling.name = fileLogger
appender.rolling.fileName= ${basePath}/app.log
appender.rolling.filePattern= ${basePath}/app_%d{yyyyMMdd}.log.gz
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l] - %msg%n
appender.rolling.policies.type = Policies

# RollingFileAppender rotation policy
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 10MB
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.delete.type = Delete
appender.rolling.strategy.delete.basePath = ${basePath}
appender.rolling.strategy.delete.maxDepth = 10
appender.rolling.strategy.delete.ifLastModified.type = IfLastModified

# Configure root logger
rootLogger.level = trace
rootLogger.appenderRefs = stdout, rolling
rootLogger.appenderRef.rolling.ref = fileLogger
rootLogger.appenderRef.stdout.ref = STDOUT

</code>```

I have tried changing file pattern as mentioned in other similar questions asked in stack over flow but still getting the same error.

Body:
I am trying to use TimeBasedTriggeringPolicy for RollingFileAppender. Log4J (v2.18) is throwing NullPointerException due to AGE.

Error:

2023-01-12 08:05:00,903 main ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.rolling.action.IfLastModified for element IfLastModified: java.lang.NullPointerException: age java.lang.reflect.InvocationTargetException

Caused by: java.lang.NullPointerException: age
    at java.util.Objects.requireNonNull(Unknown Source)
    at org.apache.logging.log4j.core.appender.rolling.action.IfLastModified.<init>(IfLastModified.java:49)
    at org.apache.logging.log4j.core.appender.rolling.action.IfLastModified.createAgeCondition(IfLastModified.java:105)
    ... 23 more

Log4j.properties file:

name= RollingFileLogConfig
appenders = console, rolling

# Log files location
property.basePath = ./logs

# Console appender
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l] - %msg%n

# RollingFileAppender name, pattern, path and rollover policy
appender.rolling.type = RollingFile
appender.rolling.name = fileLogger
appender.rolling.fileName= ${basePath}/app.log
appender.rolling.filePattern= ${basePath}/app_%d{yyyyMMdd}.log.gz
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %level [%t] [%l] - %msg%n
appender.rolling.policies.type = Policies

# RollingFileAppender rotation policy
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size = 10MB
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.delete.type = Delete
appender.rolling.strategy.delete.basePath = ${basePath}
appender.rolling.strategy.delete.maxDepth = 10
appender.rolling.strategy.delete.ifLastModified.type = IfLastModified

# Configure root logger
rootLogger.level = trace
rootLogger.appenderRefs = stdout, rolling
rootLogger.appenderRef.rolling.ref = fileLogger
rootLogger.appenderRef.stdout.ref = STDOUT

I have tried changing file pattern as mentioned in other similar questions asked in stack over flow but still getting the same error.


问:
How to use passed arguments with a triple quotes in Big Query with Node.js
I am trying to execute a remote function in Big Query using @google-cloud/bigquery npm library.

In the example below, the dateFrom and dateTo are hard-coded as 2022-06-01T08:00:00.000Z and 2023-01-01T07:59:59.999Z, but I want to pass those values from the Node.js side.
I know I can use arguments using a syntax like @dateFrom, but no idea how to do it with triple quotes.

Thanks!

with postgres_things as (
  select
      `remote_function_name`(
        'db_name'
        , """
            select
              name
              , age
              , sex
              , created_at
            from users
            where
              created_at >= ${dateFrom}::timestamptz
              and created_at <= ${dateTo}::timestamptz
          """
        , '{"dateFrom":"2022-06-01T08:00:00.000Z","dateTo":"2023-01-01T07:59:59.999Z"}'
      ) as things
),
.
.
.
```


问:
labs.play-with-k8s how to copy file to other node
**labs.play-with-k8s how to copy file to other node **

[node1 ~]$ scp /etc/kubernetes/pki/front-proxy-ca.crt 192.168.0.7:/etc/kubernetes/pki/front-proxy-ca.crt
ssh: connect to host 192.168.0.7 port 22: Connection refused
lost connection


问:
Can class use mix-ins pattern when using MobX?
For example, using mix-ins to extends multiple utility classes, like this:

import { autorun, makeObservable } from "mobx";

type GConstructor<T = {}> = new (...args: any[]) => T;

interface HasLife {
  grow: () => void;
}

class Animal {
  age: number;

  constructor(age: number) {
    this.age = age;
  }
}

function addLife<TBase extends GConstructor<Animal>>(Base: TBase) {
  return class Jumpable extends Base {
    // this is wrong, mixins class cannot use constructor!
    constructor() {
      super();
      makeObservable(this, {
        age: observable,
        grow: action,
      });
    }
    grow() {
      this.age++;
    }
  };
}

class Dog extends addLife(Animal) implements HasLife {
  constructor(age: number) {
    super(age);
  }
}

const dog = new Dog(0);

autorun(() => {
  console.log(dog.age);
});

dog.grow();
```

The example I provided cannot run correctly because mixin classes cannot have constructors, but I would also like to mark the member methods as observable or action in the mixin classes.
What should I do?
or, What is the common approach within the mobx community for dealing with this problem using other methods?

Body:
For example, using mix-ins to extends multiple utility classes, like this:

import { autorun, makeObservable } from "mobx";

type GConstructor<T = {}> = new (...args: any[]) => T;

interface HasLife {
  grow: () => void;
}

class Animal {
  age: number;

  constructor(age: number) {
    this.age = age;
  }
}

function addLife<TBase extends GConstructor<Animal>>(Base: TBase) {
  return class Jumpable extends Base {
    // this is wrong, mixins class cannot use constructor!
    constructor() {
      super();
      makeObservable(this, {
        age: observable,
        grow: action,
      });
    }
    grow() {
      this.age++;
    }
  };
}

class Dog extends addLife(Animal) implements HasLife {
  constructor(age: number) {
    super(age);
  }
}

const dog = new Dog(0);

autorun(() => {
  console.log(dog.age);
});

dog.grow();

The example I provided cannot run correctly because mixin classes cannot have constructors, but I would also like to mark the member methods as observable or action in the mixin classes.
What should I do?
or, What is the common approach within the mobx community for dealing with this problem using other methods?


问:
build a react-native ios app catch err: File name too long
build log shows repeat name

image err msg

```<code>CpResource /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app/AugusReactApp.app (in target 'AugusReactApp' from project 'AugusReactApp')
    cd /Users/apple/Documents/GitHub/AugusReactApp/ios
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app

error: open /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp: File name too long (in target 'AugusReactApp' from project 'AugusReactApp')
</code>```

here is my build phases

image build phases

my xcode version is 13.2

react-native: "0.70.6"

I can't find any of the same problems

Body:
build log shows repeat name

image err msg

CpResource /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app/AugusReactApp.app (in target 'AugusReactApp' from project 'AugusReactApp')
    cd /Users/apple/Documents/GitHub/AugusReactApp/ios
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app

error: open /Users/apple/Library/Developer/Xcode/DerivedData/AugusReactApp-dpbgrpsyswtvjlgttmwlhxqkwbby/Build/Products/Debug-iphonesimulator/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp.app/AugusReactApp: File name too long (in target 'AugusReactApp' from project 'AugusReactApp')

here is my build phases

image build phases

my xcode version is 13.2

react-native: "0.70.6"

I can't find any of the same problems


问:
date-fns | How to get a specific day of the week in UTC
I want to use the date-fns function nextThursday but I want it to always return the date of the next Thursday at UTC time, not at the local time. I want to basically make nextThursday localized to UTC and not to the user's browser time. How would I do that?


问:
Performance consequence of using a single deque for undo / redo in memento implementation vs separate undo / redo stacks/linked lists?
I have implemented a Memento pattern using a deque

```<code>class Mementoable {
deque<Memento*> _mementos;
int _currentIndex;
... //Implementation omitted for brevity
}
</code>```

The currentIndex stores the current position. For example:

if I have just saved, the currentIndex will be the last index.

if I undo once, the currentIndex is decremented

if I redo once, the currentIndex is incremented

if I undo, and then do a new save, then all items after the new saves index will be cleared (to redo wouldn't make sense anymore)

Without taking into performance of the deque, this seems like a very fast implementation to me, since I either add or remove mementos from the dequeue (which would have to be done anyway if I had separate stacks for undo and redo), or I simply update the index, which is much faster than having separate stacks, since I would have to move objects from the undo stack to redo stack and vice versa.

If I play devils advocate, having separate undo / redo stacks could be very fast if I just use a linked list, in contrast if I use the std::deque then if it becomes very large there could be memory management issues that reduce performance depending on the implementation of deque.

Is my analysis correct ? Which option is better ? Or is any difference negligible ?

Body:
I have implemented a Memento pattern using a deque

class Mementoable {
deque<Memento*> _mementos;
int _currentIndex;
... //Implementation omitted for brevity
}

The currentIndex stores the current position. For example:

if I have just saved, the currentIndex will be the last index.

if I undo once, the currentIndex is decremented

if I redo once, the currentIndex is incremented

if I undo, and then do a new save, then all items after the new saves index will be cleared (to redo wouldn't make sense anymore)

Without taking into performance of the deque, this seems like a very fast implementation to me, since I either add or remove mementos from the dequeue (which would have to be done anyway if I had separate stacks for undo and redo), or I simply update the index, which is much faster than having separate stacks, since I would have to move objects from the undo stack to redo stack and vice versa.

If I play devils advocate, having separate undo / redo stacks could be very fast if I just use a linked list, in contrast if I use the std::deque then if it becomes very large there could be memory management issues that reduce performance depending on the implementation of deque.

Is my analysis correct ? Which option is better ? Or is any difference negligible ?