问:
Why is the execution not entering the loop while reading the .csv file?
I am having a problem while reading a .csv file.

```<code>def isPresent(self, stid):
    with open('D:\First_Sem_Project\Student\Student.csv', 'r', newline='') as file1:
        reader = csv.reader(file1)
        for row in reader:
            if row[0]==stid:
               return 1
    file1.close()
    return 0
</code>```

The condition row[0]==stid is not being executed. I also tried putting a print statement just after the for-loop signature, but nothing is being printed. Please help me out.

Body:
I am having a problem while reading a .csv file.

def isPresent(self, stid):
    with open('D:\First_Sem_Project\Student\Student.csv', 'r', newline='') as file1:
        reader = csv.reader(file1)
        for row in reader:
            if row[0]==stid:
               return 1
    file1.close()
    return 0

The condition row[0]==stid is not being executed. I also tried putting a print statement just after the for-loop signature, but nothing is being printed. Please help me out.


来源: stackexchange

问:
How to identify a task by its task_id? Airflow
I'm programmatically creating many tasks in a loop, and want to be able to specify the sequence of these tasks by their task_id. Is this possible, and how can I achieve this?

e.g. i have the following:

```<code>  def create_tasks(dict_of_tasks, upstream_task=None):
    for table_name, table_info in dict_of_tasks.items():

      current_task_created = DbtRunOperator(
        task_id=f"{table_name}",
        repo=repo,
        global_args=["--debug"],
        model=f"{table_name}",
        profile_target=dbt_profile_target,
        dag=dag)

      if upstream_task:
        upstream_task >> current_task_created
      else:
        run_another_model >> current_task_created

      if isinstance(table_info, collections.Mapping):
        create_tasks(table_info, current_task_created)
  create_tasks(dict_of_tasks_to_create)
</code>```

however, i wish to have run_another_model be the task_id, instead of the function name. is this possible?

my problem is that i have multiple task_ids created by the same function run_another_model, and each task_id are upstream of a string of separate/unrelated tasks.

so i would like to do something like this:

```<code>  def create_tasks(dict_of_tasks, upstream_task=None):
    for table_name, table_info in dict_of_tasks.items():

      current_task_created = DbtRunOperator(
        task_id=f"{table_name}",
        repo=repo,
        global_args=["--debug"],
        model=f"{table_name}",
        profile_target=dbt_profile_target,
        dag=dag)

      if upstream_task:
        upstream_task >> current_task_created

      if isinstance(table_info, collections.Mapping):
        create_tasks(table_info, current_task_created)

  create_tasks(dict_of_tasks_to_create)

  for upstream_task_name, downstream_task_name in dict_of_branching_tasks:
    upstream_task_name >> downstream_task_name

</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm programmatically creating many tasks in a loop, and want to be able to specify the sequence of these tasks by their task_id. Is this possible, and how can I achieve this?

e.g. i have the following:

  def create_tasks(dict_of_tasks, upstream_task=None):
    for table_name, table_info in dict_of_tasks.items():

      current_task_created = DbtRunOperator(
        task_id=f"{table_name}",
        repo=repo,
        global_args=["--debug"],
        model=f"{table_name}",
        profile_target=dbt_profile_target,
        dag=dag)

      if upstream_task:
        upstream_task >> current_task_created
      else:
        run_another_model >> current_task_created

      if isinstance(table_info, collections.Mapping):
        create_tasks(table_info, current_task_created)
  create_tasks(dict_of_tasks_to_create)

however, i wish to have run_another_model be the task_id, instead of the function name. is this possible?

my problem is that i have multiple task_ids created by the same function run_another_model, and each task_id are upstream of a string of separate/unrelated tasks.

so i would like to do something like this:

  def create_tasks(dict_of_tasks, upstream_task=None):
    for table_name, table_info in dict_of_tasks.items():

      current_task_created = DbtRunOperator(
        task_id=f"{table_name}",
        repo=repo,
        global_args=["--debug"],
        model=f"{table_name}",
        profile_target=dbt_profile_target,
        dag=dag)

      if upstream_task:
        upstream_task >> current_task_created

      if isinstance(table_info, collections.Mapping):
        create_tasks(table_info, current_task_created)

  create_tasks(dict_of_tasks_to_create)

  for upstream_task_name, downstream_task_name in dict_of_branching_tasks:
    upstream_task_name >> downstream_task_name


问:
Android game an collision
I have a many sprites walking on the screen. If the sprite s1 collides with sprite2, both sprites should play a sound (or similar).

I have created a game loop:

```<code>public void run( )
{
    long startTime;
    long sleepTime;

    while (this.running)
    {
        startTime = System.currentTimeMillis();

        this.view.updatePhysics( );

        Canvas canvas = null;
        try
        {
            canvas = this.view.getHolder( ).lockCanvas( );
            synchronized (this.view.getHolder( ))
            {
                this.view.onDraw( canvas );
            }
        }
        finally
        {
            if (canvas != null)
                this.view.getHolder( ).unlockCanvasAndPost( canvas );
        }

        sleepTime = TICS_PRO_SECOND - ( System.currentTimeMillis( ) - startTime );

        try
        {
            if (sleepTime > 0)
                GameLoop.sleep( sleepTime );
            else
                GameLoop.sleep( 500 );
        }
        catch (Exception exception)
        {
        }

    }
}
</code>```

The updatePhysics() is called many times. If I use a debugger I can see, that the code execution in collideWith( Sprite sprite ) comes up to  return true, but jump to the next line an return false. I think, it is a synchronisation problem...

Where I should call the collision method in my game loop? Is the update() the right place? I think, it isn't ;) . The sprite.onCollision( ) is called very rare...

```<code>protected void updatePhysics( )
{
    for (Sprite sprite : sprites)
    {

            for (Sprite s : sprites)
            {
                if (sprite.collideWith( s ))
                    sprite.onCollision( );
            }

        sprite.update( );
    }
}

public boolean collideWith( Sprite sprite )
{
    if (this == sprite)
        return false;

    Rect thisSprite = new Rect( this.xCoordinate, this.yCoordinate, this.width, this.height );
    Rect anotherSprite = new Rect( sprite.xCoordinate, sprite.yCoordinate, sprite.width, sprite.height );

    if (thisSprite.intersect( anotherSprite ))
        return true;

    return false;
}
</code>```

Should I synchronized the collideWith() method? Or is my code

```<code>for (Sprite sprite : sprites)
    {

            for (Sprite s : sprites)
            {
                if (sprite.collideWith( s ))
                    sprite.onCollision( );
            }

        sprite.update( );
    }
