如果问题很简单,对卡桑德拉来说很新,所以道歉.
我创建了一个表:
create table ApiLog (
LogId uuid,
DateCreated timestamp,
ClientIpAddress varchar,
primary key (LogId, DateCreated));
Run Code Online (Sandbox Code Playgroud)
这项工作很好:
select * from apilog
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用DateCreated添加where子句,如下所示:
select * from apilog where datecreated <= '2016-07-14'
Run Code Online (Sandbox Code Playgroud)
我明白了:
Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING
从其他关于SO的问题和关于datastax的教程我的理解是,由于datecreated列是一个聚类键,它可以用来过滤数据.
我也试图创建一个索引,但我收到相同的消息.我试图从主键中删除DateCreated并将其仅作为索引,我仍然得到相同的回复:
create index ApiLog_DateCreated on dotnetdemo.apilog (datecreated);
Run Code Online (Sandbox Code Playgroud) 我想用angular2在ag-grid上实现外部过滤.
github上的ag-grid 示例似乎没有实现外部过滤器,类似的问题尚未得到解答.有没有办法在带有angular2的ag-grid中实现外部过滤器?
我有以下内容:
模板:
<input (keyup)="updateFilters($event)" name="filterAgreementNumber" #filterAgreementNumber/>
<ag-grid-ng2 #agGrid
style="width: 100%;"
[style.height.px]="height"
class="ag-fresh"
[gridOptions]="gridOptions"
[rowData]="promises"
(window:resize)="onResize($event)">
Run Code Online (Sandbox Code Playgroud)
零件:
export class PromisesListComponent {
private gridOptions: GridOptions;
private promises: Promise[];
filterAgreementNumber = '';
constructor(private promisesService: PromisesService) {
this.gridOptions = {
rowData: this.promises,
columnDefs: this.createColumnDefs(),
enableColResize: true,
enableSorting: true,
enableFilter: true,
isExternalFilterPresent: this.externalFilterPresent,
doesExternalFilterPass: this.externalFilterPass,
}
updateFilters(event: any) {
this.filterAgreementNumber = event.target.value; //correctly assigns property
this.gridOptions.api.onFilterChanged();
}
externalFilterPass(node: any) {
console.log(this.getFilterAgreementNumber); //undefined
if (this.filterAgreementNumber && this.filterAgreementNumber.length > 0) …Run Code Online (Sandbox Code Playgroud) 我的活动有底部导航,我想获取活动中导航片段之一的实例。
我试图通过首先获取 的实例然后获取using的实例来获取活动com.myapp.ui.MapFragment内部的实例onCreate(在 setContentView 之后):nav_host_fragmentcom.myapp.ui.MapFragmentchildFragmentManager
val navFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment)
val mapFragment = navFragment!!.childFragmentManager.findFragmentById(R.id.navigation_map)
Run Code Online (Sandbox Code Playgroud)
它找到了 navFragment 的实例,但 mapFragment 为空。
这是活动布局:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/twitter_activity_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/nav_view"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation"
android:layout_weight="90"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_weight="10"
app:menu="@menu/bottom_nav_menu" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
这是导航布局:
<?xml version="1.0" encoding="utf-8"?>
<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_map">
<fragment
android:id="@+id/navigation_map"
android:name="com.myapp.ui.map.MapFragment"
android:label="@string/title_map" …Run Code Online (Sandbox Code Playgroud) 在模拟器上使用 API 25:
adb shell settings put secure android_id 8af8770a27cfd182
adb shell settings get secure android_id //gives 8af8770a27cfd182
Secure.getString(context.getContentResolver(), Secure.ANDROID_ID) //gives 8af8770a27cfd182
Run Code Online (Sandbox Code Playgroud)
在模拟器上使用 API 26:
adb shell settings put secure android_id 8af8770a27cfd182
adb shell settings get secure android_id //gives 8af8770a27cfd182
Secure.getString(context.getContentResolver(), Secure.ANDROID_ID) //gives 6e4f84f5513b80e1
Run Code Online (Sandbox Code Playgroud)
我已经阅读了 API 25 和 26 之间 ANDROID_ID 的变化,但为什么 adb 和代码给了我不同的结果?
更新:
创建了一个简单的应用程序来消除旧应用程序的复杂性。新应用有一个主要活动,上面有一个按钮:
package com.example.diolaj01.testandroidid;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud)