小编Sve*_*ort的帖子

Pb将pandas.Series列表转换为pandas.Series的numpy数组

我想将一个pandas.Series列表转换为一个庞大的pandas.Series数组.但是当我调用数组构造函数时,它也会转换我的Series.

>>> l = [Series([1,2,3]),Series([4,5,6])]
>>> np.array(l)
array([[1, 2, 3],
       [4, 5, 6]], dtype=int64)
Run Code Online (Sandbox Code Playgroud)

我的列表很小(~10个元素),所以对于性能问题(/sf/ask/1554894421/?noredirect=1#comment33725521_22212777)我想避免创建一个pandas.DataFrame.有一个简单的解决方法吗?

提前致谢

python arrays numpy pandas

10
推荐指数
1
解决办法
3万
查看次数

移除渲染组件时 Vue 内存泄漏

在 Vue 应用程序中,我遇到内存泄漏,发生的情况如下:

  • 我们有一个在 v-for 中渲染的组件,其中包含许多子组件
  • 当从数组中删除相应的元素时,v-for 会重新渲染这些组件,并正确删除与从数组中删除的元素相对应的组件。

然而,分配的内存永远不会被释放,应用程序一开始的 RAM 使用量约为 30-40 MB,当渲染 v-for 时,RAM 使用量会增加到 200MB(最终会增加到超过 1GB,当更多元素时,浏览器会崩溃)添加或切换时)。当元素被删除时,它稳定地保持在 200MB(即使在手动垃圾收集时),所以它看起来像是保留了我的组件。

我尝试使用堆快照来定位问题,但它只显示一个子组件作为保留器。我无法找到导致该组件不被垃圾收集的原因。我已尝试取消订阅根上的所有事件侦听器,this.$root.off但这似乎根本没有帮助......

代码本身是保密的,所以我不能只是分享它,但是如果需要一些代码来理解问题,请告诉我,以便我可以提供一个复制的示例。

有谁知道如何解决这个问题,或者有任何想法如何找到内存泄漏的原因?

更新

这是在 v-for 中渲染组件的组件:

<template>
    <b-tabs card class="tabMenu" v-model="index">
        <b-tab v-for="(tab) in tabs" @click="doSomething" @change="doSomething">
                <TabComponent :tab="tab"></TabComponent>
        </b-tab>
    </b-tabs>
</template>

<script>
    import TabComponent from "./TabComponent";

    export default {
        components: {
            TabComponent,
        },
        created: function () {
            this.$root.$on("addTab", this.addTab);
        },
        data: function () {
            return {
                tabs: this.$store.state.tabs,
            }
        },
        beforeDestroy: function(){             
            this.$root.$off("addTab");

        },
        methods: {
            addTab(tab) …
Run Code Online (Sandbox Code Playgroud)

javascript memory-leaks memory-management vue.js vuex

8
推荐指数
1
解决办法
1万
查看次数

运行docker-compose build后还原软件包时收到``无法建立SSL连接''消息

运行docker-compose build后,一切正常,直到还原软件包指向,然后我收到:

无法建立SSL连接,请参阅内部异常。身份验证失败,因为远程方已关闭传输流。

通过拉出软件包,它似乎几乎可以工作一次,但是不久之后就失败了,此后一直失败。在Visual Studio中运行docker-compose时一切正常,只是通过CLI发生。

我已经重新启动了docker,重新安装了docker,多次重新运行命令,在不同的网络中尝试过,花了几天时间研究在线,重新启动的计算机。

Step 8/17 : RUN dotnet restore src/Services/Identity/Identity.API/Identity.API.csproj
 ---> Running in f3d6d7f541e3
  Restoring packages for /src/src/Services/Identity/Identity.API/Identity.API.csproj...
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/serilog.aspnetcore/index.json'.
  The SSL connection could not be established, see inner exception.
    Authentication failed because the remote party has closed the transport stream.
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.options.configurationextensions/index.json'.
  The SSL connection could not be established, see inner exception.
    Authentication failed because the remote party has closed the transport stream.
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.authentication.openidconnect/index.json'.
  The SSL …
Run Code Online (Sandbox Code Playgroud)

.net nuget docker

6
推荐指数
1
解决办法
656
查看次数

每次 Spring Boot 应用程序重新启动时,Jwt 令牌都会失效

我有一个 spring boot 应用程序,它在成功登录时生成 jwt 令牌。并且令牌将返回给用户,但每次重新启动应用程序时令牌都会失效。我在属性文件中存储了一个密钥以供测试。这是我生成它的代码,

public String createToken(String username, String role) {

    Claims claims = Jwts.claims().setSubject(username);
    claims.put("auth", role);
    claims.put("test", "test");

    Date now = new Date();
    Date validity = new Date(now.getTime() + validityInMilliseconds);

    return Jwts.builder()// 
            .setClaims(claims)//
            .setIssuedAt(now)//
            .setExpiration(validity)//
            .signWith(SignatureAlgorithm.HS256, secretKey)//
            .compact(); 
}
Run Code Online (Sandbox Code Playgroud)

即使应用程序重新启动,我也希望验证令牌。任何关于我可能做错的事情的建议都会受到赞赏。

我的配置类

public class JwtTokenFilterConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {

    private JwtTokenProvider jwtTokenProvider;

    public JwtTokenFilterConfigurer(JwtTokenProvider jwtTokenProvider) {
        this.jwtTokenProvider = jwtTokenProvider;
    }

    @Override
    public void configure(HttpSecurity http) throws Exception {
        JwtTokenFilter customFilter = new JwtTokenFilter(jwtTokenProvider);
        http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class);
    }

}
Run Code Online (Sandbox Code Playgroud)

jwt spring-boot

5
推荐指数
0
解决办法
1072
查看次数

按下Tab键时如何选择垫子选项?它的工作方式类似于垫子自动完成角度6中的输入按钮

按下Tab键时如何选择垫选项?它的工作方式应类似于垫自动完成角度6中的Enter键。

<mat-form-field class="example-full-width">
    <input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto">
    <mat-autocomplete #auto="matAutocomplete">
      <mat-option *ngFor="let option of options" [value]="option">
        {{option}}
      </mat-option>
    </mat-autocomplete>
  </mat-form-field>
Run Code Online (Sandbox Code Playgroud)

演示版

javascript material-design angular-material angular-material2 angular

3
推荐指数
1
解决办法
1564
查看次数

如何路由动态网址?

我是laravel的新手.我将此路由定义为编辑按钮:

<a href="/editTasks/{{ $task->id }}"><button class="btn btn-primary">Edit task</button></a>
Run Code Online (Sandbox Code Playgroud)

生成的网址很好,但找不到网页.我正在TaskController@edit使用此路线返回一个视图:

Route::get('/editTasks/{{ $task->id }}', 'TaskController@edit');
Run Code Online (Sandbox Code Playgroud)

有人可以帮我弄清楚我做错了什么吗?

laravel

1
推荐指数
1
解决办法
103
查看次数