</code>```

the problem?

Regards, Dulcinea

ContentLicense: CC BY-SA 3.0

Title: Android game an collision

Body:
I have a many sprites walking on the screen. If the sprite s1 collides with sprite2, both sprites should play a sound (or similar).

I have created a game loop:

public void run( )
{
    long startTime;
    long sleepTime;

    while (this.running)
    {
        startTime = System.currentTimeMillis();

        this.view.updatePhysics( );

        Canvas canvas = null;
        try
        {
            canvas = this.view.getHolder( ).lockCanvas( );
            synchronized (this.view.getHolder( ))
            {
                this.view.onDraw( canvas );
            }
        }
        finally
        {
            if (canvas != null)
                this.view.getHolder( ).unlockCanvasAndPost( canvas );
        }

        sleepTime = TICS_PRO_SECOND - ( System.currentTimeMillis( ) - startTime );

        try
        {
            if (sleepTime > 0)
                GameLoop.sleep( sleepTime );
            else
                GameLoop.sleep( 500 );
        }
        catch (Exception exception)
        {
        }

    }
}

The updatePhysics() is called many times. If I use a debugger I can see, that the code execution in collideWith( Sprite sprite ) comes up to  return true, but jump to the next line an return false. I think, it is a synchronisation problem...

Where I should call the collision method in my game loop? Is the update() the right place? I think, it isn't ;) . The sprite.onCollision( ) is called very rare...

protected void updatePhysics( )
{
    for (Sprite sprite : sprites)
    {

            for (Sprite s : sprites)
            {
                if (sprite.collideWith( s ))
                    sprite.onCollision( );
            }

        sprite.update( );
    }
}

public boolean collideWith( Sprite sprite )
{
    if (this == sprite)
        return false;

    Rect thisSprite = new Rect( this.xCoordinate, this.yCoordinate, this.width, this.height );
    Rect anotherSprite = new Rect( sprite.xCoordinate, sprite.yCoordinate, sprite.width, sprite.height );

    if (thisSprite.intersect( anotherSprite ))
        return true;

    return false;
}

Should I synchronized the collideWith() method? Or is my code

for (Sprite sprite : sprites)
    {

            for (Sprite s : sprites)
            {
                if (sprite.collideWith( s ))
                    sprite.onCollision( );
            }

        sprite.update( );
    }

the problem?

Regards, Dulcinea


问:
Error when reading data from RDS (mysql) in Next.js
I just started using Next.js. So I don't know what to know. I am working on reading data from RDS using mysql2/promise. A line is read from the table and reflected well on the screen. However, from two rows, the data is broken. Another problem is that even if one line is read successfully, if the length of text in one column becomes long, the data is broken. I really don't know what caused it.

What do I need to look out for and fix?

lib/db.js

```<code>import mysql from "mysql2/promise";

export async function LibDB(query, values) {
    const DbConnection = await mysql.createConnection({
        host: process.env.DB_HOST,
        port: process.env.DB_PORT,
        user: process.env.DB_USER,
        password: process.env.DB_PASS,
        database: process.env.DB_DATABASE
    });

    try {
        const [results] = await DbConnection.execute(query, values)
        DbConnection.end();
        return results

    } catch (error) {
        throw Error(error.message);

    }

}
</code>```

pages/api/get_result.js

```<code>import{LibDB} from "../../lib/db"

export default async function handler(req, res) {

    try {

        const query = "SELECT T.test_id, T.test_share, R.test_title, R.result_title, R.result_name, R.result_description, R.result_sub_description, R.result_image, R.result_image_kakao, R.result_image_facebook FROM tests_results R INNER JOIN logs L ON L.test_id = R.test_id AND L.result_type = R.result_type INNER JOIN tests T ON R.test_id = T.test_id WHERE L.log_id = ? AND L.test_id = ?";
        const value = [req.query.logId, req.query.testId];
        const data = await LibDB(query,value);

        // res.status(200).json({results: data})
        res.status(200).send(data);

    } catch (error) {

        res.status(500).json({error: error.message})
        res.status(500).send('error')
    }

}
</code>```

result_description colume.

When the text length of this column is short, it fully reflects one line. However, if the text length increases, the data that just came out well cannot be imported. I think the standard is 150 characters or less. It was the same even if I modified the table and maximized the varchar length.

call api

```<code>export async function getServerSideProps({params}){
    const response = await axios.get(process.env.NEXT_PUBLIC_URL+"/api/get_result", {params: {logId: params.id, testId:1}})
        const data =response.data
        return {
            props:{resultData: data}
        };
}
</code>```

I looked to see if there were any values that interfered with the JSON format, but there was no such part. I found out that I couldn't read it because of the length of the text while changing the length of the text in the column little by little.

Body:
I just started using Next.js. So I don't know what to know. I am working on reading data from RDS using mysql2/promise. A line is read from the table and reflected well on the screen. However, from two rows, the data is broken. Another problem is that even if one line is read successfully, if the length of text in one column becomes long, the data is broken. I really don't know what caused it.

What do I need to look out for and fix?

lib/db.js

import mysql from "mysql2/promise";

export async function LibDB(query, values) {
    const DbConnection = await mysql.createConnection({
        host: process.env.DB_HOST,
        port: process.env.DB_PORT,
        user: process.env.DB_USER,
        password: process.env.DB_PASS,
        database: process.env.DB_DATABASE
    });

    try {
        const [results] = await DbConnection.execute(query, values)
        DbConnection.end();
        return results

    } catch (error) {
        throw Error(error.message);

    }

}

pages/api/get_result.js

import{LibDB} from "../../lib/db"

export default async function handler(req, res) {

    try {

        const query = "SELECT T.test_id, T.test_share, R.test_title, R.result_title, R.result_name, R.result_description, R.result_sub_description, R.result_image, R.result_image_kakao, R.result_image_facebook FROM tests_results R INNER JOIN logs L ON L.test_id = R.test_id AND L.result_type = R.result_type INNER JOIN tests T ON R.test_id = T.test_id WHERE L.log_id = ? AND L.test_id = ?";
        const value = [req.query.logId, req.query.testId];
        const data = await LibDB(query,value);

        // res.status(200).json({results: data})
        res.status(200).send(data);

    } catch (error) {

        res.status(500).json({error: error.message})
        res.status(500).send('error')
    }

}

result_description colume.

When the text length of this column is short, it fully reflects one line. However, if the text length increases, the data that just came out well cannot be imported. I think the standard is 150 characters or less. It was the same even if I modified the table and maximized the varchar length.

call api

export async function getServerSideProps({params}){
    const response = await axios.get(process.env.NEXT_PUBLIC_URL+"/api/get_result", {params: {logId: params.id, testId:1}})
        const data =response.data
        return {
            props:{resultData: data}
        };
}

I looked to see if there were any values that interfered with the JSON format, but there was no such part. I found out that I couldn't read it because of the length of the text while changing the length of the text in the column little by little.


问:
PyTorch mac memory grows with loop with recursively assigned attribute
I have the following function inside a class:

```<code>    def parabola(self):
        # Initialize u1, u2, and u3 with zeros
        u1 = torch.cat((torch.diff(self.ubar.detach(), dim=0).detach().clone(), torch.zeros_like(self.ubar[:1,:,:,:], dtype = torch.float32)), dim = 0)
        u2 = torch.cat((torch.diff(self.ubar.detach(), dim=1).detach().clone(), torch.zeros_like(self.ubar[:,:1,:,:], dtype = torch.float32)), dim = 1)
        u3 = torch.cat((torch.diff(self.ubar.detach(), dim=3).detach().clone(), torch.zeros_like(self.ubar[:,:,:,:1], dtype = torch.float32)), dim = 3)

        # Stack the values of mu1 and mu2 for each value of z in the loop
        mu1sum = torch.stack([self.mu1[:,:,:,self.k_indices[z]].sum(dim=-1) for z in range(self.l)], dim=-1)
        mu2sum = torch.stack([self.mu2[:,:,:,self.k_indices[z]].sum(dim=-1) for z in range(self.l)], dim=-1)

        # Calculate u1, u2, and u3 using the formulas in the original function
        u1 = self.p1 + self.sigmap * (u1 + mu1sum)
        u2 = self.p2 + self.sigmap * (u2 + mu2sum)
        u3 = self.p3 + self.sigmap * u3

        #B = self.bound(u1,u2,self.lmbda,z+1,self.l,img)
        # Calculate B using self.bound and broadcast it along the last dimension
        k_indices = torch.arange(1, self.l+1, dtype=torch.int64).repeat(self.h, self.w, self.nc, 1)
        B = self.bound(u1, u2, self.lmbda, k_indices, self.l, self.f.unsqueeze(-1).repeat(1,1,1,self.l))

        # Use mask to select elements where u3 < B
        mask = u3 < B
        img = self.f.unsqueeze(self.f.dim()-1).expand(mask.shape)[mask]

        self.p1[~mask] = u1[~mask]
        self.p2[~mask] = u2[~mask]
        self.p3[~mask] = u3[~mask]
