我有一个复杂的DataFrame结构,并希望轻松地使列无效.我已经创建了隐式类来连接功能并轻松地解决2D DataFrame结构,但是一旦DataFrame变得更复杂,使用ArrayType或MapType,我就没有太多运气了.例如:
我将架构定义为:
StructType(
StructField(name,StringType,true),
StructField(data,ArrayType(
StructType(
StructField(name,StringType,true),
StructField(values,
MapType(StringType,StringType,true),
true)
),
true
),
true)
)
Run Code Online (Sandbox Code Playgroud)
我想生成一个新的DF,其data.valueMapType 字段设置为null,但由于这是一个数组元素,我无法弄清楚如何.我认为它类似于:
df.withColumn("data.values", functions.array(functions.lit(null)))
Run Code Online (Sandbox Code Playgroud)
但这最终会创建一个新列,data.values并且不会修改values数据数组的元素.
我希望子组件访问共享服务并在将子组件注入主组件之后获取数据。我想让sharedservice(rootscope)的数据直接把数据放到mainComponents HTML中,就像这里。
主组件.ts
import { Component } from '@angular/core';
import {ChildComponent} from './child';
import {AppServiceService} from './app-service.service';
@Component({
moduleId: module.id,
selector: 'rootscope-app',
templateUrl: 'rootscope.component.html',
styleUrls: ['rootscope.component.css'],
directives:[ChildComponent]
})
export class RootscopeAppComponent {
title = 'rootscope works!';
display:any;
constructor(appServiceService:AppServiceService){
this.display=appServiceService.getter();
}
}
Run Code Online (Sandbox Code Playgroud)
共享服务.ts
import { Injectable} from '@angular/core';
@Injectable()
export class AppServiceService {
ser = "hello i am from service";
public data: any;
constructor() {
}
settter(data: any) {
this.data = data;
}
getter() {
return this.data; …Run Code Online (Sandbox Code Playgroud) 如何在this.resFormGroup.patientName.lastname.value不使用的情况下获得价值[ngModel]?
有什么目的name="resForm",[formGroup]="resFormGroup"并#resNgForm="ngForm"在HTML <form>标签?
我需要的模板引用变量#resNgForm,因为我有[formGroup]="resFormGroup"?
这是我的组成部分:
// FormBuilder
this.resFormGroup = this.formBuilder.group({
patientName: this.formBuilder.group({
firstname: ['', Validators.required],
lastname: ['', Validators.required]
}),
address: this.formBuilder.group({
street: [],
zip: [],
city: []
})
});
Run Code Online (Sandbox Code Playgroud)
这是我的模板:
<form name="resForm" [formGroup]="resFormGroup" (ngSubmit)="onSubmit()" #resNgForm="ngForm">
<fieldset formGroupName="patientName">
<legend>Name</legend>
<label>Firstname:</label>
<input type="text" formControlName="firstname" [(ngModel)]="myFirstName">
<label>Lastname:</label>
<input type="text" ***formControlName="lastname"***>
</fieldset>
<fieldset formGroupName="address">
<legend>Address</legend>
<label>Street:</label>
<input type="text" formControlName="street">
<label>Zip:</label>
<input type="text" formControlName="zip">
<label>City:</label>
<input type="text" formControlName="city">
</fieldset>
<button …Run Code Online (Sandbox Code Playgroud) 我试图找到一种方法来备份我的数据库设计,而不包括存储在数据库中的数据.实际上,有人可能会说我想拥有一个包含数据库中所有"CREATE Scripts"的文件.理想情况下,此文件可用于重新创建数据库(当然没有数据).
如何避免数据库备份中的数据?
我正在使用pgAdmin 4.1.3和PostgreSQL 9.6.
我有工具栏工作,但它在页面顶部留下了一个间隙,而不是平滑.
此外,我希望它是粘性的,但还没有在那部分工作,因为它看起来不像我的工具栏实现是一个"标题".我做错了什么或者我使用了错误的组件?
<md-toolbar color="primary">
<i class="material-icons app-toolbar-menu">menu</i>
<span class="app-toolbar-filler"></span>
<md-sidenav>
</md-sidenav>
</md-toolbar>
Run Code Online (Sandbox Code Playgroud) 正如标题所说,当我尝试使用ldap_sort()它返回的方法时deprecated method
为什么 ?有同等的吗?
是否可以在过滤器中对 AZ 进行排序?
在阅读了很多关于C#的不变性并且理解它的好处(没有副作用,安全字典键,多线程......)后,我想到了一个问题:
为什么在C#中没有关键字断言类(或结构)是不可变的?此关键字应在编译时检查您是否无法改变类(或结构).例如:
public immutable class MyImmutableClass
{
public readonly string field;
public string field2; //This would be a compile time error
public readonly AnyMutableType field3; //This would be a compile time error
public string Prop { get; }
public string Prop2 { get; set; } //This would be a compile time error
public AnyMutableType Prop3 { get; } //This would be a compile time error
}
Run Code Online (Sandbox Code Playgroud)
我认为编译器的工作非常简单,因为它需要检查一些事情:
这个设计让我想到了一些可能的问题:
IEnumerable<T>)不变性取决于类型的不变性<T>.建议的 …I would like to add a checkbox in a Material Design table in Angular 4, it would be under the column Publish. The problem is that the checkbox doesn't show in the table just the text with and error message
"No value accessor for form control with unspecified name attribute"

Here is my code:
<div class="mat-table-container mat-elevation-z8">
<mat-table #table [dataSource]="assessmentManualList">
<ng-container cdkColumnDef="documentID">
<mat-header-cell *cdkHeaderCellDef> </mat-header-cell>
<mat-cell *cdkCellDef="let row">
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item>
<mat-icon><i class="material-icons">content_copy</i></mat-icon>
<span>Copy …Run Code Online (Sandbox Code Playgroud) 我正在尝试根据元素的宽度和高度进行一些计算,但由于某种原因,这些在AfterViewInit生命周期挂钩上无法立即使用(两者均为 0)。
虽然setTimeout似乎确实可以解决问题,但我不喜欢它。
这是什么原因造成的?有没有更优雅的解决方案?
@ViewChild('main') mainDiv: ElementRef;
ngAfterViewInit() {
this.printMainHeight() // 0
// with setTimeout width is correctly retrieved ...
setTimeout(() => this.printMainHeight()) // 430
}
printMainHeight() {
console.log(this.mainDiv.nativeElement.getBoundingClientRect().height)
}
Run Code Online (Sandbox Code Playgroud)
HTML
<div class"main" #main>
<app-toolbar></app-toolbar>
<app-list></app-list>
</div>
Run Code Online (Sandbox Code Playgroud) 我需要构建一个执行以下操作的安装程序:
知道如何去做吗?
java installer software-distribution cross-platform autostart
angular ×5
apache-spark ×1
autostart ×1
backup ×1
c# ×1
checkbox ×1
formbuilder ×1
html ×1
immutability ×1
installer ×1
java ×1
javascript ×1
ldap ×1
php ×1
postgresql ×1
scala ×1