这是我第一次使用CoordinatorLayout,我真的不明白它是如何工作的.
我的LinearLayout与我的工具栏重叠,好像我在FrameLayout或RelativeLayout中,我不知道怎么告诉它在下面(像android:layout_below with RelativeLayout)
这是我的代码:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="192dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:src="@drawable/logo2"
app:layout_collapseMode="pin" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/appbar"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
.... Very Large Form ...
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
另一个疑问:我看到的几乎所有例子都是使用CoordinateLayout管理RecyclerView.我的布局不是RecyclerView,只是一个很长的形式.这样做是否有意义?
我需要使用 ReactiveForms[formGroup]和formGroupName="field"
<form [formGroup]="generalForm" (ngSubmit)="onSubmit()">
<input class="form-control" placeholder="yyyy-mm-dd"
formControlName="dateIni" ngbDatepicker #a="ngbDatepicker">
</form>
Run Code Online (Sandbox Code Playgroud)
组件.ts
generalForm: FormGroup;
ngOnInit() {
this.generalForm = this.formBuilder.group({
name: ['', Validators.required],
dateIni: ['', Validators.required],
dateFin: ['', Validators.required],
registerDateLimit: ['', Validators.required],
});
Run Code Online (Sandbox Code Playgroud)
}
在我的代码中,我尝试设置一个默认值:
public dateIni: { year: 2017, month: 8, day: 8 };
Run Code Online (Sandbox Code Playgroud)
或者
@Input() dateIni: { year: 2017, month: 8, day: 8 };
Run Code Online (Sandbox Code Playgroud)
但它没有采用默认值,所有文档都只提到模板表单的情况。
任何想法我该怎么做?
我正在尝试使用Laravel 5.2中的工厂
我的代码在用户工厂中死掉:
$factory->define(App\User::class, function (Faker\Generator $faker) {
$countries = Countries::all()->pluck('id')->toArray();
return [
'name' => $faker->name,
'email' => $faker->email,
'password' => bcrypt(str_random(10)),
'grade_id' => $faker->numberBetween(1, 5),
'country_id' => $faker->randomElement($countries),
'city' => $faker->city,
'latitude' => $faker->latitude,
'longitude' => $faker->longitude,
'role_id' => $faker->numberBetween(1, 3),
'verified' => true,
'remember_token' => str_random(10),
'provider' => '',
'provider_id' => str_random(5)
];
});
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
A four digit year could not be found Data missing
Run Code Online (Sandbox Code Playgroud)
我找到了原因,但不知道如何解决它.
当我打电话给工厂时,我称之为:
factory(User::class)->create(['role_id',2]);
Run Code Online (Sandbox Code Playgroud)
如果我这样称呼它:
factory(User::class)->create();
Run Code Online (Sandbox Code Playgroud)
我没有错误.但我真的需要培养不同类型的用户......
任何的想法???
我正在使用Guzzle 6和Laravel 5.2.
我正在尝试访问一个简单的内部API:
use GuzzleHttp\Client;
$client = new Client(['base_uri' => getenv('URL_BASE').'api/v1/']);
$response = $client->request('GET', 'tournaments');
Run Code Online (Sandbox Code Playgroud)
我得到这个消息:
Fatal error: Call to undefined method GuzzleHttp\Client::request()
Run Code Online (Sandbox Code Playgroud)
当我看到文档时,它说:
$client = new GuzzleHttp\Client(['base_uri' => 'https://foo.com/api/']);
Run Code Online (Sandbox Code Playgroud)
但PHPStorm无法解决GuzzleHttp
我应该怎么做才能使它工作?
我好难过
我使用Laravel 5.2,我正在开发我的单元测试.
在Laravel 5.1中,您可以使用优秀的集成库来使用selenium,但它似乎不适用于Laravel 5.2
基本上,L5.2和Selenium之间是否存在任何集成,或者使用它是不可能的?
在这种情况下,我应该肯定留在L5.1,因为测试是我的应用程序的基本部分:(
当我管理我需要转换为数组的集合时,我通常会使用toArray().但我也可以使用all().我不知道这两个功能的差异......
有人知道吗?
我想在单独的 RUN 中运行 npm install。
这是 dockerfile
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& nvm install node && nvm use node \
&& npm cache clean -f && npm install -g n && n stable && npm install cross-env \
&& npm install \
&& npm run dev
Run Code Online (Sandbox Code Playgroud)
在这种情况下, npm install 有效
但是当我将其转换为:
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& [ …Run Code Online (Sandbox Code Playgroud) 我有一系列类别: this.categories
[ { "id": 6, "name": "categories.ladies_team" }, { "id": 2, "name": "categories.junior_team" }, { "id": 7, "name": "categories.master" }, { "id": 5, "name": "categories.ladies_single" }, { "id": 1, "name": "categories.junior" }, { "id": 3, "name": "categories.men_single" }, { "id": 4, "name": "categories.men_team" } ]
Run Code Online (Sandbox Code Playgroud)
现在我有了一个新元素:
const newCategory = {
id: category.id,
name: category.name
};
Run Code Online (Sandbox Code Playgroud)
我想插入它,如果不存在.
我试过了:
if (!this.categories.includes(newCategory)) {
this.categories.push(newCategory);
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用......
我究竟做错了什么 ?
在 Ubuntu 18.04 上,我尝试安装Hyperledger Cello,在安装过程中,我得到:
make[2]: Entering directory '/home/julien/cello'
docker-compose -f bootup/docker-compose-files/docker-compose-nfs.yml up -d --no-recreate
WARNING: Found orphan containers (cello-user-dashboard, cello-operator-dashboard, cello-watchdog, cello-keycloak-server, cello-parse-server, cello-dashboard_rabbitmq, cello-mongo, cello-keycloak-mysql, cello-engine) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting cello-nfs ... error
ERROR: for cello-nfs Cannot start service nfs: driver failed programming external connectivity on endpoint cello-nfs (d1be7a4999731983a12df9f1fb6484c7adf669be7edf01c6d962856ed8a6846f): Error starting userland …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了我的开发环境。
当我尝试通过 SequelPro 连接 mysql db 时,我得到:
Authentication plugin 'caching_sha2_password' cannot be loaded
Run Code Online (Sandbox Code Playgroud)
如:无法加载身份验证插件 'caching_sha2_password',我运行:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
Run Code Online (Sandbox Code Playgroud)
然后我可以通过 SequelPro 连接我的数据库
但是当我执行 Laravel 命令时:
php artisan migrate
Run Code Online (Sandbox Code Playgroud)
我得到:
PDOException::("PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109")
Run Code Online (Sandbox Code Playgroud)
我现在该怎么办 ?
PD:我在 Mac 上使用 Laravel Valet,而 Laravel 5.6。