I try to create a list of days between two days.
I created solution like this:
this.daysBetween = [];
while (dateFrom.getDate() !== dateTo.getDate()+1 ) {
this.daysBetween.push(this.dateFrom);
dateFrom.setDate(dateFrom.getDate()+1);
}
Run Code Online (Sandbox Code Playgroud)
But it works only in 90% cases (if there is month change it doesn't work)
e.g. when I pick dates:
dateFrom: 29 august
dateTo: 30 august
Run Code Online (Sandbox Code Playgroud)
it prints me days from 29 august till 30 september ignoring 31 august ...
Any ideas how to fix my solution, or maybe there is better …
I am working with spring and my entity is
myEntity.java
@Entity
public class Ecran {
...
@OneToMany(fetch=FetchType.EAGER, cascade = { CascadeType.ALL } , mappedBy="ecran")
public Set<Fields> fields = new HashSet<>();
...
}
Run Code Online (Sandbox Code Playgroud)
and i am trying to change a property of fields like that
myPage.html
<div th:each="field, itemStat : *{fields}" >
<div class="row table-responsive-xl mt-3" >
<label class="font-weight-medium h5 black-text" th:text="${field.nom}" for="${field.idJira}"></label>
<input type="text" id="${field.id}" class="form-control mb-6" th:field="*{fields[__${itemStat.index}__].value}">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
but it's showing me this error
2018-08-20 09:09:36.000 ERROR 13144 …
我正在尝试获取分配给分类法的自定义字段。我试过这个:
$vid = 'zeme';
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
Run Code Online (Sandbox Code Playgroud)
$terms 现在存储名为“zeme”的词汇表中的所有术语。问题是当我打印这个变量时,它没有显示我需要获取的自定义字段。知道如何获得此自定义字段吗?我的代码如下所示:
$vid = 'zeme';
$terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
foreach ($terms as $term) {
$term_data[] = array(
'id' => $term->tid,
'name' => $term->name
);
}
Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用LiveData,DataBinding和Kotlin.
我为RecyclerView定义了一个绑定适配器,如下所示:
class MainListBindings {
private val TAG = "TasksListBindings"
companion object {
@JvmStatic
@SuppressWarnings("unchecked")
@BindingAdapter("main_items")
fun setItems(recyclerView: RecyclerView, items: MutableLiveData<List<Homeitem>>? = null) {
val adapter: RecyclerMainAdapter = recyclerView.adapter as RecyclerMainAdapter
//prevent use of null list
items?.let {
adapter.swapData(items)
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
和我的reyclerView in XML分配给这个bindingAdapter,如下所示:
<android.support.v7.widget.RecyclerView
android:id="@+id/main_recycler"
app:main_items="@{viewmodel.items}"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Run Code Online (Sandbox Code Playgroud)
在我的ViewModel中,我使用过
val items = MutableLiveData<List<Homeitem>>()
Run Code Online (Sandbox Code Playgroud)
创建列表.
但我在构建应用程序时遇到此错误:
Found data binding errors.
****/ data binding error ****msg:Cannot find the setter for attribute 'app:main_items' with parameter type android.arch.lifecycle.MutableLiveData<java.util.List<project.data.pojo.Homeitem>> on android.support.v7.widget.RecyclerView. file:/home/user/Yara/bazinama_mag/bazinama/app/src/main/res/layout/fragment_main.xml …
Run Code Online (Sandbox Code Playgroud) 我有一个pandas数据框,如下所示:
X Y
71455 [334.0, 319.0, 298.0, 323.0]
71455 [3.0, 8.0, 13.0, 10.0]
57674 [54.0, 114.0, 124.0, 103.0]
Run Code Online (Sandbox Code Playgroud)
我想执行一个聚合groupby
,以元素方式添加存储在Y列中的列表.代码我尝试过:
df.groupby('X').agg({'Y' : sum})
Run Code Online (Sandbox Code Playgroud)
结果如下:
Y
X
71455 [334.0, 319.0, 298.0, 323.0, 75.0, 55.0, ...
Run Code Online (Sandbox Code Playgroud)
所以它已经连接了列表而不是按元素加总.然而,预期的结果是:
X Y
71455 [337.0, 327.0, 311.0, 333.0]
57674 [54.0, 114.0, 124.0, 103.0]
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的方法,但无法按预期工作.
IntelliJ 2018.2中添加了一项新的检查,该检查应该从不稳定的API发出警告:https://youtrack.jetbrains.com/issue/IDEA-159541 .
这个警告出现在Guava的EventBus上.为什么这是一个不稳定的API?
我正在尝试使用 redux 制作一个待办事项应用程序,我正在讨论如何从数组中删除一个待办事项。
减速器.js
export default function todo(state, action) {
switch (action.type) {
case 'ADD_TODO':
return [
...state,
{
id: action.id,
text: action.text,
completed: false
}
case 'REMOVE_TODO':
return {
id: action.id,
...state.slice(id, 1)
}
default:
return state;
}
}
Run Code Online (Sandbox Code Playgroud)
动作.js
let nextTodoId = 0
export const addTodo = text => ({
type: 'ADD_TODO',
id: nextTodoId++,
text
})
export const removeTodo = id => {
type: 'REMOVE_TODO',
id
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,我可以添加和切换待办事项是否已完成。谢谢
我想从以下 URL http://localhost:8081/#/scenarios/SCNRF3SZ2FS54E66B456转到此 URL http://localhost:8081/#/scenarios/SCNRF3XAPLPJ241807A9。但它不起作用,代码如下:
export default new Router({
mode: 'hash',
linkActiveClass: 'open active',
scrollBehavior: () => ({ y: 0 }),
routes: [
{
path: '/',
redirect: '/scenarios/:id',
component: Full,
beforeEnter: beforeEnter,
children: [{
path: '/scenarios/:id',
name: 'Scenario',
component: Scenario
}]
}
]
})
Run Code Online (Sandbox Code Playgroud)
我该如何让它发挥作用?
我在我的 flutter 项目中使用了一些不再需要的包,即wilddog_auth
and wilddog_sync
,我可以从pubspec.yaml
文件和我的 dart 文件中import 'package:wilddog_sync/wilddog_sync.dart'
删除导入(也称为删除等)并删除 MainActivity.java 和 Xcode 项目中的导入,但是我无法清除 flutter、cocoapod 和 gradle 安装的未使用文件。现在flutter中有一个统一的命令可以一次删除所有未使用的包吗?
我敢肯定,使用flutter clean
只删除build文件夹,并使用flutter packages get
从删除软件包后pubspec.yaml
不会删除软件包cocoapod
或gradle
两种。
例如,在flutter clean
和flutter packages get
我重建项目:
Launching lib/main.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
I/FlutterActivityDelegate(11331): onResume setting current activity to this
I/Choreographer(11331): Skipped 107 frames! The application …
Run Code Online (Sandbox Code Playgroud) bundling-and-minification flutter flutter-dependencies flutter-packages
我有以下数据:
Group Hormone Damage Score Greater
1 B control damaged 4 1
2 B control undamaged 4 1
3 B JA damaged 2 0
4 B JA undamaged 3 0
5 D control damaged 2 0
6 D control undamaged 1 0
7 D JA damaged 4 1
8 D JA undamaged 3 1
Run Code Online (Sandbox Code Playgroud)
我手动创建了"更大"列.从本质上讲,它问"在一个群体中,哪个受损的分数值更大?" 较大的值分配为1,较小的值为0.
如何为我创建一些代码?我尝试过以下dplyr代码,但没有成功:
df%>% group_by(Group) %>%
mutate(Greater1 = if_else(Score>Score, 0,1))
Run Code Online (Sandbox Code Playgroud)
如果已经提出这个问题,请告诉我,因为我找不到类似的问题.
arrays ×2
java ×2
aggregate ×1
android ×1
data-binding ×1
date ×1
dplyr ×1
drupal-8 ×1
flutter ×1
grouping ×1
javascript ×1
kotlin ×1
list ×1
object ×1
pandas ×1
python ×1
r ×1
react-redux ×1
reactjs ×1
redux ×1
spring ×1
spring-boot ×1
thymeleaf ×1
typescript ×1
vue-router ×1
vue.js ×1
vuejs2 ×1