</code>```

which is called in a loop to recursively update self.p1, self.p2, self.p3:

```<code>        p1 = torch.zeros((self.h,self.w,self.nc,self.l,), dtype = torch.float32)
        p2 = torch.zeros((self.h,self.w,self.nc,self.l,), dtype = torch.float32)
        p3 = torch.zeros((self.h,self.w,self.nc,self.l,), dtype = torch.float32)

        for iter in range(self.repeats):
            p1, p2, p3 = self.parabola(p1, p2, p3, self.ubar) # project onto parabola (set K)s
</code>```

All tensors are created on the GPU with a Mac M1 chip ("mps"). This loop is giving me substantial memory leak, with the GPU memory basically increasing linearly and by several order of magnitude over the course of ~500 iterations.

Any suggestions on what may be causing this? I have tried to detach and clone pretty much everything in this code, to no avail. Autograd is globally disabled.

Body:
I have the following function inside a class:

    def parabola(self):
        # Initialize u1, u2, and u3 with zeros
        u1 = torch.cat((torch.diff(self.ubar.detach(), dim=0).detach().clone(), torch.zeros_like(self.ubar[:1,:,:,:], dtype = torch.float32)), dim = 0)
        u2 = torch.cat((torch.diff(self.ubar.detach(), dim=1).detach().clone(), torch.zeros_like(self.ubar[:,:1,:,:], dtype = torch.float32)), dim = 1)
        u3 = torch.cat((torch.diff(self.ubar.detach(), dim=3).detach().clone(), torch.zeros_like(self.ubar[:,:,:,:1], dtype = torch.float32)), dim = 3)

        # Stack the values of mu1 and mu2 for each value of z in the loop
        mu1sum = torch.stack([self.mu1[:,:,:,self.k_indices[z]].sum(dim=-1) for z in range(self.l)], dim=-1)
        mu2sum = torch.stack([self.mu2[:,:,:,self.k_indices[z]].sum(dim=-1) for z in range(self.l)], dim=-1)

        # Calculate u1, u2, and u3 using the formulas in the original function
        u1 = self.p1 + self.sigmap * (u1 + mu1sum)
        u2 = self.p2 + self.sigmap * (u2 + mu2sum)
        u3 = self.p3 + self.sigmap * u3

        #B = self.bound(u1,u2,self.lmbda,z+1,self.l,img)
        # Calculate B using self.bound and broadcast it along the last dimension
        k_indices = torch.arange(1, self.l+1, dtype=torch.int64).repeat(self.h, self.w, self.nc, 1)
        B = self.bound(u1, u2, self.lmbda, k_indices, self.l, self.f.unsqueeze(-1).repeat(1,1,1,self.l))

        # Use mask to select elements where u3 < B
        mask = u3 < B
        img = self.f.unsqueeze(self.f.dim()-1).expand(mask.shape)[mask]

        self.p1[~mask] = u1[~mask]
        self.p2[~mask] = u2[~mask]
        self.p3[~mask] = u3[~mask]

which is called in a loop to recursively update self.p1, self.p2, self.p3:

        p1 = torch.zeros((self.h,self.w,self.nc,self.l,), dtype = torch.float32)
        p2 = torch.zeros((self.h,self.w,self.nc,self.l,), dtype = torch.float32)
        p3 = torch.zeros((self.h,self.w,self.nc,self.l,), dtype = torch.float32)

        for iter in range(self.repeats):
            p1, p2, p3 = self.parabola(p1, p2, p3, self.ubar) # project onto parabola (set K)s

All tensors are created on the GPU with a Mac M1 chip ("mps"). This loop is giving me substantial memory leak, with the GPU memory basically increasing linearly and by several order of magnitude over the course of ~500 iterations.

Any suggestions on what may be causing this? I have tried to detach and clone pretty much everything in this code, to no avail. Autograd is globally disabled.


问:
Bruteforce 7z archive with a password list
I have a 7z file and a password list.

I want to bruteforce that file with that list.

I use Windows 10, Python 3.11.1 and 7z 22.1.0.0

My code:

```<code>path_7z: str = "C:/Program Files/7-Zip/7z.exe"
with open("passwords.txt", "r", encoding="UTF-8") as file:
    for pw in file:
        pw = pw.rstrip("/n")
        #call 7z with parameter {filepath} and {pw}, unpack archive if {pw} is correct, otherwise continue with the next {pw}
</code>```

How can I do the part in the last line?

Body:
I have a 7z file and a password list.

I want to bruteforce that file with that list.

I use Windows 10, Python 3.11.1 and 7z 22.1.0.0

My code:

path_7z: str = "C:/Program Files/7-Zip/7z.exe"
with open("passwords.txt", "r", encoding="UTF-8") as file:
    for pw in file:
        pw = pw.rstrip("/n")
        #call 7z with parameter {filepath} and {pw}, unpack archive if {pw} is correct, otherwise continue with the next {pw}

How can I do the part in the last line?


问:
How to solve QuickSight SQL exception timeout error
I have created a VIEW in Amazon Athena using:

```<code>CREATE OR REPLACE VIEW sentiment_analysis AS
SELECT
    file,
    Sentiment,
    SentimentScore.Positive AS Positive,
    SentimentScore.Negative AS Negative,
    SentimentScore.Neutral AS Neutral,
    SentimentScore.Mixed AS Mixed
FROM "targeted_sentiment_output"."sentiment_results"
</code>```

The VIEW works and populates with the data.

I am now trying to load this into Amazon QuickSight, but get the following error:

```<code>Your database generated a SQL exception. This can be caused by query timeouts, resource constraints, unexpected DDL alterations before or during a query, and other database errors. Check your database settings and your query, and try again.
</code>```

I think it may be a timeout error. I have tried to find the Advanced Settings tab to increase the query timeout limit but can't find it. Please can you provide clear instructions on where to locate the timeout limit?

If it is a different error then please explain...

Thanks!

Body:
I have created a VIEW in Amazon Athena using:

CREATE OR REPLACE VIEW sentiment_analysis AS
SELECT
    file,
    Sentiment,
    SentimentScore.Positive AS Positive,
    SentimentScore.Negative AS Negative,
    SentimentScore.Neutral AS Neutral,
    SentimentScore.Mixed AS Mixed
FROM "targeted_sentiment_output"."sentiment_results"

The VIEW works and populates with the data.

I am now trying to load this into Amazon QuickSight, but get the following error:

Your database generated a SQL exception. This can be caused by query timeouts, resource constraints, unexpected DDL alterations before or during a query, and other database errors. Check your database settings and your query, and try again.

I think it may be a timeout error. I have tried to find the Advanced Settings tab to increase the query timeout limit but can't find it. Please can you provide clear instructions on where to locate the timeout limit?

If it is a different error then please explain...

Thanks!


问:
ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: returned status code 128:
Am getting the below error when i build a job from Jenkins

```<code>Checking out git https://github.airbus.corp/Airbus/6e7c-myAuthoring.git into /var/jenkins_home/workspace/Cognitodeploy@script/e0b7ead5fba7a7068ea08dc5f7f7da6376cbb7d7f46c4a86a940337f63683bdc to read Jenkinsfilecognito
The recommended git tool is: git
using credential git-jenkins-cred
Wiping out workspace first.
Cloning the remote Git repository
Cloning repository https://github.airbus.corp/Airbus/6e7c-myAuthoring.git
 > git init /var/jenkins_home/workspace/Cognitodeploy@script/e0b7ead5fba7a7068ea08dc5f7f7da6376cbb7d7f46c4a86a940337f63683bdc # timeout=10
