小编ryk*_*boy的帖子

Angular 2 - 为什么我需要zone.run()?

我正在尝试在Angular 2中创建一个显示服务数据的组件.该服务基本上从用户输入一些json文件后加载一些数据.我一直试图让组件更新,但它似乎没有认识到更改,除非我从我的服务提交事件后调用zone.run().组件的代码如下:

@Component({
    selector: 'assess-asset-group',
    directives: [AssetComponent, AssetHeaderComponent, NgFor, NgIf],
    template: `

            <div *ngIf="assetService.schema != null">
                <div class="asset-group" *ngFor="#assetTypeName of assetService.schema.assetTypeNames"> 
                    <div class="asset-type-title"><span>{{assetService.schema.assetTypes[assetTypeName].name}}s</span></div> 
                    <table class="asset-group-table" cellpadding=0 cellspacing=0>
                        <thead>
                            <tr assess-asset-header [assetType]="assetService.schema.assetTypes[assetTypeName]"></tr>
                        </thead>
                        <tbody>
                            <tr assess-asset *ngFor="#asset of assetService.assetsForType(assetTypeName)" [asset]="asset"></tr>
                        </tbody>
                    </table>
                    <button class="new-asset-btn" (click)="assetService.addAsset(assetTypeName)">New</button>
                </div>
            </div>`,
    providers: [provide(AssetService, {useValue: injector.get(AssetService)})]
})
export class AssetGroupComponent {

    public assetService: AssetService;
    public zone: NgZone;

    constructor( @Inject(AssetService) assetService: AssetService, zone: NgZone) {
        this.assetService = assetService;
        this.zone = zone;
    }

    ngOnInit() {
        this.assetService.proejectLoadedEmitter.subscribe((e) => { …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

将批处理文件添加到PATH

我试图通过将包含它的目录添加到PATH来全局运行.bat文件.这显然适用于exe文件,但有没有办法以这种方式运行.bat文件?

cmd path batch-file

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

使用 Xcode 11 beta 的 iOS 11 上的命名颜色问题

我正在尝试在我的 iOS 应用程序中实现暗模式。我需要使用命名颜色才能做到这一点,但我遇到了一些障碍。在明暗模式之间切换时,在 iOS 13 模拟器上一切正常,并且在 iOS 12 模拟器中颜色也正确。当我尝试在 iOS 11 模拟器上运行我的应用程序时会出现问题。我在故事板中使用的任何命名颜色默认为颜色的深色版本,当我尝试在代码中访问命名颜色时,我得到零。只是想知道是否有其他人遇到过这种情况

xcode ios ios13 xcode11

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

Tokio Tls 自签名证书

更新:这似乎更像是正确生成和信任自签名证书的问题

我正在使用 tokio-rs 构建服务器和客户端。我一切正常,但现在正在尝试将 SSL/TLS 添加到系统中。据我所知,我已经生成了一个自签名证书并正确安装了它,但是每次我尝试让客户端连接到服务器时,我都会收到以下错误:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failure(Ssl(ErrorStack([Error { code: 336134278, library: "SSL routines", function: "ssl3_get_server_certificate", reason: "certificate verify failed", file: "s3_clnt.c", line: 1264 }])))', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:837
Run Code Online (Sandbox Code Playgroud)

我正在使用以下脚本生成 crt、key 和 pfx 文件:

openssl req -nodes -x509 -newkey rsa:2048 -config ssl.conf -extensions ext -subj /C=CA/ST=EH/L=Canadia/O=Dis/CN=localhost -keyout localhost.key -out localhost.crt -days 365
openssl pkcs12 -export -nodes -inkey localhost.key -in localhost.crt -out localhost.pfx
mv localhost.pfx ../
Run Code Online (Sandbox Code Playgroud)

使用这个配置文件

[req]
distinguished_name=dn
[ dn ]
CN=localhost
[ ext …
Run Code Online (Sandbox Code Playgroud)

ssl rust rust-tokio

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

SQL选择基于子查询中的值

我正在尝试根据具有ID的其他用户的经度和纬度选择一组用户。我需要在查询的SELECT语句中进行距离计算,并且不确定如何访问要搜索的用户的经度和纬度。

到目前为止,这是我的查询(无效)

SELECT 
    *, 
    (SELECT u1.latitude, u1.longitude 
     FROM user u1 
     WHERE u1.id = '77c3d4e0-37f6-4fae-b8ac-66cffad07179'), 
    (3959 * acos(cos(radians(u1.latitude))
          * cos(radians(latitude))
          * cos(radians(longitude) - radians(u1.longitude))
    + sin (radians(u1.latitude))
       * sin(radians(latitude)))) AS distance 
FROM 
    user u2
Run Code Online (Sandbox Code Playgroud)

基本上,我想从用户那里获取所有列,并获取一个称为距离的列,该距离是具有ID的用户的距离

sql postgresql

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

标签 统计

angular ×1

batch-file ×1

cmd ×1

ios ×1

ios13 ×1

path ×1

postgresql ×1

rust ×1

rust-tokio ×1

sql ×1

ssl ×1

typescript ×1

xcode ×1

xcode11 ×1