问:
Django :Retrieve files from django model with signed urls from different buckets
Hope everyone doing good

I want to upload some files in different buckets and the bucket names are also stored in adjescent django field in same table. How can i retrieve that bucket name and use for upload in storage option in FileField and retrieve signed url,The below is my table looks like

```<code>class TestFileField(models.Model):
    id = models.AutoField(primary_key=True,blank=True,null=True)
    name = models.CharField(max_length=30,null=True,blank=True)
    **bucketname** = models.CharField(max_length=30,null=True,blank=True)
    sourcefile = models.FileField(upload_to=get_upload_path, blank=True,storage = GoogleCloudStorage(bucket_name = **bucketname <-- i want a value which stored in the above bucketname field** ))

</code>```

Or Im also trying like this,

```<code>@deconstructible
class CustomBucketSelection(GoogleCloudStorage):
    def __init__(self,*args,**kwargs):
        kwargs['bucket_name'] = 'mybucket' or settings.bucket
        super(CustomBucketSelection,self).__init__(*args,**kwargs)
    def url(self, name):
        bucketname = current_instance.bucket_name
        -----------------------------
        i want current instance here to fetch the bucket name or credentials
        which stores in same database.
        once i got bucket name i will generate signed url  and returns that url
        -----------------------------------
        return urll
class TestFileField(models.Model):
    id = models.AutoField(primary_key=True,blank=True,null=True)
    name = models.CharField(max_length=30,null=True,blank=True)
    bucket_name = models.CharField(max_length=30,null=True,blank=True,default=settings.GS_BUCKET_NAME)
    file = models.FileField(upload_to=get_upload_path, blank=True,storage = CustomBucketSelection)
</code>```

Actually the thing is while im saving files its perfectly storing but while im retrieving the files, i want signed urls with that corresponding storage buckets , so im trying like this, Please confirm me that, is it possible or not , If YES please help me in this

Body:
Hope everyone doing good

I want to upload some files in different buckets and the bucket names are also stored in adjescent django field in same table. How can i retrieve that bucket name and use for upload in storage option in FileField and retrieve signed url,The below is my table looks like

class TestFileField(models.Model):
    id = models.AutoField(primary_key=True,blank=True,null=True)
    name = models.CharField(max_length=30,null=True,blank=True)
    **bucketname** = models.CharField(max_length=30,null=True,blank=True)
    sourcefile = models.FileField(upload_to=get_upload_path, blank=True,storage = GoogleCloudStorage(bucket_name = **bucketname <-- i want a value which stored in the above bucketname field** ))

Or Im also trying like this,

@deconstructible
class CustomBucketSelection(GoogleCloudStorage):
    def __init__(self,*args,**kwargs):
        kwargs['bucket_name'] = 'mybucket' or settings.bucket
        super(CustomBucketSelection,self).__init__(*args,**kwargs)
    def url(self, name):
        bucketname = current_instance.bucket_name
        -----------------------------
        i want current instance here to fetch the bucket name or credentials
        which stores in same database.
        once i got bucket name i will generate signed url  and returns that url
        -----------------------------------
        return urll
class TestFileField(models.Model):
    id = models.AutoField(primary_key=True,blank=True,null=True)
    name = models.CharField(max_length=30,null=True,blank=True)
    bucket_name = models.CharField(max_length=30,null=True,blank=True,default=settings.GS_BUCKET_NAME)
    file = models.FileField(upload_to=get_upload_path, blank=True,storage = CustomBucketSelection)

Actually the thing is while im saving files its perfectly storing but while im retrieving the files, i want signed urls with that corresponding storage buckets , so im trying like this, Please confirm me that, is it possible or not , If YES please help me in this


来源: stackexchange

问:
simple-git not working when generating electron build for MAC OSX
I'm trying to do a git clone with SSH, using simple-git in an electron app.

If I run in dev mode, everything goes well, and I can clone the repo, but when I build the application to a native mac osx app (*.app), I'm always getting an error saying:

GitError: fatal: not a git repository (or any of the parent directories): .git

But this message has no sense since I'm doing a git clone

The code that I'm executing is something like this (it works if I run dev):

```<code>simpleGit()
.env('GIT_SSH_COMMAND',ssh -o UserKnownHostsFile=miHostFile -o StrictHostKeyChecking=no -i my_secret_key`)
.clean(CleanOptions.FORCE)
.clone(
   `git@github.com:remote-repo.git`,
   '.Users/user_name',
   ['-b', master,'--single-branch']
)
</code>```

I'm wondering if this could be for a COORS problem or any other thing that I'm not allowed to do from an app

ContentLicense: CC BY-SA 4.0

Body:
I'm trying to do a git clone with SSH, using simple-git in an electron app.

If I run in dev mode, everything goes well, and I can clone the repo, but when I build the application to a native mac osx app (*.app), I'm always getting an error saying:

GitError: fatal: not a git repository (or any of the parent directories): .git

But this message has no sense since I'm doing a git clone

The code that I'm executing is something like this (it works if I run dev):

simpleGit()
.env('GIT_SSH_COMMAND',ssh -o UserKnownHostsFile=miHostFile -o StrictHostKeyChecking=no -i my_secret_key`)
.clean(CleanOptions.FORCE)
.clone(
   `git@github.com:remote-repo.git`,
   '.Users/user_name',
   ['-b', master,'--single-branch']
)

I'm wondering if this could be for a COORS problem or any other thing that I'm not allowed to do from an app


问:
Override __init__ of third party library parent class in python
I have the current (simplified) code structure:

```<code>########### 3rd party library ##############
class LibraryClassA:
    def __int__(self):
        pass

class LibraryClassB(LibraryClassA):
    def __init__(self, cfg):
        super().__init__()
        self.cfg = cfg

    def func(self):
        print("Do something")

###########################################

class UserDefinedClass(LibraryClassB):
    def new_init(self):
        print("The new init function")

    def func(self):
        print("Do something else")

def main():
    class = UserDefinedClass(cfg="CONF")

</code>```

Basically I want to override the original init function of the LibraryClassB (that is a third party library class) and use a new init function defined in my class  UserDefinedClass.

Is there a way to do so?

Body:
I have the current (simplified) code structure:

########### 3rd party library ##############
class LibraryClassA:
    def __int__(self):
        pass

class LibraryClassB(LibraryClassA):
    def __init__(self, cfg):
        super().__init__()
        self.cfg = cfg

    def func(self):
        print("Do something")

###########################################

class UserDefinedClass(LibraryClassB):
    def new_init(self):
        print("The new init function")

    def func(self):
        print("Do something else")

def main():
    class = UserDefinedClass(cfg="CONF")

Basically I want to override the original init function of the LibraryClassB (that is a third party library class) and use a new init function defined in my class  UserDefinedClass.

Is there a way to do so?


问:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'Cumque esse a adipis' for column 'tag_id' at row 1
I got an error like that, I've tried various ways but haven't found a solution.

App\Models\Post

```<code>public function tags()
{
    return $this->belongsToMany(Tag::class);
}
</code>```

App\Models\Tag

```<code>public function posts()
{
    return $this->belongsToMany(Post::class);
}
</code>```

PostController

```<code>public function store(Request $request)
{
    //dd($request->all());
    $this->validate($request, [
        'title' => 'required|string|max:255',
        'description' => 'required',
        'category' => 'required',
        'tag' => 'required',
    ]);

    Post::create([
        'title' => $request->title,
        'description'   => $request->description,
        'category_id'   => $request->category,
        'user_id'       => Auth()->id()
    ])->tags()->attach($request->tag);

    return redirect()->route('blog.create')->with('status', 'Post Created Successfully');
}
</code>```

Please guide me.....

Body:
I got an error like that, I've tried various ways but haven't found a solution.

App\Models\Post

public function tags()
{
    return $this->belongsToMany(Tag::class);
}

App\Models\Tag

public function posts()
{
    return $this->belongsToMany(Post::class);
}

PostController

public function store(Request $request)
{
    //dd($request->all());
    $this->validate($request, [
        'title' => 'required|string|max:255',
        'description' => 'required',
        'category' => 'required',
        'tag' => 'required',
    ]);

    Post::create([
        'title' => $request->title,
        'description'   => $request->description,
        'category_id'   => $request->category,
        'user_id'       => Auth()->id()
    ])->tags()->attach($request->tag);

    return redirect()->route('blog.create')->with('status', 'Post Created Successfully');
}

Please guide me.....


问:
Spring Boot with Apache Cassandra and liquibase
I want to integrate Spring Boot (2.4.13) with Apache Cassandra and liquibase. My goal very simple, to insert changestes during application startup. I found a lot of examples/tutorials  but not for my setup. My problem is that liquibase is not working. There is nothing in logs and nothing changed in DB.

Does someone know what could be wrong with my config or what I did wrong?