Fetching upstream changes from https://github.airbus.corp/Airbus/6e7c-myAuthoring.git
 > git --version # timeout=10
 > git --version # 'git version 2.31.1'
using GIT_ASKPASS to set credentials
 > git fetch --tags --force --progress -- https://github.airbus.corp/Airbus/6e7c-myAuthoring.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://github.airbus.corp/Airbus/6e7c-myAuthoring.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Enumerating objects: 56900, done.
remote: Counting objects:   0% (1/105)
remote: Counting objects:   1% (2/105)
remote: Counting objects:   2% (3/105)
remote: Counting objects:   3% (4/105)
aining
error: 248 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2675)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2099)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:85)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:619)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:848)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1226)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:159)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:70)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
ERROR: Error cloning remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException: script not yet approved for use
    at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:489)
    at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval$using$0.call(Unknown Source)
    at com.splunk.splunkjenkins.UserActionDSL.perform(UserActionDSL.groovy:39)
    at com.splunk.splunkjenkins.listeners.LoggingRunListener.onCompleted(LoggingRunListener.java:85)
    at hudson.model.listeners.RunListener.lambda$fireCompleted$0(RunListener.java:207)
    at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59)
    at jenkins.util.Listeners.notify(Listeners.java:67)
    at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:205)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:627)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:362)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
Finished: FAILURE
</code>```

Note: I have already set up a behaviour to wipe workspace repository and force clone while triggering the job.

Kindly let me know what other measures would be required to overcome this issue

Body:
Am getting the below error when i build a job from Jenkins

Checking out git https://github.airbus.corp/Airbus/6e7c-myAuthoring.git into /var/jenkins_home/workspace/Cognitodeploy@script/e0b7ead5fba7a7068ea08dc5f7f7da6376cbb7d7f46c4a86a940337f63683bdc to read Jenkinsfilecognito
The recommended git tool is: git
using credential git-jenkins-cred
Wiping out workspace first.
Cloning the remote Git repository
Cloning repository https://github.airbus.corp/Airbus/6e7c-myAuthoring.git
 > git init /var/jenkins_home/workspace/Cognitodeploy@script/e0b7ead5fba7a7068ea08dc5f7f7da6376cbb7d7f46c4a86a940337f63683bdc # timeout=10
Fetching upstream changes from https://github.airbus.corp/Airbus/6e7c-myAuthoring.git
 > git --version # timeout=10
 > git --version # 'git version 2.31.1'
using GIT_ASKPASS to set credentials
 > git fetch --tags --force --progress -- https://github.airbus.corp/Airbus/6e7c-myAuthoring.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://github.airbus.corp/Airbus/6e7c-myAuthoring.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Enumerating objects: 56900, done.
remote: Counting objects:   0% (1/105)
remote: Counting objects:   1% (2/105)
remote: Counting objects:   2% (3/105)
remote: Counting objects:   3% (4/105)
aining
error: 248 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2675)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2099)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:85)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:619)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:848)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1226)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:159)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:70)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
ERROR: Error cloning remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException: script not yet approved for use
    at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:489)
    at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval$using$0.call(Unknown Source)
    at com.splunk.splunkjenkins.UserActionDSL.perform(UserActionDSL.groovy:39)
    at com.splunk.splunkjenkins.listeners.LoggingRunListener.onCompleted(LoggingRunListener.java:85)
    at hudson.model.listeners.RunListener.lambda$fireCompleted$0(RunListener.java:207)
    at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59)
    at jenkins.util.Listeners.notify(Listeners.java:67)
    at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:205)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:627)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:362)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
Finished: FAILURE

Note: I have already set up a behaviour to wipe workspace repository and force clone while triggering the job.

Kindly let me know what other measures would be required to overcome this issue


问:
azure function app error: The specified blob does not exist
I am working with Azure function app. I used a tool called the Durable Functions Monitor (see: https://github.com/microsoft/DurableFunctionsMonitor) to attempt to cancel an in-progress orchestrator function since I no longer wished for it to complete. To do this I found the instance in the Durable Functions Monitor UI (linked above) and first "terminated" the orchestration and then "purged" it. I did this a couple times.

Since then in the log stream on my function app I am seeing the following error message:

```<code>2022-12-22T23:38:44Z   [Error]   An error occurred while processing messages on XXXXXXXXXXXXX-workitems: DurableTask.AzureStorage.Storage.DurableTaskStorageException: The specified blob does not exist.
 ---> Microsoft.WindowsAzure.Storage.StorageException: The specified blob does not exist.
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress`1 progressHandler, CancellationToken cancellationToken)
   at DurableTask.AzureStorage.Storage.AzureStorageClient.WrapFunctionWithReturnType(Func`3 storageRequest, OperationContext context, CancellationToken cancellationToken) in /_/src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 156
   at DurableTask.AzureStorage.TimeoutHandler.ExecuteWithTimeout[T](String operationName, String account, AzureStorageOrchestrationServiceSettings settings, Func`3 operation, AzureStorageOrchestrationServiceStats stats, String clientRequestId) in /_/src/DurableTask.AzureStorage/TimeoutHandler.cs:line 133
   at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func`3 storageRequest, String accountName, String operationName, String clientRequestId, Boolean force) in /_/src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 136
</code>```

Is this error related to my actions? If so:

For the present time, how can I stop this error from logging. What process is looking for this blob and how to do tell it to stop doing so

How can I safely terminate an orchestrator function in the future to prevent this state of affairs.

Bonus question:

I noticed that sometimes terminating an orchestrator does not seem to also terminate a long-ish (~ 10 min) running activity function. Is there a way to terminate an orchestration and any activities it has called using any available tool?

Body:
I am working with Azure function app. I used a tool called the Durable Functions Monitor (see: https://github.com/microsoft/DurableFunctionsMonitor) to attempt to cancel an in-progress orchestrator function since I no longer wished for it to complete. To do this I found the instance in the Durable Functions Monitor UI (linked above) and first "terminated" the orchestration and then "purged" it. I did this a couple times.

Since then in the log stream on my function app I am seeing the following error message:

2022-12-22T23:38:44Z   [Error]   An error occurred while processing messages on XXXXXXXXXXXXX-workitems: DurableTask.AzureStorage.Storage.DurableTaskStorageException: The specified blob does not exist.
 ---> Microsoft.WindowsAzure.Storage.StorageException: The specified blob does not exist.
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable`1 offset, Nullable`1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress`1 progressHandler, CancellationToken cancellationToken)
   at DurableTask.AzureStorage.Storage.AzureStorageClient.WrapFunctionWithReturnType(Func`3 storageRequest, OperationContext context, CancellationToken cancellationToken) in /_/src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 156
   at DurableTask.AzureStorage.TimeoutHandler.ExecuteWithTimeout[T](String operationName, String account, AzureStorageOrchestrationServiceSettings settings, Func`3 operation, AzureStorageOrchestrationServiceStats stats, String clientRequestId) in /_/src/DurableTask.AzureStorage/TimeoutHandler.cs:line 133
   at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func`3 storageRequest, String accountName, String operationName, String clientRequestId, Boolean force) in /_/src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 136

Is this error related to my actions? If so:

For the present time, how can I stop this error from logging. What process is looking for this blob and how to do tell it to stop doing so

How can I safely terminate an orchestrator function in the future to prevent this state of affairs.

Bonus question:

I noticed that sometimes terminating an orchestrator does not seem to also terminate a long-ish (~ 10 min) running activity function. Is there a way to terminate an orchestration and any activities it has called using any available tool?


问:
How do I deploy a Node app with EJS using Github pages?
I'm using ejs for templating. Was able to host my node.js app on Github pages when I had static html files in my root directory. But am not sure how to set the home page to a file in the views directory. How do I do this?

Not sure where to start.


问:
pip not recognized is VS Code but is in the cmd
so im trying to start my project and have to install packages using pip of course but it is saying it is not recognized as a cmd so I try doing it in the cmd prompt and it works in regular cmd prompt any fixes?

Microsoft Windows [Version 10.0.19045.2006]
(c) Microsoft Corporation. All rights reserved.

C:\Users\austi>echo %PATH%
C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\austi\AppData\Local\Microsoft\WindowsApps;C:\Users\austi\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\austi\AppData\Local\Programs\Python\Python311\Scripts;C:\Users\austi\AppData\Local\Programs\Python\Python311;C:\Users\austi\AppData\Local\Microsoft\WindowsApps;;C:\Users\austi\AppData\Local\Programs\Microsoft VS Code\bin

C:\Users\austi>


问:
How to deploy angular app to laravel forge
I have laravel forge for server management, I was able to deploy nodeJs by following this article https://www.magjoyner.com/posts/2018-08-08-using-laravel-forge-for-non-php-projects/  but wondered if can I do the same for angular app, I didn't find any clear tutorial how to do this, please advice</p>


问:
Can Any one tell me the solution? my edit options for MySQL are not being displayed in localhost phpmyadmin
SEE EDIT OPTIONS**(drop, insert, change etc)** are not available

i tried many things in the operation tag but i can't find out any solution.


问:
How to solve Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0). in Flutter
Yesterday I run my code and didn't get any error but just so sudden... (I didn't edit my code) I got an error log like this

```<code>FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0).
     Required by:
         project :app
      > Skipped due to earlier error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 8s
