小编Val*_*ire的帖子

在Neo4j中删除节点及其关系(如果有)

我正在尝试执行以下查询:

MATCH (movie:Movie {title:"test"})-[r]-() DELETE movie, r
Run Code Online (Sandbox Code Playgroud)

删除:电影节点及其所有关系.这一切都很好,除非查询没有任何关系,它无法匹配电影.我尝试过OPTIONAL MATCH,但没有运气.

我正在寻找一种删除电影节点的方法,无论它是否有任何关系,但如果有,也要删除它们.

neo4j cypher

14
推荐指数
2
解决办法
6524
查看次数

Java 8 foreach将子对象添加到新列表中

在Java 8中是否可以编写如下内容:

List<A> aList = getAList();
List<B> bList = new ArrayList<>();

for(A a : aList) {
    bList.add(a.getB());
}
Run Code Online (Sandbox Code Playgroud)

我认为它应该是以下几个方面的组合:

aList.forEach((b -> a.getB());
Run Code Online (Sandbox Code Playgroud)

要么

aList.forEach(bList::add);
Run Code Online (Sandbox Code Playgroud)

但我不能混合这两个来获得所需的输出.

java foreach lambda java-8

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

Android通知时间

我现在正在寻找几个小时如何做到这一点:

我希望每天(除了周末)一次发送通知(比如18:00(= 6pm)),除非应用程序已经打开.当你收到邮件时,它基本上就像是gmail应用程序.当用户单击通知时,它应该消失,并且应该被带到MainActivity.

我已经使用AlarmManager尝试过很多东西,但没有一个导致出现通知.

我尝试的代码,我觉得非常接近正确,遵循:在我的MainActivity中:

AlarmManager alarmManager = (AlarmManager) this.getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 18);
Intent intent = new Intent(this, NotificationService.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
Run Code Online (Sandbox Code Playgroud)

我的通知服务:

public class NotificationService extends IntentService {



    public NotificationService() {
        super("NotificationService");
    }

    @Override
    @SuppressWarnings("deprecation")
    protected void onHandleIntent(Intent intent) {
        NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        Notification notification = new Notification(R.drawable.ic_launcher, "reminder", System.currentTimeMillis());
        notification.defaults |= Notification.DEFAULT_SOUND;
        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        Intent notificationIntent = new Intent(this, MainActivity.class);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0, …
Run Code Online (Sandbox Code Playgroud)

notifications android alarmmanager android-notifications

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

如何连接在Kubernetes上运行的MySQL

我已将我的应用程序部署在Google gcloud容器引擎上.我的申请需要MySQL.应用程序运行正常并MySQL正确连接.但是我想MySQL使用MySQLClient(Workbench或命令行)从我的本地机器连接数据库,有人可以帮助我如何将它暴露给本地机器吗?以及如何MySQLgcloudshell 上打开命令行?

我已经运行低于命令,但外部IP不存在:

$ kubectl get deployment
NAME           DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
app-mysql   1         1         1            1           2m
$ kubectl get pods
NAME                            READY     STATUS             RESTARTS   AGE
app-mysql-3323704556-nce3w   1/1       Running            0          2m
$ kubectl get service
NAME           CLUSTER-IP    EXTERNAL-IP       PORT(S)    AGE
app-mysql   11.2.145.79   <none>            3306/TCP   23h
Run Code Online (Sandbox Code Playgroud)

编辑

我正在使用下面的yml文件:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: app-mysql
spec:
  replicas: 1
  template:
    metadata:
      labels: …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform kubernetes

8
推荐指数
2
解决办法
8028
查看次数