My pom.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.13</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>Cassandra</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Cassandra</name>
    <description>Cassandra</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-cassandra</artifactId>
        </dependency>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>3.11.3</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-cassandra</artifactId>
            <version>3.10.2</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
</code>```

My application.properties

```<code>spring.data.cassandra.keyspace-name=test
spring.data.cassandra.port=9042
spring.data.cassandra.password=cassandra
spring.data.cassandra.username=cassandra
spring.data.cassandra.contact-points=127.0.0.1
spring.data.cassandra.local-datacenter=datacenter1
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.xml
</code>```

My changelog-master.xml

```<code><?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">

    <changeSet id="202010211812" author="test">
        <createTable tableName="testtt">
            <column name="tableone" type="BOOLEAN"/>
        </createTable>
    </changeSet>
</databaseChangeLog>
</code>```

My project structure

Body:
I want to integrate Spring Boot (2.4.13) with Apache Cassandra and liquibase. My goal very simple, to insert changestes during application startup. I found a lot of examples/tutorials  but not for my setup. My problem is that liquibase is not working. There is nothing in logs and nothing changed in DB.

Does someone know what could be wrong with my config or what I did wrong?

My pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.13</version>
        <relativePath/>
    </parent>
    <groupId>com.example</groupId>
    <artifactId>Cassandra</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Cassandra</name>
    <description>Cassandra</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-cassandra</artifactId>
        </dependency>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>3.11.3</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-cassandra</artifactId>
            <version>3.10.2</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

My application.properties

spring.data.cassandra.keyspace-name=test
spring.data.cassandra.port=9042
spring.data.cassandra.password=cassandra
spring.data.cassandra.username=cassandra
spring.data.cassandra.contact-points=127.0.0.1
spring.data.cassandra.local-datacenter=datacenter1
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.xml

My changelog-master.xml

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">

    <changeSet id="202010211812" author="test">
        <createTable tableName="testtt">
            <column name="tableone" type="BOOLEAN"/>
        </createTable>
    </changeSet>
</databaseChangeLog>

My project structure


问:
Webpack config file (webpack.config.js) not working as expected
I have an Angular project on Linux that generally works.

```<code>Angular CLI: 13.3.9
Node: 16.14.2

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.18
@angular-devkit/build-angular   13.3.9
@angular-devkit/core            12.2.18
@angular-devkit/schematics      13.3.9
@angular/cli                    13.3.9
@schematics/angular             13.3.9
rxjs                            7.5.6
typescript                      4.6.4
</code>```

But when trying to ng serve the project, I am sometimes getting an endless stream of error messages such as

```<code>Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/home/me/my_project/node_modules/libp2p-utils/dist'
</code>```

so I have to stop the process and then ng serve fails.

I wanted to solve this problem so I found this answer:

https://stackoverflow.com/a/72423671

I followed the instructions and then based on the following documentation

https://webpack.js.org/configuration/watch/#watch

I went ahead and had the following content in the new webpack.config.js file that I created:

```<code>module.exports = {
  //...
  watch: false,
};
</code>```

Now, I think that that was supposed to make Webpack not watch any file.

But when I do ng serve, again I am getting what seems to be the same error messages as before. It seems like Webpack keeps watching those node_modules files.

I think the ng serve does see the webpack.config.js file, because when I change the setting to watch: blah,, I am getting the error message

```<code>An unhandled exception occurred: blah is not defined
</code>```

I have also tried the following:

```<code>module.exports = {
  //...
  watchOptions: {
    ignored: '**/node_modules',
  },
};
</code>```

But again, the same error messages.

Why doesn't the Webpack config work as expected?

Body:
I have an Angular project on Linux that generally works.

Angular CLI: 13.3.9
Node: 16.14.2

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.18
@angular-devkit/build-angular   13.3.9
@angular-devkit/core            12.2.18
@angular-devkit/schematics      13.3.9
@angular/cli                    13.3.9
@schematics/angular             13.3.9
rxjs                            7.5.6
typescript                      4.6.4

But when trying to ng serve the project, I am sometimes getting an endless stream of error messages such as

Watchpack Error (watcher): Error: ENOSPC: System limit for number of file watchers reached, watch '/home/me/my_project/node_modules/libp2p-utils/dist'

so I have to stop the process and then ng serve fails.

I wanted to solve this problem so I found this answer:

https://stackoverflow.com/a/72423671

I followed the instructions and then based on the following documentation

https://webpack.js.org/configuration/watch/#watch

I went ahead and had the following content in the new webpack.config.js file that I created:

module.exports = {
  //...
  watch: false,
};

Now, I think that that was supposed to make Webpack not watch any file.

But when I do ng serve, again I am getting what seems to be the same error messages as before. It seems like Webpack keeps watching those node_modules files.

I think the ng serve does see the webpack.config.js file, because when I change the setting to watch: blah,, I am getting the error message

An unhandled exception occurred: blah is not defined

I have also tried the following:

module.exports = {
  //...
  watchOptions: {
    ignored: '**/node_modules',
  },
};

But again, the same error messages.

Why doesn't the Webpack config work as expected?


问:
How to deal with longestCommonPrefix?
I am trying to resolve the LongestCommonPrefix problem on leet code.
I am stuck to pass this test :

```<code>["a","a","b"]
</code>```

The expected output is "", but the result is : 'a'.

Here is my code :

```<code>def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        prefix_list = list()
        j = 0
        i = 0

        min_ = min(strs, key=len)
        if len(list(set(strs))) == 1:
            return strs[0]

        while i < len(strs) and 0 < len(strs) < 201:
            word = strs[i]

            if  len(word) < 201 and word != "":

                if i + 1 < len(strs) and j < len(min_)  and word[j] == strs[i+1][j]:
                    prefix_list.append(word[j])
                    j += 1
                    i += 1
                else:
                    return u''.join(prefix_list)

            else:
                return ""
</code>```

I tried to check if len(prefix_list) is equal to i but no effective result..

Title: How to deal with longestCommonPrefix?

Body:
I am trying to resolve the LongestCommonPrefix problem on leet code.
I am stuck to pass this test :

["a","a","b"]

The expected output is "", but the result is : 'a'.

Here is my code :

def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        prefix_list = list()
        j = 0
        i = 0

        min_ = min(strs, key=len)
        if len(list(set(strs))) == 1:
            return strs[0]

        while i < len(strs) and 0 < len(strs) < 201:
            word = strs[i]

            if  len(word) < 201 and word != "":

                if i + 1 < len(strs) and j < len(min_)  and word[j] == strs[i+1][j]:
                    prefix_list.append(word[j])
                    j += 1
                    i += 1
                else:
                    return u''.join(prefix_list)

            else:
                return ""

I tried to check if len(prefix_list) is equal to i but no effective result..


问:
MySQL gives error: "Query 1 ERROR: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'" on update
I am running the query:

```<code>UPDATE lookup
    set label = 'ATM'
where id in (select id
                from lookup
                where option_type = 'put'
                and label = 'OTM'
                order by strike_price desc
                LIMIT 1
            )
</code>```

which gives the error:

Query 1 ERROR: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

Body:
I am running the query:

UPDATE lookup
    set label = 'ATM'
where id in (select id
                from lookup
                where option_type = 'put'
                and label = 'OTM'
                order by strike_price desc
                LIMIT 1
            )

which gives the error:

Query 1 ERROR: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'


问:
Problems with list, cant replace icon with image
I have problems with replacing image to the list icon. It doesnt work. I have used this command:

```<code>ul {
list-style-image: url();
}
</code>```

But this doesnt change anything. I am using bootstrap so I dont know if is there any difference. I know about unicodes but I need specific image and I didnt find something like this.

Body:
I have problems with replacing image to the list icon. It doesnt work. I have used this command:

ul {
list-style-image: url();
}

But this doesnt change anything. I am using bootstrap so I dont know if is there any difference. I know about unicodes but I need specific image and I didnt find something like this.


问:
How to predict the coordinates of a point by using previous points and distances
I have a set of coordinates (x and y) of points which should represent the middle of a line. The points look like this:

```<code>cluster_mp = [[196, 357], [259, 253], [367, 194], [436, 131], [490, 84]]
</code>```

The points plotted on my picture looks like this.

Middlepoints_plotted

After that i calculate the distance in pixels between each point (x and y mean). From bottom to top:

```<code>[121, 123, 93, 71]
</code>```

As you can see i am missing the middlepoint of the line right at the top. This is the point i want to calculate(predict)

Point_to_predict

I was thinking about maybe using the angle between the points and the change in the distance.

```<code>def angle_between(p1, p2):
    ang1 = np.arctan2(*p1[::-1])
    ang2 = np.arctan2(*p2[::-1])
    return np.rad2deg((ang1 - ang2) % (2 * np.pi))

for i in range(len(cluster_mp)-1):
    #print(angle_between(cluster_mp[i], cluster_mp[i+1]))
    print(angle_between(cluster_mp[i+1], cluster_mp[i]))
</code>```

Or using a regression line and the distance change.
Has someone an idea how this can work?

Body:
I have a set of coordinates (x and y) of points which should represent the middle of a line. The points look like this:

cluster_mp = [[196, 357], [259, 253], [367, 194], [436, 131], [490, 84]]

The points plotted on my picture looks like this.

Middlepoints_plotted

After that i calculate the distance in pixels between each point (x and y mean). From bottom to top:

[121, 123, 93, 71]

As you can see i am missing the middlepoint of the line right at the top. This is the point i want to calculate(predict)

Point_to_predict

I was thinking about maybe using the angle between the points and the change in the distance.

def angle_between(p1, p2):
    ang1 = np.arctan2(*p1[::-1])
    ang2 = np.arctan2(*p2[::-1])
    return np.rad2deg((ang1 - ang2) % (2 * np.pi))

for i in range(len(cluster_mp)-1):
    #print(angle_between(cluster_mp[i], cluster_mp[i+1]))
    print(angle_between(cluster_mp[i+1], cluster_mp[i]))

Or using a regression line and the distance change.
Has someone an idea how this can work?


问:
Python - Read txt files from Network shared drive
I am trying to read in data from text files that are moved into a network share drive over a VPN. The overall intent is to be able to loop through the files with yesterday's date (either in the file name, or by the Modified Date) and extract the pipe delimited data separated by "|" and concat it into a pandas df. The issue I am having is actually being able to read files from the network drive. So far I have only been able to figure out how to use os.listdir to identify the file names, but not actually read them. Anyone have any ideas?

This is what I've tried so far that has actually started to pan out = with os.listdir correctly being able to see the Network folder and the files inside - but how would I call the actual files inside (filtered by date or not) to actually get it to work in the loop?

```<code>import pandas as pd
#folder = os.listdir(r'\\fileshare.com\PATH\TO\FTP\FILES')
folder = (r'\\fileshare.com\PATH\TO\FTP\FILES')

main_dataframe = pd.DataFrame(pd.read_csv(folder[0]))

for i in range (1, len(folder)):
    data = pd.read_csv(folder[i])
    df = pd.DataFrame(data)
    main_dataframe = pd.concat([main_dataframe, df], axis=1)
print(main_dataframe)
</code>```

I'm pretty new at Python and doing things like this, so I apologize if I refer to anything wrong. Any advice would be greatly appreciated!

Body:
I am trying to read in data from text files that are moved into a network share drive over a VPN. The overall intent is to be able to loop through the files with yesterday's date (either in the file name, or by the Modified Date) and extract the pipe delimited data separated by "|" and concat it into a pandas df. The issue I am having is actually being able to read files from the network drive. So far I have only been able to figure out how to use os.listdir to identify the file names, but not actually read them. Anyone have any ideas?

This is what I've tried so far that has actually started to pan out = with os.listdir correctly being able to see the Network folder and the files inside - but how would I call the actual files inside (filtered by date or not) to actually get it to work in the loop?

import pandas as pd
#folder = os.listdir(r'\\fileshare.com\PATH\TO\FTP\FILES')
folder = (r'\\fileshare.com\PATH\TO\FTP\FILES')

main_dataframe = pd.DataFrame(pd.read_csv(folder[0]))

for i in range (1, len(folder)):
    data = pd.read_csv(folder[i])
    df = pd.DataFrame(data)
    main_dataframe = pd.concat([main_dataframe, df], axis=1)
print(main_dataframe)

I'm pretty new at Python and doing things like this, so I apologize if I refer to anything wrong. Any advice would be greatly appreciated!


问:
Get the content that doesn't match
I am creating a script to check if there is no match in the name of the pc's in my csv file (source) and the AD and recover the names of pc's that do not match with the AD in order to extract them in a csv file.

But also to do in the other direction, that is to say to check the names of the pc contained in the AD which do not have any correspondence with the csv file and to extract the whole in the same csv file.

In order to update our inventory and to make a more precise follow-up of the PCs.

I tried with the like and notlike parameters but it doesn't output what I want, either I get the name that matches between the AD and the csv file or I get the entire contents of the csv file.

Title: Get the content that doesn't match


问:
What are some methods to be able receive files and taking a user input?
I'm trying to create UDP Communication between server and client. Problem I'm trying to solve is that when I'm logged in as client or server I would like to switch roles, what I mean is that client becomes server and server becomes client.

Server UI

print("--------------------------------------------")
print("| Command | Help                           |")
print("--------------------------------------------")
print("| recv    | Receiving files                |")
print("| change  | Change roles                   |\n")

choice = input("SERVER > ")

if choice == "change":
   # Send frame to client to reverse roles
   # Change roles
elif choice == "recv":
   # Receive frames
   # data, sender_addr = sock.recvfrom(MAX_FRAGMENT_SIZE)

```
<p>Client UI</p>
<pre class="lang-py prettyprint-override"><code>print("--------------------------------------------")
print("| Command | Help                           |")
print("--------------------------------------------")
print("| msg     | Send a message                 |")
print("| file    | Send a file                    |")
print("| change  | Change roles                   |\n")