</code>```

I have tried by running it using another internet connection and still I get the same result. Is there a way to solve this (this error only happen when I run it using android and run so well in ios simulator)

Body:
Yesterday I run my code and didn't get any error but just so sudden... (I didn't edit my code) I got an error log like this

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0).
     Required by:
         project :app
      > Skipped due to earlier error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 8s

I have tried by running it using another internet connection and still I get the same result. Is there a way to solve this (this error only happen when I run it using android and run so well in ios simulator)


问:
How to solve " The system cannot find the path specified" error cygwin64/bin/snaphu?
snaphu path error

I was trying to open the snaphu.conf file using python

```<code>process=subprocess.Popen(snaphu_args, cwd=str(temp_path),shell=True)
</code>```

But error saying The system cannot find the file specified appears in the above line.
Is there a way to rectify this?

Body:
snaphu path error

I was trying to open the snaphu.conf file using python

process=subprocess.Popen(snaphu_args, cwd=str(temp_path),shell=True)

But error saying The system cannot find the file specified appears in the above line.
Is there a way to rectify this?


问:
Entry Validation in Python
I'm facing a problem when trying to validate an entry. The validation() function doesn't work when I click on the "Save" button. It shows the added successful message. FYI, I am using tkinter library. Please help me if you can, thanks!

```<code>from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
import os
import sys
import mysql.connector
from mysql.connector import Error

py = sys.executable

def validation():
    userName = username.get()

    try:
        if len(userName) == 0:
            errorMsg.config(text='Please enter employee username!')
            return False
        elif len(userName) > 15:
            errorMsg.config(text='The maximum length of employee username is 15!')
            return False
        else:
            return False

    except False:
        return True

errorMsg = Label(crud_window, text='', fg='black')

Label(crud_window, text='Employee Username:', bg='white', font=('Microsoft Yahei UI Light', 10, 'bold')).place(x=100, y=125)
username = Entry(crud_window, textvariable=empUsername, width=60, bd=0)
username.place(x=330, y=130)

save = Button(crud_window, text="Save", bg='#ffa500', fg='white', cursor='hand2', width=15, command=lambda: [asi(), validation()])
</code>```

Here is my error

Title: Entry Validation in Python

Body:
I'm facing a problem when trying to validate an entry. The validation() function doesn't work when I click on the "Save" button. It shows the added successful message. FYI, I am using tkinter library. Please help me if you can, thanks!

from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
import os
import sys
import mysql.connector
from mysql.connector import Error

py = sys.executable

def validation():
    userName = username.get()

    try:
        if len(userName) == 0:
            errorMsg.config(text='Please enter employee username!')
            return False
        elif len(userName) > 15:
            errorMsg.config(text='The maximum length of employee username is 15!')
            return False
        else:
            return False

    except False:
        return True

errorMsg = Label(crud_window, text='', fg='black')

Label(crud_window, text='Employee Username:', bg='white', font=('Microsoft Yahei UI Light', 10, 'bold')).place(x=100, y=125)
username = Entry(crud_window, textvariable=empUsername, width=60, bd=0)
username.place(x=330, y=130)

save = Button(crud_window, text="Save", bg='#ffa500', fg='white', cursor='hand2', width=15, command=lambda: [asi(), validation()])

Here is my error


问:
How to fix the problem for the bleak module?
Error running below code at __aexit__. Traceback posted below.

```<code>import asyncio
import time
from bleak import BleakScanner
from bleak.backends.bluezdbus.client import BleakClientBlueZDBus

ADDRESS = "EE:68:29:AB:6F:19"

async def main():
    global ADDRESS
    device = await BleakScanner.find_device_by_address(ADDRESS, timeout=20.0)
    print(device)
    if not device:
        time.sleep(0.2)
        print("Can not find device...")
    else:
        async with BleakClientBlueZDBus(device) as client:
            for service in client.services:
                print(service)

if __name__ == "__main__":
    asyncio.run(main())
</code>```

I'm using bleak module for scanning bluetooth nodes, it works on windows but facing problem on linux.This is the error:

```<code>Traceback (most recent call last):
  File "/home/hai/PycharmProjects/pythonProject/main.py", line 23, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/hai/PycharmProjects/pythonProject/main.py", line 17, in main
    async with BleakClientBlueZDBus(device) as client:
AttributeError: __aexit__
</code>```

Body:
Error running below code at __aexit__. Traceback posted below.

import asyncio
import time
from bleak import BleakScanner
from bleak.backends.bluezdbus.client import BleakClientBlueZDBus

ADDRESS = "EE:68:29:AB:6F:19"

async def main():
    global ADDRESS
    device = await BleakScanner.find_device_by_address(ADDRESS, timeout=20.0)
    print(device)
    if not device:
        time.sleep(0.2)
        print("Can not find device...")
    else:
        async with BleakClientBlueZDBus(device) as client:
            for service in client.services:
                print(service)

if __name__ == "__main__":
    asyncio.run(main())

I'm using bleak module for scanning bluetooth nodes, it works on windows but facing problem on linux.This is the error:

Traceback (most recent call last):
  File "/home/hai/PycharmProjects/pythonProject/main.py", line 23, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/hai/PycharmProjects/pythonProject/main.py", line 17, in main
    async with BleakClientBlueZDBus(device) as client:
AttributeError: __aexit__


问:
Timer not working when using defer in angular
```<code>@Input() readonly s!: number
time$ = defer(() => of(this.s)).pipe(
  switchMap((s) => timer(0, 1000).pipe(map((n)=> s - n))),
    takeWhile(n => n >0)
  )
export class timer{
  readonly SECONDS = SECONDS
}
</code>```
```<code>export const SECONDS = +(
  process.env.SECONDS || 300
)
</code>```

I am trying to make a countdown timer which goes from 5:00,4:59...0:00. When I try to implement this I can only see 0:00 on the screen.

app HTML file

```<code><p class="description">
      timer
      <timer
        [s]="SECONDS"
      ></timer>
    </p>
