小编Ank*_*wal的帖子

使用joda时间的两个日期之间的差异?

假设有两个日期A(开始时间)和B(结束时间).A&B可以是同一天甚至是不同日子的时间.我的任务是以秒为单位显示差异.我正在使用的日期格式是

Date Format :: "yyyy-MM-dd'T'HH:mm:ss.SSSZ" 
Run Code Online (Sandbox Code Playgroud)

例如

start date ::   "2011-11-16T14:09:23.000+00:00"
end date ::     "2011-11-17T05:09:23.000+00:00"            
Run Code Online (Sandbox Code Playgroud)

感谢帮助.

java jodatime

43
推荐指数
2
解决办法
3万
查看次数

solr中的布尔子句异常太多

我在框架查询中使用OR,逻辑运算符时遇到了这些问题.我不想增加maxBooleanClause值.还有其他选择吗?我的OR范围可以达到2百万.我宁愿希望如果超出范围maxBooleanClause而不是solr拆分查询,最后合并所有子查询.这种事情有可能吗?或者,如果你们中的任何一个人可以建议一些更好的技术来做到

我想绘制一个图表,其中用户提供一些日期范围,例如2013-03-01至2013-06-01之间的所有访问者访问应用程序.这里我想做一个查询,它是所有唯一id的OR.例如

      uniqueId:(1001 OR 1003 OR 1009 OR ........ OR 102467)
Run Code Online (Sandbox Code Playgroud)

感谢帮助.

solr solrj

7
推荐指数
1
解决办法
7519
查看次数

firebase(fcm)说401未经授权

private void sendMsg() {
    DBManager dbManager = DBManager.getInstance();
    ArrayList<String> firebaseIds;

    try {
        ResultSet rs= dbManager.getRegisteredFirebaseDevice();
        while(rs.next()){
            System.out.println(rs.getString(1));
            firebaseIds.add(rs.getString(1));
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }

    String url = "https://fcm.googleapis.com/fcm/send";
    URL obj = new URL(url);
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();

    // add reuqest header
    con.setRequestMethod("POST");
    con.setRequestProperty("Authorization: key", "AIzaSyAl6S936qt_NKKFwwbd-NEmiSGIL7G_yJc");
    con.setRequestProperty("Content-Type", "application/json");
    // String msg="New design added in "+getCategory(designCategory)+". Design no."+designNo;
    // String urlParameters = "data.msg="+msg+"&registration_id="+firebaseIds.get(0);

    JSONObject msg=new JSONObject();
    msg.put("msg","New design added in "+getCategory(designCategory)+". Design no."+designNo);


    JSONObject parent=new JSONObject();

    parent.put("to", firebaseIds.get(0));
    parent.put("data", …
Run Code Online (Sandbox Code Playgroud)

android java-ee firebase firebase-authentication firebase-cloud-messaging

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

org.postgresql.util.PSQLException:致命:角色“amigoscode”不存在

我是 SpringBoot 的新手。我正在尝试创建一个使用 docker 运行的 Spring Boot 应用程序。当我运行这个应用程序时,出现以下错误

org.postgresql.util.PSQLException: FATAL: role "amigoscode" does not exist
Run Code Online (Sandbox Code Playgroud)

我没有任何提示,因为我无法追踪这个错误。角色“amigoscode”已存在。我附在 application.yml 和 docker-compose.yml 下面

应用程序.yml

server:
  port: 8080

spring:
  application:
    name: customer
  datasource:
    password: password
    url: jdbc:postgresql://localhost:5432/customer
    username: amigoscode
  jpa:
    hibernate:
      ddl-auto: create-drop
    properties:
      hibernate:
        dialect: org.hibernate.dialect.PostgreSQLDialect
        format_sql: 'true'
    show-sql: 'true'
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml

services:
  postgres:
    container_name: postgres
    image: postgres
    environment:
      POSTGRES_USER: amigoscode
      POSTGRES_PASSWORD: password
      PGDATA: /data/postgres
    volumes:
      - postgres:/data/postgres
    ports:
      - "5432:5432"
    networks:
      - postgres
    restart: unless-stopped

  pgadmin:
    container_name: pgadmin
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} …
Run Code Online (Sandbox Code Playgroud)

postgresql docker spring-boot docker-compose

5
推荐指数
1
解决办法
1628
查看次数

即使您选择任何时区,以秒为单位的时间也是相同的?

在应用 TimeZone“Europe/Warsaw”后,我使用以下函数以秒为单位获取时间。

我正确获取日期,但是一旦我以秒为单位转换日期,我的输出就会出错。服务器期望时区“欧洲/华沙”中的秒数。摆脱这种困境的最佳方法是什么?

public static long getTimeInSeconds() {
    try {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        //Here you say to java the initial timezone. This is the secret
        sdf.setTimeZone(TimeZone.getTimeZone("Europe/Warsaw"));

        //Will get in Warsaw time zone
        String date = sdf.format(calendar.getTime());

        Date date1 = sdf.parse(date);

        //Convert time in seconds as required by server.
        return (date1.getTime() / 1000);

    } catch (ParseException e) {
        e.printStackTrace();
    }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

java timezone datetime epoch

1
推荐指数
1
解决办法
780
查看次数

如果我们知道时区ID,是否可以知道大陆/国家的名称?

我想知道大陆/国家提供的时区ID名称?例如

System.out.println(TimeZone.getTimeZone("PDT"));

I wanted answer as north america/america. 

System.out.println(TimeZone.getTimeZone("GMT+05:30"));

I wanted answer as asia/india.

i am not getting the desired output.

The reason of asking question :: I am storing in my database on server the timezone(PDT,GMT+05:30) as given by the mobile    
device.Now i need to perform analytics , that my app was  accessed from which continent/country.
Run Code Online (Sandbox Code Playgroud)

感谢帮助......

java java-ee

0
推荐指数
1
解决办法
792
查看次数