choice = input("CLIENT > ")
</code>```

Changing from client to server is not a problem, because I need to type "change" and it's done.

"Problem" is changing from server to client, because server needs to be able receive and take user's input at once, atleast this is my idea. If you see Server UI code, you can see that I'm only able receive, when type 'recv', but I don't want this, because It would mean that everytime I want to send file from client, I would need to set server to receive.

Any ideas would be appreciated.

Body:
I'm trying to create UDP Communication between server and client. Problem I'm trying to solve is that when I'm logged in as client or server I would like to switch roles, what I mean is that client becomes server and server becomes client.

Server UI

print("--------------------------------------------")
print("| Command | Help                           |")
print("--------------------------------------------")
print("| recv    | Receiving files                |")
print("| change  | Change roles                   |\n")

choice = input("SERVER > ")

if choice == "change":
   # Send frame to client to reverse roles
   # Change roles
elif choice == "recv":
   # Receive frames
   # data, sender_addr = sock.recvfrom(MAX_FRAGMENT_SIZE)

Client UI

print("--------------------------------------------")
print("| Command | Help                           |")
print("--------------------------------------------")
print("| msg     | Send a message                 |")
print("| file    | Send a file                    |")
print("| change  | Change roles                   |\n")

choice = input("CLIENT > ")

Changing from client to server is not a problem, because I need to type "change" and it's done.

"Problem" is changing from server to client, because server needs to be able receive and take user's input at once, atleast this is my idea. If you see Server UI code, you can see that I'm only able receive, when type 'recv', but I don't want this, because It would mean that everytime I want to send file from client, I would need to set server to receive.

Any ideas would be appreciated.


问:
How to make Laravel run MQTT listener or subscribe
Currently I am running using command php arisan start.listening.mqtt.
However, it will be killed if no more active on the screen.
So can any one suggest a better way for 2 objective

Run the MQTT listener as background process through Laravel code

When the server reboot, it is started automatically.

Currenly I am using AWS Ubuntu server to run Mosquitto


问:
While trying to encode a pointcloud I keep getting the same errors. I have tried to changing my environment and updating Glibcxx version and yet
```<code>$ python vmuc.py compress /home2/kubra/JPEG/Stanford_Area_2.ply ../models/Geometry-only/Codec/0.00025/checkpoint_best_loss.pth.tar ../results/G0.00025
Traceback (most recent call last):
  File "/home2/kubra/JPEG/JPEG_PCC_VM/jpeg-pleno-pc-vm-main/src/vmuc.py", line 13, in <module>
    import loss_functions
  File "/home2/kubra/JPEG/JPEG_PCC_VM/jpeg-pleno-pc-vm-main/src/loss_functions.py", line 3, in <module>
    from sklearn.neighbors import NearestNeighbors
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/__init__.py", line 82, in <module>
    from .base import clone
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/utils/__init__.py", line 29, in <module>
    from .fixes import parse_version, threadpool_info
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/utils/fixes.py", line 19, in <module>
    import scipy.stats
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/stats/__init__.py", line 467, in <module>
    from ._stats_py import *
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/stats/_stats_py.py", line 39, in <module>
    from scipy.spatial.distance import cdist
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/__init__.py", line 105, in <module>
    from ._kdtree import *
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/_kdtree.py", line 5, in <module>
    from ._ckdtree import cKDTree, cKDTreeNode
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/_ckdtree.cpython-39-x86_64-linux-gnu.so)``
</code>```

I'm currently working on point clouds codec. I tried encoding a point cloud but I keep getting the same error:

```<code>"/lib/x86_64-linux-gnu/libstdc++.so.6: version \`GLIBCXX_3.4.29' not found (required by /home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/\_ckdtree.cpython-39-x86_64-linux-gnu.so)"
</code>```

It says, apparently the version of GLIBCXX is not found whatsoever.. I tried updating my libstdc, creating new env with updated packages etc but it didnt workk for me. I have no idea  of why it doesn't work and what I need to do. Could anyone please tell me what should I do?

Body:
$ python vmuc.py compress /home2/kubra/JPEG/Stanford_Area_2.ply ../models/Geometry-only/Codec/0.00025/checkpoint_best_loss.pth.tar ../results/G0.00025
Traceback (most recent call last):
  File "/home2/kubra/JPEG/JPEG_PCC_VM/jpeg-pleno-pc-vm-main/src/vmuc.py", line 13, in <module>
    import loss_functions
  File "/home2/kubra/JPEG/JPEG_PCC_VM/jpeg-pleno-pc-vm-main/src/loss_functions.py", line 3, in <module>
    from sklearn.neighbors import NearestNeighbors
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/__init__.py", line 82, in <module>
    from .base import clone
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/utils/__init__.py", line 29, in <module>
    from .fixes import parse_version, threadpool_info
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/sklearn/utils/fixes.py", line 19, in <module>
    import scipy.stats
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/stats/__init__.py", line 467, in <module>
    from ._stats_py import *
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/stats/_stats_py.py", line 39, in <module>
    from scipy.spatial.distance import cdist
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/__init__.py", line 105, in <module>
    from ._kdtree import *
  File "/home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/_kdtree.py", line 5, in <module>
    from ._ckdtree import cKDTree, cKDTreeNode
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/_ckdtree.cpython-39-x86_64-linux-gnu.so)``

I'm currently working on point clouds codec. I tried encoding a point cloud but I keep getting the same error:

"/lib/x86_64-linux-gnu/libstdc++.so.6: version \`GLIBCXX_3.4.29' not found (required by /home/kubra/anaconda3/envs/myenv/lib/python3.9/site-packages/scipy/spatial/\_ckdtree.cpython-39-x86_64-linux-gnu.so)"

It says, apparently the version of GLIBCXX is not found whatsoever.. I tried updating my libstdc, creating new env with updated packages etc but it didnt workk for me. I have no idea  of why it doesn't work and what I need to do. Could anyone please tell me what should I do?


问:
Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;

I config spring email by add 2 step verification and password is Generated App Password

Help me know why I wrong :(


问:
"OSError: [Errno 9] Bad file descriptor" error when trying to save excel file with openpyxl in python
I have a couple of excel files I want to merge into one.
I need the second column on all the files to be copied into separate columns in a new Microsoft Excel file.
For this, I am using the openpyxl library in a python script.

This is my code:

import os
from openpyxl import load_workbook

def mergeDataFiles():
    path = "C:\\Users\\ethan\\Desktop\\Benzoyl Chloride\\Benzoyl Chloride"
    # source excel files
    origin_files = list()
    for path, subdirs, files in os.walk(path):
        for file_index in range(len(files)):
            origin_files.append(files[file_index])
    # destination excel file
    destination_file = path + ".xlsx"
    destination_workbook = load_workbook(destination_file)
    destination_sheet = destination_workbook["Sheet1"]
    # copy data from source files to destination file
    for origin_file_index in range(1, len(origin_files)):
        origin_workbook = load_workbook(path + "\\" + origin_files[origin_file_index - 1])
        origin_sheet = origin_workbook['Data']
        destination_sheet.cell(row=1, column=origin_file_index).value = origin_files[origin_file_index - 1]
        for i in range(1, 500):
            # read cell value from source excel file
            data = origin_sheet.cell(row=i, column=2)
            # write the value to destination excel file
            destination_sheet.cell(row=i + 1, column=origin_file_index).value = data.value

    # saving the destination excel file
destination_workbook.save(destination_file)

if __name__ == "__main__":
    mergeDataFiles()
```
<p>When I run the code, I get an error on the last line in the function: <code>OSError: [Errno 9] Bad file descriptor</code>.</p>
<p>Full traceback:</p>
```C:\Users\ethan\.venv\Scripts\python.exe "C:/Users/ethan/Coding/Python/Copy Excel Data/main.py"
Traceback (most recent call last):
  File "C:\Users\ethan\Coding\Python\Copy Excel Data\main.py", line 32, in <module>
    mergeDataFiles()
  File "C:\Users\ethan\Coding\Python\Copy Excel Data\main.py", line 28, in mergeDataFiles
    destination_workbook.save(destination_file)
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\workbook\workbook.py", line 407, in save
    save_workbook(self, filename)
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\writer\excel.py", line 293, in save_workbook
    writer.save()
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\writer\excel.py", line 275, in save
    self.write_data()
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\writer\excel.py", line 67, in write_data
    archive.writestr(ARC_APP, tostring(props.to_tree()))
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1830, in writestr
    with self.open(zinfo, mode='w') as dest:
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1204, in close
    self._fileobj.seek(self._zinfo.header_offset)
OSError: [Errno 9] Bad file descriptor
Exception ignored in: <function ZipFile.__del__ at 0x000001D101443D80>
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1870, in __del__
    self.close()
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1892, in close
    self._fpclose(fp)
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1992, in _fpclose
    fp.close()
OSError: [Errno 9] Bad file descriptor

Process finished with exit code 1

```

I have tried changing the file names and locations, having the destination file open and closed, scouring the internet for solutions and at this point I'm not sure what else I can try.
I am running the code on Windows 10 22H2, with an intel i5 cpu.

Please assist me with this issue, if you know how to solve it.

Body:
I have a couple of excel files I want to merge into one.
I need the second column on all the files to be copied into separate columns in a new Microsoft Excel file.
For this, I am using the openpyxl library in a python script.

This is my code:

import os
from openpyxl import load_workbook

def mergeDataFiles():
    path = "C:\\Users\\ethan\\Desktop\\Benzoyl Chloride\\Benzoyl Chloride"
    # source excel files
    origin_files = list()
    for path, subdirs, files in os.walk(path):
        for file_index in range(len(files)):
            origin_files.append(files[file_index])
    # destination excel file
    destination_file = path + ".xlsx"
    destination_workbook = load_workbook(destination_file)
    destination_sheet = destination_workbook["Sheet1"]
    # copy data from source files to destination file
    for origin_file_index in range(1, len(origin_files)):
        origin_workbook = load_workbook(path + "\\" + origin_files[origin_file_index - 1])
        origin_sheet = origin_workbook['Data']
        destination_sheet.cell(row=1, column=origin_file_index).value = origin_files[origin_file_index - 1]
        for i in range(1, 500):
            # read cell value from source excel file
            data = origin_sheet.cell(row=i, column=2)
            # write the value to destination excel file
            destination_sheet.cell(row=i + 1, column=origin_file_index).value = data.value

    # saving the destination excel file
destination_workbook.save(destination_file)

if __name__ == "__main__":
    mergeDataFiles()

When I run the code, I get an error on the last line in the function: OSError: [Errno 9] Bad file descriptor.

Full traceback:

C:\Users\ethan\.venv\Scripts\python.exe "C:/Users/ethan/Coding/Python/Copy Excel Data/main.py"
Traceback (most recent call last):
  File "C:\Users\ethan\Coding\Python\Copy Excel Data\main.py", line 32, in <module>
    mergeDataFiles()
  File "C:\Users\ethan\Coding\Python\Copy Excel Data\main.py", line 28, in mergeDataFiles
    destination_workbook.save(destination_file)
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\workbook\workbook.py", line 407, in save
    save_workbook(self, filename)
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\writer\excel.py", line 293, in save_workbook
    writer.save()
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\writer\excel.py", line 275, in save
    self.write_data()
  File "C:\Users\ethan\.venv\Lib\site-packages\openpyxl\writer\excel.py", line 67, in write_data
    archive.writestr(ARC_APP, tostring(props.to_tree()))
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1830, in writestr
    with self.open(zinfo, mode='w') as dest:
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1204, in close
    self._fileobj.seek(self._zinfo.header_offset)
OSError: [Errno 9] Bad file descriptor
Exception ignored in: <function ZipFile.__del__ at 0x000001D101443D80>
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1870, in __del__
    self.close()
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1892, in close
    self._fpclose(fp)
  File "C:\Program Files\Python311\Lib\zipfile.py", line 1992, in _fpclose
    fp.close()
OSError: [Errno 9] Bad file descriptor

Process finished with exit code 1

I have tried changing the file names and locations, having the destination file open and closed, scouring the internet for solutions and at this point I'm not sure what else I can try.
I am running the code on Windows 10 22H2, with an intel i5 cpu.

Please assist me with this issue, if you know how to solve it.


问:
Blender Python constraint
currently I have this script... Somehow the contrits only work with one selection at the time, even tho the for loop seems right to me, also is there a way to position the new generated empty to 3D Cursor?</p>
```<code>
for obj in bpy.context.selected_objects:  # Loop over all selected objects
    empty = bpy.data.objects.new(obj.name + "_Empty", None)  # Create new empty object
    #bpy.types.TrackToConstraint
    obj.users_collection[0].objects.link(empty)  # Link empty to the current object's collection
    empty.empty_display_type = 'PLAIN_AXES'
    bpy.ops.object.constraint_add(type='TRACK_TO')
    bpy.context.object.constraints["Track To"].target = empty
</code>```

Title: Blender Python constraint

Body:
currently I have this script... Somehow the contrits only work with one selection at the time, even tho the for loop seems right to me, also is there a way to position the new generated empty to 3D Cursor?

for obj in bpy.context.selected_objects:  # Loop over all selected objects
    empty = bpy.data.objects.new(obj.name + "_Empty", None)  # Create new empty object
    #bpy.types.TrackToConstraint
    obj.users_collection[0].objects.link(empty)  # Link empty to the current object's collection
    empty.empty_display_type = 'PLAIN_AXES'
    bpy.ops.object.constraint_add(type='TRACK_TO')
    bpy.context.object.constraints["Track To"].target = empty


问:
how i can import firebase dynamicLinks Expo React Native
Hello how i can import this:
dynamicLinks().resolveLink(url).then((resolvedData) => {
… // Do what you need to do here
}
here don't explain how import this:
https://reactnavigation.org/docs/5.x/deep-linking/#third-party-integrations</p>


问:
Xcode sim will not open after fresh installs?
This is the error ive been getting even after fresh installs


问:
curl: (5) Could not resolve proxy: raw.githubusercontent.com
Want to Install Homebrew but met this problem:

Ran this command from homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

But I am now having trouble with connection, don't know why and how.


问:
React useEffect update main Component

I am learning the basics of react and developing my first application.
Above is the logic schema , showing 5 components.
Highlighted in red are the information I am passing between components.

Everything is working so far (using @redux) etc etc... Now I want to dynamically update the ColorCardsList when I create a card inside "ColorCardCreate" or I delete a card inside "ColorCardRow" or edit a card inside "ColorCardEdit". Based on my reading I should use useEffect hook and pass in the dependency array the props/stats. So, what I did in my ColorCardsList was creating a useEffect hook and pass [colorCards] as dependency but my application is now in an infinite loop.
Question is... is my understanding correct? is there an alternative way to update the ColorCardsList page... can you suggest some interesting reading about this topic?

Here is an example of my useEffect hook in colorCardsList. Bear in mind, as shown on the schema, I am passing the colorsCards as props from the ColorCards component. Basically inside this using effect I dispatch only some data which are not related to the colorCards..

```<code>    useEffect(() => {

        dispatch(getCategories())

    },[ dispatch, colorsCards ])
</code>```

Title: React useEffect update main Component

Body:
I am learning the basics of react and developing my first application.
Above is the logic schema , showing 5 components.
Highlighted in red are the information I am passing between components.

Everything is working so far (using @redux) etc etc... Now I want to dynamically update the ColorCardsList when I create a card inside "ColorCardCreate" or I delete a card inside "ColorCardRow" or edit a card inside "ColorCardEdit". Based on my reading I should use useEffect hook and pass in the dependency array the props/stats. So, what I did in my ColorCardsList was creating a useEffect hook and pass [colorCards] as dependency but my application is now in an infinite loop.
Question is... is my understanding correct? is there an alternative way to update the ColorCardsList page... can you suggest some interesting reading about this topic?

Here is an example of my useEffect hook in colorCardsList. Bear in mind, as shown on the schema, I am passing the colorsCards as props from the ColorCards component. Basically inside this using effect I dispatch only some data which are not related to the colorCards..

    useEffect(() => {

        dispatch(getCategories())

    },[ dispatch, colorsCards ])


问:
How to enable docker in VS2022 Community
I am using VS2022 Community and attempting to get Docker enabled.  Docker is installed on my Windows 10 Desktop.  The docs say to download and install the Docker extension, but the extension doesn't show up in a search in VS or from the Microsoft Marketplace web page.  What am I missing?</p>


问:
FAILED_TO_LOAD_NATIVE_LIBRARY error when calling pyspark DataFrame show function
My code is as follows:

```<code>from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("MyPyspark").getOrCreate()
spark_df = spark.read.parquet('input.parquet')
spark_df.show()
</code>```

I am trying to read a parquet using PySpark but when calling the show() function I get the following error:

org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Mac and os.arch=aarch64

Anyone got any idea how to fix this?

I am using Python 3.10.0 and pyspark 3.0.0 on a Apple M1 Pro with Mac OS 13.0.1 (22A400)

I have tried using different python envs (3.8, 3.9 and 3.10) and using venv and poetry to manage dependencies but still no luck.
The full error is:

```<code>org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Mac and os.arch=aarch64
    at org.xerial.snappy.SnappyLoader.findNativeLibrary(SnappyLoader.java:342)
    at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:176)
    at org.xerial.snappy.SnappyLoader.loadSnappyApi(SnappyLoader.java:154)
    at org.xerial.snappy.Snappy.<clinit>(Snappy.java:47)
    at org.apache.parquet.hadoop.codec.SnappyDecompressor.decompress(SnappyDecompressor.java:62)
    at org.apache.parquet.hadoop.codec.NonBlockedDecompressorStream.read(NonBlockedDecompressorStream.java:51)
    at java.base/java.io.DataInputStream.readFully(DataInputStream.java:200)
    at java.base/java.io.DataInputStream.readFully(DataInputStream.java:170)
    at org.apache.parquet.bytes.BytesInput$StreamBytesInput.toByteArray(BytesInput.java:263)
    at org.apache.parquet.bytes.BytesInput.toByteBuffer(BytesInput.java:214)
    at org.apache.parquet.bytes.BytesInput.toInputStream(BytesInput.java:223)
    at org.apache.parquet.column.impl.ColumnReaderImpl.readPageV1(ColumnReaderImpl.java:592)
    at org.apache.parquet.column.impl.ColumnReaderImpl.access$300(ColumnReaderImpl.java:57)
    at org.apache.parquet.column.impl.ColumnReaderImpl$3.visit(ColumnReaderImpl.java:536)
    at org.apache.parquet.column.impl.ColumnReaderImpl$3.visit(ColumnReaderImpl.java:533)
    at org.apache.parquet.column.page.DataPageV1.accept(DataPageV1.java:95)
    at org.apache.parquet.column.impl.ColumnReaderImpl.readPage(ColumnReaderImpl.java:533)
    at org.apache.parquet.column.impl.ColumnReaderImpl.checkRead(ColumnReaderImpl.java:525)
    at org.apache.parquet.column.impl.ColumnReaderImpl.consume(ColumnReaderImpl.java:638)
    at org.apache.parquet.column.impl.ColumnReaderImpl.<init>(ColumnReaderImpl.java:353)
    at org.apache.parquet.column.impl.ColumnReadStoreImpl.newMemColumnReader(ColumnReadStoreImpl.java:80)
    at org.apache.parquet.column.impl.ColumnReadStoreImpl.getColumnReader(ColumnReadStoreImpl.java:75)
    at org.apache.parquet.io.RecordReaderImplementation.<init>(RecordReaderImplementation.java:271)
    at org.apache.parquet.io.MessageColumnIO$1.visit(MessageColumnIO.java:147)
    at org.apache.parquet.io.MessageColumnIO$1.visit(MessageColumnIO.java:109)
    at org.apache.parquet.filter2.compat.FilterCompat$NoOpFilter.accept(FilterCompat.java:165)
    at org.apache.parquet.io.MessageColumnIO.getRecordReader(MessageColumnIO.java:109)
    at org.apache.parquet.hadoop.InternalParquetRecordReader.checkRead(InternalParquetRecordReader.java:137)
    at org.apache.parquet.hadoop.InternalParquetRecordReader.nextKeyValue(InternalParquetRecordReader.java:222)
    at org.apache.parquet.hadoop.ParquetRecordReader.nextKeyValue(ParquetRecordReader.java:207)
    at org.apache.spark.sql.execution.datasources.RecordReaderIterator.hasNext(RecordReaderIterator.scala:39)
    at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
    at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.hasNext(FileScanRDD.scala:93)
    at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.nextIterator(FileScanRDD.scala:173)
    at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.hasNext(FileScanRDD.scala:93)
    at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
    at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$getByteArrayRdd$1(SparkPlan.scala:340)
    at org.apache.spark.rdd.RDD.$anonfun$mapPartitionsInternal$2(RDD.scala:872)
    at org.apache.spark.rdd.RDD.$anonfun$mapPartitionsInternal$2$adapted(RDD.scala:872)
    at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:52)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:349)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:313)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
    at org.apache.spark.scheduler.Task.run(Task.scala:127)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:444)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1377)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:447)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
</code>```

Body:
My code is as follows:

from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("MyPyspark").getOrCreate()
spark_df = spark.read.parquet('input.parquet')
spark_df.show()

I am trying to read a parquet using PySpark but when calling the show() function I get the following error:

org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Mac and os.arch=aarch64

Anyone got any idea how to fix this?

I am using Python 3.10.0 and pyspark 3.0.0 on a Apple M1 Pro with Mac OS 13.0.1 (22A400)

I have tried using different python envs (3.8, 3.9 and 3.10) and using venv and poetry to manage dependencies but still no luck.
The full error is:

org.xerial.snappy.SnappyError: [FAILED_TO_LOAD_NATIVE_LIBRARY] no native library is found for os.name=Mac and os.arch=aarch64
    at org.xerial.snappy.SnappyLoader.findNativeLibrary(SnappyLoader.java:342)
    at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:176)
    at org.xerial.snappy.SnappyLoader.loadSnappyApi(SnappyLoader.java:154)
    at org.xerial.snappy.Snappy.<clinit>(Snappy.java:47)
    at org.apache.parquet.hadoop.codec.SnappyDecompressor.decompress(SnappyDecompressor.java:62)
    at org.apache.parquet.hadoop.codec.NonBlockedDecompressorStream.read(NonBlockedDecompressorStream.java:51)
    at java.base/java.io.DataInputStream.readFully(DataInputStream.java:200)
    at java.base/java.io.DataInputStream.readFully(DataInputStream.java:170)
    at org.apache.parquet.bytes.BytesInput$StreamBytesInput.toByteArray(BytesInput.java:263)
    at org.apache.parquet.bytes.BytesInput.toByteBuffer(BytesInput.java:214)
    at org.apache.parquet.bytes.BytesInput.toInputStream(BytesInput.java:223)
    at org.apache.parquet.column.impl.ColumnReaderImpl.readPageV1(ColumnReaderImpl.java:592)
    at org.apache.parquet.column.impl.ColumnReaderImpl.access$300(ColumnReaderImpl.java:57)
    at org.apache.parquet.column.impl.ColumnReaderImpl$3.visit(ColumnReaderImpl.java:536)
    at org.apache.parquet.column.impl.ColumnReaderImpl$3.visit(ColumnReaderImpl.java:533)
    at org.apache.parquet.column.page.DataPageV1.accept(DataPageV1.java:95)
    at org.apache.parquet.column.impl.ColumnReaderImpl.readPage(ColumnReaderImpl.java:533)
    at org.apache.parquet.column.impl.ColumnReaderImpl.checkRead(ColumnReaderImpl.java:525)
    at org.apache.parquet.column.impl.ColumnReaderImpl.consume(ColumnReaderImpl.java:638)
    at org.apache.parquet.column.impl.ColumnReaderImpl.<init>(ColumnReaderImpl.java:353)
    at org.apache.parquet.column.impl.ColumnReadStoreImpl.newMemColumnReader(ColumnReadStoreImpl.java:80)
    at org.apache.parquet.column.impl.ColumnReadStoreImpl.getColumnReader(ColumnReadStoreImpl.java:75)
    at org.apache.parquet.io.RecordReaderImplementation.<init>(RecordReaderImplementation.java:271)
    at org.apache.parquet.io.MessageColumnIO$1.visit(MessageColumnIO.java:147)
    at org.apache.parquet.io.MessageColumnIO$1.visit(MessageColumnIO.java:109)
    at org.apache.parquet.filter2.compat.FilterCompat$NoOpFilter.accept(FilterCompat.java:165)
    at org.apache.parquet.io.MessageColumnIO.getRecordReader(MessageColumnIO.java:109)
    at org.apache.parquet.hadoop.InternalParquetRecordReader.checkRead(InternalParquetRecordReader.java:137)
    at org.apache.parquet.hadoop.InternalParquetRecordReader.nextKeyValue(InternalParquetRecordReader.java:222)
    at org.apache.parquet.hadoop.ParquetRecordReader.nextKeyValue(ParquetRecordReader.java:207)
    at org.apache.spark.sql.execution.datasources.RecordReaderIterator.hasNext(RecordReaderIterator.scala:39)
    at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
    at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.hasNext(FileScanRDD.scala:93)
    at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.nextIterator(FileScanRDD.scala:173)
    at org.apache.spark.sql.execution.datasources.FileScanRDD$$anon$1.hasNext(FileScanRDD.scala:93)
    at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
    at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
    at org.apache.spark.sql.execution.SparkPlan.$anonfun$getByteArrayRdd$1(SparkPlan.scala:340)
    at org.apache.spark.rdd.RDD.$anonfun$mapPartitionsInternal$2(RDD.scala:872)
    at org.apache.spark.rdd.RDD.$anonfun$mapPartitionsInternal$2$adapted(RDD.scala:872)
    at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:52)
    at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:349)
    at org.apache.spark.rdd.RDD.iterator(RDD.scala:313)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
    at org.apache.spark.scheduler.Task.run(Task.scala:127)
    at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:444)
    at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1377)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:447)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)