</code>```

Timer HTML file

```<code><p>{{ time$ | async | date: 'mm:ss' }} minutes</p>
</code>```

Body:
@Input() readonly s!: number
time$ = defer(() => of(this.s)).pipe(
  switchMap((s) => timer(0, 1000).pipe(map((n)=> s - n))),
    takeWhile(n => n >0)
  )
export class timer{
  readonly SECONDS = SECONDS
}

export const SECONDS = +(
  process.env.SECONDS || 300
)

I am trying to make a countdown timer which goes from 5:00,4:59...0:00. When I try to implement this I can only see 0:00 on the screen.

app HTML file

      timer
      <timer
        [s]="SECONDS"
      ></timer>

Timer HTML file

{{ time$ | async | date: 'mm:ss' }} minutes


问:
<Issue> Apache Hive: Can't insert record after adding column
I use Hive 3.1.0.3.1.0.0-78.

Create source table with statement:

```<code>CREATE TABLE IF NOT EXISTS core.source_jira
(
    pk_jira             BIGINT DEFAULT SURROGATE_KEY(),
    test_1                  STRING,
    test_2                  STRING,
    valid                   BOOLEAN,
    PRIMARY KEY (pk_jira) DISABLE NOVALIDATE
)
    STORED AS ORC
    LOCATION '/warehouse/tablespace/managed/hive/core.db/source_jira'
    TBLPROPERTIES (
        "orc.compress" = "SNAPPY",
        "transactional" = "true",
        "NO_AUTO_COMPACTION"="TRUE"
    )
;

INSERT INTO TABLE core.source_jira(test_1, test_2, valid)
SELECT "text_1", "text_2", TRUE;
</code>```

Check table data with select:
SELECT * from core.source_jira

pk_jira
test_1
test_2
valid

1099511627776
text_1
text_2
true

Create destination table with statement:

```<code>CREATE TABLE IF NOT EXISTS core.destination_jira
(
    pk_jira             BIGINT DEFAULT SURROGATE_KEY(),
    test_1                  STRING,
    test_2                  STRING,
    valid                   BOOLEAN,
    PRIMARY KEY (pk_jira) DISABLE NOVALIDATE
)
    STORED AS ORC
    LOCATION '/warehouse/tablespace/managed/hive/core.db/destination_jira'
    TBLPROPERTIES (
        "orc.compress" = "SNAPPY",
        "transactional" = "true",
        "NO_AUTO_COMPACTION"="TRUE"
    )
;
</code>```

Add column:
ALTER TABLE core.destination_jira ADD COLUMNS (jira_type STRING);

Insert data statement:
insert into table core.destination_jira (test_1, test_2, valid) select test_1, test_2, valid from core.source_jira

I got an error:
SQL Error [40000] [42000]: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException

```<code>org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [40000] [42000]: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:577)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$1(SQLQueryJob.java:486)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:172)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:493)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:894)
    at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3645)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:123)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:172)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:121)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4949)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:279)
    at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:265)
    at org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:303)
    at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:244)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:329)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.lambda$0(JDBCStatementImpl.java:131)
    at org.jkiss.dbeaver.utils.SecurityManagerUtils.wrapDriverActions(SecurityManagerUtils.java:94)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:131)
    ... 12 more
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:335)
    at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:199)
    at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:262)
    at org.apache.hive.service.cli.operation.Operation.run(Operation.java:247)
    at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:575)
    at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:561)
    at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
    at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
    at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)
    at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59)
    at com.sun.proxy.$Proxy47.executeStatementAsync(Unknown Source)
    at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
    at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:566)
    at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1557)
    at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1542)
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
    at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
    at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getColNameToDefaultValueMap(SemanticAnalyzer.java:750)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getColForInsertStmtSpec(SemanticAnalyzer.java:4620)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.handleInsertStatementSpec(SemanticAnalyzer.java:4735)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:4580)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:4326)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPostGroupByBodyPlan(SemanticAnalyzer.java:10662)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:10601)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:11530)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:11400)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:12202)
    at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:620)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:12292)
    at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:360)
    at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:289)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:664)
    at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1869)
    at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1816)
    at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1811)
    at org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126)
    at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:197)
    ... 26 more
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException:java.lang.NullPointerException
    at org.apache.hadoop.hive.ql.metadata.Hive.getEnabledDefaultConstraints(Hive.java:5389)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getColNameToDefaultValueMap(SemanticAnalyzer.java:744)
    ... 45 more
Caused by: java.lang.NullPointerException: null
</code>```

Body:
I use Hive 3.1.0.3.1.0.0-78.

Create source table with statement:

CREATE TABLE IF NOT EXISTS core.source_jira
(
    pk_jira             BIGINT DEFAULT SURROGATE_KEY(),
    test_1                  STRING,
    test_2                  STRING,
    valid                   BOOLEAN,
    PRIMARY KEY (pk_jira) DISABLE NOVALIDATE
)
    STORED AS ORC
    LOCATION '/warehouse/tablespace/managed/hive/core.db/source_jira'
    TBLPROPERTIES (
        "orc.compress" = "SNAPPY",
        "transactional" = "true",
        "NO_AUTO_COMPACTION"="TRUE"
    )
;

INSERT INTO TABLE core.source_jira(test_1, test_2, valid)
SELECT "text_1", "text_2", TRUE;

Check table data with select:
SELECT * from core.source_jira

pk_jira
test_1
test_2
valid

1099511627776
text_1
text_2
true

Create destination table with statement:

CREATE TABLE IF NOT EXISTS core.destination_jira
(
    pk_jira             BIGINT DEFAULT SURROGATE_KEY(),
    test_1                  STRING,
    test_2                  STRING,
    valid                   BOOLEAN,
    PRIMARY KEY (pk_jira) DISABLE NOVALIDATE
)
    STORED AS ORC
    LOCATION '/warehouse/tablespace/managed/hive/core.db/destination_jira'
    TBLPROPERTIES (
        "orc.compress" = "SNAPPY",
        "transactional" = "true",
        "NO_AUTO_COMPACTION"="TRUE"
    )
;

Add column:
ALTER TABLE core.destination_jira ADD COLUMNS (jira_type STRING);

Insert data statement:
insert into table core.destination_jira (test_1, test_2, valid) select test_1, test_2, valid from core.source_jira

I got an error:
SQL Error [40000] [42000]: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException

org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error [40000] [42000]: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:577)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$1(SQLQueryJob.java:486)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:172)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:493)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:894)
    at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3645)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:123)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:172)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:121)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4949)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:279)
    at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:265)
    at org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:303)
    at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:244)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:329)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.lambda$0(JDBCStatementImpl.java:131)
    at org.jkiss.dbeaver.utils.SecurityManagerUtils.wrapDriverActions(SecurityManagerUtils.java:94)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:131)
    ... 12 more
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: RuntimeException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:335)
    at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:199)
    at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:262)
    at org.apache.hive.service.cli.operation.Operation.run(Operation.java:247)
    at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:575)
    at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:561)
    at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
    at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
    at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)
    at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59)
    at com.sun.proxy.$Proxy47.executeStatementAsync(Unknown Source)
    at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
    at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:566)
    at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1557)
    at org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1542)
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
    at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
    at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.NullPointerException
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getColNameToDefaultValueMap(SemanticAnalyzer.java:750)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getColForInsertStmtSpec(SemanticAnalyzer.java:4620)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.handleInsertStatementSpec(SemanticAnalyzer.java:4735)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:4580)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:4326)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPostGroupByBodyPlan(SemanticAnalyzer.java:10662)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:10601)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:11530)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:11400)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:12202)
    at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:620)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:12292)
    at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:360)
    at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:289)
    at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:664)
    at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1869)
    at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1816)
    at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1811)
    at org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:126)
    at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:197)
    ... 26 more
Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException:java.lang.NullPointerException
    at org.apache.hadoop.hive.ql.metadata.Hive.getEnabledDefaultConstraints(Hive.java:5389)
    at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.getColNameToDefaultValueMap(SemanticAnalyzer.java:744)
    ... 45 more
Caused by: java.lang.NullPointerException: null


问:
Nginx Configuration for react production deployment
In the React project, I used proxy in package.json to route the traffic of backend api calls to the backend server address.enter image description here. And in the project, I used axios to send requests such as: enter image description here I do not have to add any prefix in the request of axios api calls. However, what should I config in the Nginx after I running npm run build in the nginx.conf?

Here is the nginx config file, in which I have already defined a "/" proxyenter image description here What should I write to route the traffic of api calls in the production environment?


问:
Use the redis lock
There is a business scenario: there are operations of adding, deleting and modifying, and no other operations can be performed during each operation. I want to use redis lock, and I would like to ask whether the key value of the lock can be set to a fixed String.

Will my idea solve the problem? Or there's a better way

Title: Use the redis lock


问:
Laravel's nested relation first element
Okay, so after much googling... I have come across a unique case for Laravel.

I want to obtain the first element of the collection (not an array) and then with the nested relation also obtain the first element.

For example:

auth()->user()->marks()->with('subjects', function($q) {
  $q->first();
})->first();
```
<p>returns (note that subjects is an <code>array</code> but the code states <code>first</code>)</p>
<pre class="lang-json prettyprint-override"><code>{
   "id": 1,
   "name": "Ahsan",
   "mark": 369,
    ...
   "subjects": [{...}]
}
</code>```

Instead the query should have returned (b/c $q->first() returns the first element):

{
   "id": 1,
   "name": "Ahsan",
   "mark": 369,
    ...
   "subjects": {...}
}
```

Qq: How can I modify the query to get the first subject without complicating the query? Am I missing something crucial here regarding with and first?

Aside:
Marks is One-to-Many relation. 369 can return multiple subjects if needed, but since I require the first it should be an element not an array of single element.

Title: Laravel's nested relation first element

Body:
Okay, so after much googling... I have come across a unique case for Laravel.

I want to obtain the first element of the collection (not an array) and then with the nested relation also obtain the first element.

For example:

auth()->user()->marks()->with('subjects', function($q) {
  $q->first();
})->first();

returns (note that subjects is an array but the code states first)

{
   "id": 1,
   "name": "Ahsan",
   "mark": 369,
    ...
   "subjects": [{...}]
}

Instead the query should have returned (b/c $q->first() returns the first element):

{
   "id": 1,
   "name": "Ahsan",
   "mark": 369,
    ...
   "subjects": {...}
}

Qq: How can I modify the query to get the first subject without complicating the query? Am I missing something crucial here regarding with and first?

Aside:
Marks is One-to-Many relation. 369 can return multiple subjects if needed, but since I require the first it should be an element not an array of single element.


问:
Java Graphics are not painted with exact coordinates which prevents correct sensing with hitboxes for game
I am creating a game using Java Swing and Graphics in which I need to sense when the player comes into contact with some obstacles. I am trying to compare when their hitboxes overlap but it seems for some obstacles the exact boxes I see on the screen don't compare exactly to coordinates being compared between player and object. They are close but not exact. Therefore, if the player is slightly to the right or left of the object he will sometimes act as though he touched it even though the hitboxes do not visually overlap.  The printed out coordinates show they overlap even though this is not what is shown on screen.  I can fix this by adding a "wobble" to the inequalities I am comparing, a relatively small, hard coded value which I have to figure out and is not that precise. Is this an issue with Graphics just not being that exact? Is there a way to fix this?

```<code> public boolean isTouching(Player p)

  {

      if (p.getX()<this.getXHitBox()+this.getWHitBox() && p.getX()+p.getWidth()>=this.getXHitBox() && p.getY()+p.getHeight()>this.getYHitBox() && p.getY()<=this.getYHitBox()+this.getHHitBox())
        {
            //some stuff

            return true;
        }

      return false;

  }
</code>```

XhitBox is the x value of the hitbox (x + xOffset)
YHitBox is the y value (y+yOffset)
HHitBox is the height value
WHitBox is the width value

hitbox is set for obstacles as such:

```<code>hitbox=new Rectangle2D.Float( (float) (x + xOffset), (float) (y + yOffset), w, h);
</code>```

and drawn like this:

```<code> public void drawHitbox(Graphics g)

   {

       g.setColor(Color.RED);

        Graphics2D g2d = (Graphics2D) g;
       g2d.draw(hitbox);

   }
</code>```

I expected the sensing to only occur when the hitbox visually overlapped but the hitboxes are just slightly off (wobble= approx. 15) from reality. Why is that?
I tried printing out the coordinates and they are different from what is shown on screen! Even if the player is still slightly more to the right than the obstacle, according to the coordinates he is a little more to the left and touching the obstacle.

ie Obstacle will be to the left with x coordinates 88 (for x + width)
Player will be slightly to the right of the obstacle with coordinates 77. What gives?

Body:
I am creating a game using Java Swing and Graphics in which I need to sense when the player comes into contact with some obstacles. I am trying to compare when their hitboxes overlap but it seems for some obstacles the exact boxes I see on the screen don't compare exactly to coordinates being compared between player and object. They are close but not exact. Therefore, if the player is slightly to the right or left of the object he will sometimes act as though he touched it even though the hitboxes do not visually overlap.  The printed out coordinates show they overlap even though this is not what is shown on screen.  I can fix this by adding a "wobble" to the inequalities I am comparing, a relatively small, hard coded value which I have to figure out and is not that precise. Is this an issue with Graphics just not being that exact? Is there a way to fix this?

 public boolean isTouching(Player p)

  {

      if (p.getX()<this.getXHitBox()+this.getWHitBox() && p.getX()+p.getWidth()>=this.getXHitBox() && p.getY()+p.getHeight()>this.getYHitBox() && p.getY()<=this.getYHitBox()+this.getHHitBox())
        {
            //some stuff

            return true;
        }

      return false;

  }

XhitBox is the x value of the hitbox (x + xOffset)
YHitBox is the y value (y+yOffset)
HHitBox is the height value
WHitBox is the width value

hitbox is set for obstacles as such:

hitbox=new Rectangle2D.Float( (float) (x + xOffset), (float) (y + yOffset), w, h);

and drawn like this:

 public void drawHitbox(Graphics g)

   {

       g.setColor(Color.RED);

        Graphics2D g2d = (Graphics2D) g;
       g2d.draw(hitbox);

   }

I expected the sensing to only occur when the hitbox visually overlapped but the hitboxes are just slightly off (wobble= approx. 15) from reality. Why is that?
I tried printing out the coordinates and they are different from what is shown on screen! Even if the player is still slightly more to the right than the obstacle, according to the coordinates he is a little more to the left and touching the obstacle.

ie Obstacle will be to the left with x coordinates 88 (for x + width)
Player will be slightly to the right of the obstacle with coordinates 77. What gives?


问:
Installing old versions of llvm
I am trying to install old version of llvm via brew extract.

This is what I am running:

```<code>brew unlink llvm
brew tap-new llvm/llvm-project
brew extract --version='13.0.0' llvm llvm/llvm-project
brew install llvm@13.0.0
</code>```

This is the error I get:

```<code>/usr/local/Homebrew/Library/Homebrew/utils/github/api.rb:311:in `raise_error': Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] (GitHub::API::ValidationFailedError)
</code>```

This is the url its trying to reach:

```<code>https://api.github.com/search/issues?q=llvm%4013.0.0+repo%3Allvm%2Fhomebrew-llvm-project+state%3Aopen+in%3Atitle&per_page=100
</code>```

I have gone through this answer ,
I don't understand whose read permission is required. llvm-project is already a public repo.

@mehnaz can you please take a look. I wanted to comment on your question but being a new stackoverflow user I don't seen to have the privilege.

Title: Installing old versions of llvm

Body:
I am trying to install old version of llvm via brew extract.

This is what I am running:

brew unlink llvm
brew tap-new llvm/llvm-project
brew extract --version='13.0.0' llvm llvm/llvm-project
brew install llvm@13.0.0

This is the error I get:

/usr/local/Homebrew/Library/Homebrew/utils/github/api.rb:311:in `raise_error': Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] (GitHub::API::ValidationFailedError)

This is the url its trying to reach:

https://api.github.com/search/issues?q=llvm%4013.0.0+repo%3Allvm%2Fhomebrew-llvm-project+state%3Aopen+in%3Atitle&per_page=100

I have gone through this answer ,
I don't understand whose read permission is required. llvm-project is already a public repo.

@mehnaz can you please take a look. I wanted to comment on your question but being a new stackoverflow user I don't seen to have the privilege.


问:
Translating an AST with clang RecursiveASTVisitor
The RecursiveASTVisitor class implements a stateless visitor for the AST of some source. I would like to process the AST into some JSON that describes the parent classes, methods and their arguments, etc. RecursiveASTVisitor doesn't really seem to have facilities for returning stuff up to parent node visits or passing stuff down to child node visitors, so I'm not sure how I'm meant to maintain the context of the tree traversal.

What's the right way to traverse the AST while building up my own tree?


问:
How to delete specific event listener on an element in JavaScript?
On DevTools, I can delete specific event Listener using the DevTools feature.

However, I don't know how to delete it in JS without using this feature.

If there is an event Listener object in the current scope, I can delete it with the removeEventListener function, but the object does not exist.

For example, I tried to delete the b event but failed because there was no b.

How to delete specific event Listener in JS?


问:
Orange text in VS code when writing in Java
I have recently set up my VS code to be able to run Java. I downloaded the extension pack for java and then downloaded Azul Zulu jdk to run java programs. So far it runs fine, but for certain snippets of code orange blocks of text will appear. They cannot be deleted or modified in any way, and I haven't changed any settings besides changing VS code to use the Zulu jdk as my default jdk.

Example of the orange blocks I'm getting

I have tried going through my setting related to Java in my VS code, but I can't find anything that would cause this. I haven't done anything besides set up my default jdk and installing the extension for java.

Any help with getting rid of these orange blocks would be appreciated.

Edit:

Java> Inlay Hints > parameter names: Enabled, was the setting that was causing it. Setting this to none fixed the issue. I was confused as the guide I was following did not mention this, nor did it show up on their visual examples when writing code, even though our methods from installing to writing java would have been the same.


问:
there is error when hit api Could not write JSON: Object is null
when I hit save to database, there is field is null like updated at and updated by. when I try to return it to controller there is error (Could not write JSON: Object is null)

Caused by: net.sf.json.JSONException: Object is null

```<code>@PostMapping(value = "/saving",produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Map<String, Object>> save(
        @RequestHeader(value = "apps") String apps,
        @RequestHeader(value = "module") String module,
        @Valid @RequestBody CreateTemplate requestData) throws IOException, InterruptedException, URISyntaxException, ApiResponseThrow
    {

        log.info("START saveTemplateQontak function");
        Map<String, Object> result = new HashMap<>();

        String jwt = AuthTokenFilter.parseJwt(request);
        String username = jwtUtils.getUserNameFromJwtToken(jwt);

        LogFormat logFormat = new LogFormat();
        logFormat.setAction("saving");
        logFormat.setApps(apps);
        logFormat.setModule(module);
        logFormat.setUser(username);
        log.info("DATA BEFORE == {}", objectMapper.writeValueAsString(requestData));
        log.info("log-format == {}", logFormat);

        // JSONObject token = qontakService.getTokenQontak();
        // JSONObject res = qontakService.saveTemplateToQontak(objectMapper.writeValueAsString(requestData), token.get("access_token").toString());
        // requestData.getAttributes().get(0).getComponents().get(0).getType()
        JSONObject res = templateService.saveHeaderTemplate(requestData, logFormat);
        log.info("END templateService.save() CREATE");

        result.put("httpCode", HttpStatus.OK);
        result.put("status", "00");
        result.put("message", "Success Saving");
        result.put("details",res);

        log.info("END save function");

        return new ResponseEntity<Map<String, Object>>(result, HttpStatus.OK);
    }
</code>```

error result is com.fasterxml.jackson.databind.JsonMappingException: Object is null (through reference chain: java.util.HashMap["details"]->net.sf.json.JSONObject["template"]->net.sf.json.JSONObject["createTemplate"]->net.sf.json.JSONObject["attributes"]->net.sf.json.JSONArray[0]->net.sf.json.JSONObject["components"]->net.sf.json.JSONArray[1]->net.sf.json.JSONObject["example"]->net.sf.json.JSONNull["empty"])

Thank you.

Body:
when I hit save to database, there is field is null like updated at and updated by. when I try to return it to controller there is error (Could not write JSON: Object is null)

Caused by: net.sf.json.JSONException: Object is null

@PostMapping(value = "/saving",produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Map<String, Object>> save(
        @RequestHeader(value = "apps") String apps,
        @RequestHeader(value = "module") String module,
        @Valid @RequestBody CreateTemplate requestData) throws IOException, InterruptedException, URISyntaxException, ApiResponseThrow
    {

        log.info("START saveTemplateQontak function");
        Map<String, Object> result = new HashMap<>();

        String jwt = AuthTokenFilter.parseJwt(request);
        String username = jwtUtils.getUserNameFromJwtToken(jwt);

        LogFormat logFormat = new LogFormat();
        logFormat.setAction("saving");
        logFormat.setApps(apps);
        logFormat.setModule(module);
        logFormat.setUser(username);
        log.info("DATA BEFORE == {}", objectMapper.writeValueAsString(requestData));
        log.info("log-format == {}", logFormat);

        // JSONObject token = qontakService.getTokenQontak();
        // JSONObject res = qontakService.saveTemplateToQontak(objectMapper.writeValueAsString(requestData), token.get("access_token").toString());
        // requestData.getAttributes().get(0).getComponents().get(0).getType()
        JSONObject res = templateService.saveHeaderTemplate(requestData, logFormat);
        log.info("END templateService.save() CREATE");

        result.put("httpCode", HttpStatus.OK);
        result.put("status", "00");
        result.put("message", "Success Saving");
        result.put("details",res);

        log.info("END save function");

        return new ResponseEntity<Map<String, Object>>(result, HttpStatus.OK);
    }

error result is com.fasterxml.jackson.databind.JsonMappingException: Object is null (through reference chain: java.util.HashMap["details"]->net.sf.json.JSONObject["template"]->net.sf.json.JSONObject["createTemplate"]->net.sf.json.JSONObject["attributes"]->net.sf.json.JSONArray[0]->net.sf.json.JSONObject["components"]->net.sf.json.JSONArray[1]->net.sf.json.JSONObject["example"]->net.sf.json.JSONNull["empty"])

Thank you.


问:
Read data from USB threw STM32
I want to read .txt file from Pendrive threw STM32. and send on RS232 port.

I found many circuit and code but I find read data from SD card but I cant find how to read pendrive.

Title: Read data from USB threw STM32