问:
Prioritising OSPF Packets
I have to give a high priority to OSPF packets so that I do not lose the route and re-initiate. There is too much traffic that it smothers OSPF packets and the device ends up losing the route.

The fact that the data rate will be varying every X seconds, I wished not to use any data rate boundaries. I have tried 3 things:

1
I have tried setting up a prio hierarchy using tc (traffic control) as below, but there was zero data rate for some reason:

```<code>    qdisc add dev $INTERFACE root handle 1: prio bands 4 priomap 2 3 2 2 3 3 3 3 1 1 1 1 2 2 2 2
       qdisc add dev $INTERFACE parent 1:1 handle 10: sfq
       qdisc add dev $INTERFACE parent 1:2 handle 20: sfq
       qdisc add dev $INTERFACE parent 1:3 handle 30: sfq
       #I have also tried limiting the packets with limit 50 but still no luck
       qdisc add dev $INTERFACE parent 1:4 handle 40: sfq
    filter add dev $INTERFACE protocol ip parent 1: prio 0 u32 match ip protocol 0x59 0xff flowid 1:1
</code>```

1:1 has my OSPF packets, and most of the traffic goes into 1:3 in the above example.

I have initially used the above sfq leaf classes then changed the leaf class for most of my traffic goes into qdisc add dev $INTERFACE parent 1:3 handle 30: tbf rate 350kbit -- NOTE: The data rate I had for this connection is 370 kbps at max. But no change in results, still lots of packets being lost.

2
Then I proceeded into defining htb buckets - which I do not prefer for the reason given in my first paragraph:

```<code>qdisc add dev $INTERFACE root handle 1: htb default 20
    class add dev $INTERFACE parent 1: classid 1:1 htb rate 7Mbit burst 15k
        class add dev $INTERFACE parent 1:1 classid 1:10 htb rate 10kbit burst 15k prio 1
        class add dev $INTERFACE parent 1:1 classid 1:20 htb rate 320kbit ceil 360kbit burst 15k prio 5
            qdisc add dev $INTERFACE parent 1:10 handle 10: sfq
            qdisc add dev $INTERFACE parent 1:20 handle 20: sfq
filter add dev $INTERFACE protocol ip parent 1: prio 0 u32 match ip protocol 0x59 0xff flowid 1:10
</code>```

I don't think there is an option with htb to say: give class A, X kbps and leave the rest of the available bandwidth to class B, is there?

That's why I had to give something small to the class where I put my OSPF packets into (10kbit above) and 320kbit guarantee to the other class, and set the overall datarate to 7Mbps because that's the highest this network can ever have.

The data rate seemed to act normal with this setting but after about 65 seconds immense packet losses occur up to 85-90%.

3
I have removed all the QoS rules and tried setting the Minimise Delay TOS via iptables:

iptables --table mangle --append PREROUTING --protocol OSPF -j TOS --set-tos 0x10

And it makes my device crash.

Title: Prioritising OSPF Packets

Body:
I have to give a high priority to OSPF packets so that I do not lose the route and re-initiate. There is too much traffic that it smothers OSPF packets and the device ends up losing the route.

The fact that the data rate will be varying every X seconds, I wished not to use any data rate boundaries. I have tried 3 things:

1
I have tried setting up a prio hierarchy using tc (traffic control) as below, but there was zero data rate for some reason:

    qdisc add dev $INTERFACE root handle 1: prio bands 4 priomap 2 3 2 2 3 3 3 3 1 1 1 1 2 2 2 2
       qdisc add dev $INTERFACE parent 1:1 handle 10: sfq
       qdisc add dev $INTERFACE parent 1:2 handle 20: sfq
       qdisc add dev $INTERFACE parent 1:3 handle 30: sfq
       #I have also tried limiting the packets with limit 50 but still no luck
       qdisc add dev $INTERFACE parent 1:4 handle 40: sfq
    filter add dev $INTERFACE protocol ip parent 1: prio 0 u32 match ip protocol 0x59 0xff flowid 1:1

1:1 has my OSPF packets, and most of the traffic goes into 1:3 in the above example.

I have initially used the above sfq leaf classes then changed the leaf class for most of my traffic goes into qdisc add dev $INTERFACE parent 1:3 handle 30: tbf rate 350kbit -- NOTE: The data rate I had for this connection is 370 kbps at max. But no change in results, still lots of packets being lost.

2
Then I proceeded into defining htb buckets - which I do not prefer for the reason given in my first paragraph:

qdisc add dev $INTERFACE root handle 1: htb default 20
    class add dev $INTERFACE parent 1: classid 1:1 htb rate 7Mbit burst 15k
        class add dev $INTERFACE parent 1:1 classid 1:10 htb rate 10kbit burst 15k prio 1
        class add dev $INTERFACE parent 1:1 classid 1:20 htb rate 320kbit ceil 360kbit burst 15k prio 5
            qdisc add dev $INTERFACE parent 1:10 handle 10: sfq
            qdisc add dev $INTERFACE parent 1:20 handle 20: sfq
filter add dev $INTERFACE protocol ip parent 1: prio 0 u32 match ip protocol 0x59 0xff flowid 1:10

I don't think there is an option with htb to say: give class A, X kbps and leave the rest of the available bandwidth to class B, is there?

That's why I had to give something small to the class where I put my OSPF packets into (10kbit above) and 320kbit guarantee to the other class, and set the overall datarate to 7Mbps because that's the highest this network can ever have.

The data rate seemed to act normal with this setting but after about 65 seconds immense packet losses occur up to 85-90%.

3
I have removed all the QoS rules and tried setting the Minimise Delay TOS via iptables:

iptables --table mangle --append PREROUTING --protocol OSPF -j TOS --set-tos 0x10

And it makes my device crash.


问:
How can I overwrite the memory when binary reading finishes?
There is an open source project called obash which allows to encrypt Bash scripts with AES-256-CBC using OpenSSL. This project has some bugs. If we get the core dump of a running binary, we can get the source code, which defeats the purpose of encryption.

I contacted the developer of this project and he said he can't help because he had no time (I totally understand). I was able to create a binary on Ubuntu 18.04 LTS without this error, but I can't right now and I don't know why. According to ChatGPT, it is possible to hide the source code with overwriting the memory with encrypted text. How can I do that?

Although effectively unmaintained, obash looks more sophisticated than e.g. shc which is known to be easy to circumvent. I am ultimately looking for a solution which allows me to distribute a Bash script in compiled form without the well-known vulnerabilities of shc et al. But this question simply concerns the immediate solution to the problem stated above.


问:
How can i get all the devices added in a firebase topic - Python
```<code>import firebase_admin
from firebase_admin import credentials, messaging
firebase_cred = credentials.Certificate("notification-microservice-dev-firebase.json")
firebase_app = firebase_admin.initialize_app(firebase_cred)

def create_topic(tokens, topic_name):
    topic = messaging.subscribe_to_topic(tokens, topic_name)
    return topic
topic = create_topic(["asdasddas","asdasdasdsaasd","asdasdasd"],"nuevo_topic")
</code>```

This code is responsible for adding tokens to a topic , but how can I get all the tokens added to a topic , I've been looking in the documentation and I can't find anything about it

Body:
import firebase_admin
from firebase_admin import credentials, messaging
firebase_cred = credentials.Certificate("notification-microservice-dev-firebase.json")
firebase_app = firebase_admin.initialize_app(firebase_cred)

def create_topic(tokens, topic_name):
    topic = messaging.subscribe_to_topic(tokens, topic_name)
    return topic
topic = create_topic(["asdasddas","asdasdasdsaasd","asdasdasd"],"nuevo_topic")

This code is responsible for adding tokens to a topic , but how can I get all the tokens added to a topic , I've been looking in the documentation and I can't find anything about it


问:
TradingView Session Highlighter
This indicator's only purpose is to:

Highlight the first 2 hours of the London Session

Highlight the first 2 hours of the New York Session.

Adjusting the highlighted zones for daylight saving time, in order to maintain highlighting the correct zones at all times of the year.

The problem was solved with this: https://www.tradingview.com/script/l6sE4Q8Q-MRO-Double-Session-Highlighter/

Currently, the template is based on EST-New York Time Zone it would be nice to change this to GMT +0

```<code>//Currently using Forex Session Templates Based on EST-New York Time Zone would like to change this to GMT +0

study(title="LON & NY: Sessions Highlighter",shorttitle="LON & NY: Trading Sessions Highlighter", overlay=true)
timeinrange(res, sess) => time(res, sess) != 0

//-----------------------London Session----------------------
doLondonSession = input(defval=true, type = bool, title="London Session On")

LNSession = #1e90ff

//****Note ---- Use Military Times --- So 3:00PM = 1500
bgcolor(doLondonSession and timeinrange(period, "0300-0500") ? LNSession : na, transp=90)

//-----------------------New York Session----------------------
doNewYorkSession = input(defval=true, type = bool, title="New York Session On")

NYSession = #1e90ff

//****Note ---- Use Military Times --- So 3:00PM = 1500
bgcolor(doNewYorkSession and timeinrange(period, "0800-1000") ? NYSession : na, transp=90)

</code>```

I'm quite new to Pinescript. But I have a bit of light coding experience. I think my main problem is adjusting the  zones for daylight saving time when necessary. So the chat always highlights the first 2h of the LON & NY sessions

Title: TradingView Session Highlighter

Body:
This indicator's only purpose is to:

Highlight the first 2 hours of the London Session

Highlight the first 2 hours of the New York Session.

Adjusting the highlighted zones for daylight saving time, in order to maintain highlighting the correct zones at all times of the year.

The problem was solved with this: https://www.tradingview.com/script/l6sE4Q8Q-MRO-Double-Session-Highlighter/

Currently, the template is based on EST-New York Time Zone it would be nice to change this to GMT +0

//Currently using Forex Session Templates Based on EST-New York Time Zone would like to change this to GMT +0

study(title="LON & NY: Sessions Highlighter",shorttitle="LON & NY: Trading Sessions Highlighter", overlay=true)
timeinrange(res, sess) => time(res, sess) != 0

//-----------------------London Session----------------------
doLondonSession = input(defval=true, type = bool, title="London Session On")

LNSession = #1e90ff

//****Note ---- Use Military Times --- So 3:00PM = 1500
bgcolor(doLondonSession and timeinrange(period, "0300-0500") ? LNSession : na, transp=90)

//-----------------------New York Session----------------------
doNewYorkSession = input(defval=true, type = bool, title="New York Session On")

NYSession = #1e90ff

//****Note ---- Use Military Times --- So 3:00PM = 1500
bgcolor(doNewYorkSession and timeinrange(period, "0800-1000") ? NYSession : na, transp=90)

I'm quite new to Pinescript. But I have a bit of light coding experience. I think my main problem is adjusting the  zones for daylight saving time when necessary. So the chat always highlights the first 2h of the LON & NY sessions


问:
Error: '\U' used without hex digits in character string starting "'C:\U"
I have started to use visual studio and conda, and im using R in this one, but when I try to open it, I receive the following message

```<code>(base) PS C:\Users\afveleza> jupyter notebook
[I 2022-12-07 11:37:17.680 LabApp] JupyterLab extension loaded from C:\Users\afveleza\anaconda3\lib\site-packages\jupyterlab
[I 2022-12-07 11:37:17.680 LabApp] JupyterLab application directory is C:\Users\afveleza\anaconda3\share\jupyter\lab
[I 11:37:17.686 NotebookApp] The port 8888 is already in use, trying another port.
[I 11:37:17.689 NotebookApp] Serving notebooks from local directory: C:\Users\afveleza
[I 11:37:17.689 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 11:37:17.689 NotebookApp] http://localhost:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
[I 11:37:17.689 NotebookApp]  or http://127.0.0.1:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
[I 11:37:17.689 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:37:17.726 NotebookApp]
</code>```
```<code>To access the notebook, open this file in a browser:
        file:///C:/Users/afveleza/AppData/Roaming/jupyter/runtime/nbserver-21640-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
     or http://127.0.0.1:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
[I 11:38:02.058 NotebookApp] Creating new notebook in
[I 11:38:04.357 NotebookApp] Kernel started: 59ca7747-062b-45d3-9cec-3c2622474d47, name: ir
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:07.323 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:10.421 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:13.536 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:16.619 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:19.896 NotebookApp] KernelRestarter: restarting kernel (5/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[W 11:38:23.010 NotebookApp] KernelRestarter: restart failed
[W 11:38:23.010 NotebookApp] Kernel 59ca7747-062b-45d3-9cec-3c2622474d47 died, removing from map.
[W 11:39:04.379 NotebookApp] Timeout waiting for kernel_info reply from 59ca7747-062b-45d3-9cec-3c2622474d47
[E 11:39:04.381 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47)
[W 11:39:05.422 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:05.433 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 13.230000ms referer=None
[W 11:39:07.454 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:07.456 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 4.090000ms referer=None
[W 11:39:11.483 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:11.484 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2.000000ms referer=None
[W 11:39:19.501 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:22.131 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2632.200000ms referer=None
[W 11:39:38.163 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:38.164 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2.340000ms referer=None
[I 11:40:04.179 NotebookApp] Saving file at /Untitled1.ipynb
C:\Users\afveleza\anaconda3\lib\site-packages\nbformat\__init__.py:128: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.
  validate(nb)
C:\Users\afveleza\anaconda3\lib\site-packages\notebook\services\contents\manager.py:353: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.
  validate_nb(model['content'])
[W 11:40:10.189 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:40:10.192 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2.330000ms referer=None
[W 11:41:14.236 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:41:14.237 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 4.070000ms referer=None
</code>```

Some forums mentioned that I must change the working directory, but I need to learn how to do so. So please help me to solve this issue.

I have tried in the same console of Jupyter, but this can not connect to the server. For that reason, nothing happens.

Body:
I have started to use visual studio and conda, and im using R in this one, but when I try to open it, I receive the following message

(base) PS C:\Users\afveleza> jupyter notebook
[I 2022-12-07 11:37:17.680 LabApp] JupyterLab extension loaded from C:\Users\afveleza\anaconda3\lib\site-packages\jupyterlab
[I 2022-12-07 11:37:17.680 LabApp] JupyterLab application directory is C:\Users\afveleza\anaconda3\share\jupyter\lab
[I 11:37:17.686 NotebookApp] The port 8888 is already in use, trying another port.
[I 11:37:17.689 NotebookApp] Serving notebooks from local directory: C:\Users\afveleza
[I 11:37:17.689 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 11:37:17.689 NotebookApp] http://localhost:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
[I 11:37:17.689 NotebookApp]  or http://127.0.0.1:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
[I 11:37:17.689 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:37:17.726 NotebookApp]

To access the notebook, open this file in a browser:
        file:///C:/Users/afveleza/AppData/Roaming/jupyter/runtime/nbserver-21640-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
     or http://127.0.0.1:8889/?token=339658fdeb8d29296ad5a3bd672dde496c3a3aecb20abd3e
[I 11:38:02.058 NotebookApp] Creating new notebook in
[I 11:38:04.357 NotebookApp] Kernel started: 59ca7747-062b-45d3-9cec-3c2622474d47, name: ir
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:07.323 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:10.421 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:13.536 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:16.619 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[I 11:38:19.896 NotebookApp] KernelRestarter: restarting kernel (5/5), new random ports
Error: '\U' used without hex digits in character string starting "'C:\U"
Execution halted
[W 11:38:23.010 NotebookApp] KernelRestarter: restart failed
[W 11:38:23.010 NotebookApp] Kernel 59ca7747-062b-45d3-9cec-3c2622474d47 died, removing from map.
[W 11:39:04.379 NotebookApp] Timeout waiting for kernel_info reply from 59ca7747-062b-45d3-9cec-3c2622474d47
[E 11:39:04.381 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47)
[W 11:39:05.422 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:05.433 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 13.230000ms referer=None
[W 11:39:07.454 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:07.456 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 4.090000ms referer=None
[W 11:39:11.483 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:11.484 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2.000000ms referer=None
[W 11:39:19.501 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:22.131 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2632.200000ms referer=None
[W 11:39:38.163 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:39:38.164 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2.340000ms referer=None
[I 11:40:04.179 NotebookApp] Saving file at /Untitled1.ipynb
C:\Users\afveleza\anaconda3\lib\site-packages\nbformat\__init__.py:128: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.
  validate(nb)
C:\Users\afveleza\anaconda3\lib\site-packages\notebook\services\contents\manager.py:353: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use `normalize()` on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.
  validate_nb(model['content'])
[W 11:40:10.189 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:40:10.192 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 2.330000ms referer=None
[W 11:41:14.236 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1): Kernel does not exist: 59ca7747-062b-45d3-9cec-3c2622474d47
[W 11:41:14.237 NotebookApp] 404 GET /api/kernels/59ca7747-062b-45d3-9cec-3c2622474d47/channels?session_id=c4a6ea8d431044698bad72ddefc14137 (::1) 4.070000ms referer=None

Some forums mentioned that I must change the working directory, but I need to learn how to do so. So please help me to solve this issue.

I have tried in the same console of Jupyter, but this can not connect to the server. For that reason, nothing happens.


问:
Parsing html and the script tag
What do you think is the best way to determine the closing  tag, assuming
the script itself has the string  inside it.

for example:

```<code><script>
var string="</script";
</script>
</code>```

If possible without using a stack.

ContentLicense: CC BY-SA 3.0

Title: Parsing html and the script tag

Body:
What do you think is the best way to determine the closing  tag, assuming
the script itself has the string  inside it.

for example:

If possible without using a stack.


问:
How to convert SpringBoot2x request return xml type to json type?
Due to some reasons, A colleague calling my interface request header accept does not carry an application/json parameter

```<code>accept:text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
</code>```

add @PostMapping(value = "**",produces = {"application/json"}) at the controller level
add javax.validation.constraints.NotNull annotations in the request parameters
When a normal request is handled by the controller, the return value is of type json.
However, if the request parameter is missing the parameter identified by the annotation, the xml type is returned
Request parameter validation failed handling method
enter image description here

My question is how to return a uniform json response type for failed calls

I had not dealt with similar problems, so I had no idea

Body:
Due to some reasons, A colleague calling my interface request header accept does not carry an application/json parameter

accept:text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

add @PostMapping(value = "**",produces = {"application/json"}) at the controller level
add javax.validation.constraints.NotNull annotations in the request parameters
When a normal request is handled by the controller, the return value is of type json.
However, if the request parameter is missing the parameter identified by the annotation, the xml type is returned
Request parameter validation failed handling method
enter image description here

My question is how to return a uniform json response type for failed calls

I had not dealt with similar problems, so I had no idea


问:
In-app purchases when using SauceLabs | Should I migrate to a different provider?
I know that SauceLabs does not allow you to simply provide login details and login into GPlay or App store and then proceed with your purchases - as BrowserStack does. And the only solution SauceLabs provide for this issue is buying enterprise plan and using their private devices.

Because of this I am thinking of migrating the infrastructure from SauceLabs or doing a workaround that won't require to do a login to the stores or fetch the prices for the in-app purchases. I would simply make a fake items/ fake prices to choose from in staging env and avoid the stores whatsoever.

Been thinking what other automation engineers do in this situation and what approach did you chose? Or what do you suggest is the best solution? Could not find any posts that talked much in detail regarding this issue.


问:
Stack overflow exception on FirstOrDefault()
Querying a very large table using Entity to SQL, works fine in all other parts of code and even works the first time. However, on the second time of performing an identical request, it will give a stack overflow exception. When breaking up the linq query - it happens on the .FirstOrDefault()

I believe that is when linq triggers the query to happen, such as how .ToList() kicks off the query.

I'm just confused on why a stack overflow exception would happen on a non-recursion call, as there are only 3 methods in the call stack. Since it happens on the second call every time, maybe it is building onto an existing stack outside of the scope, or maybe there is something in memory from the previous call to the DB. Anyone have any tips? let me know if I can add additional info... thank you

Small code example:

```<code>int myId = context.TABLE_NAME.Where(x => x.ID == myId).FirstOrDefault().ID;
</code>```

where TABLE_NAME is a very large table, 300+ million records, and inside of the table class it does have an unusual constructor that I have not seen in most entity classes.

```<code>    public partial class TABLE_NAME
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public TABLE_NAME()
        {
            this.OTHER_TABLE_NAME = new HashSet<OTHER_TABLE_NAME >();
        }

        public int ID { get; set; }
        ...

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<OTHER_TABLE_NAME> OTHER_TABLE_NAME{ get; set; }
    }
</code>```

Body:
Querying a very large table using Entity to SQL, works fine in all other parts of code and even works the first time. However, on the second time of performing an identical request, it will give a stack overflow exception. When breaking up the linq query - it happens on the .FirstOrDefault()

I believe that is when linq triggers the query to happen, such as how .ToList() kicks off the query.

I'm just confused on why a stack overflow exception would happen on a non-recursion call, as there are only 3 methods in the call stack. Since it happens on the second call every time, maybe it is building onto an existing stack outside of the scope, or maybe there is something in memory from the previous call to the DB. Anyone have any tips? let me know if I can add additional info... thank you

Small code example:

int myId = context.TABLE_NAME.Where(x => x.ID == myId).FirstOrDefault().ID;

where TABLE_NAME is a very large table, 300+ million records, and inside of the table class it does have an unusual constructor that I have not seen in most entity classes.

    public partial class TABLE_NAME
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public TABLE_NAME()
        {
            this.OTHER_TABLE_NAME = new HashSet<OTHER_TABLE_NAME >();
        }

        public int ID { get; set; }
        ...

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<OTHER_TABLE_NAME> OTHER_TABLE_NAME{ get; set; }
    }