小编Thi*_*ena的帖子

如何在Java中创建不带Year参数的新Date对象?

我正在尝试使用new SimpleDateFormat来解析dd-MM格式的字符串。基本上,我想从字符串中创建一个日期对象并保留在数据库中。

当我检查数据库条目时,我看到它将1970追加到year列。我相信这是空时提供的年份的默认值。有没有一种方法可以防止年份值。我不想存储有关年份的信息。

我的代码-

String dateOfBirth = "14-Feb";
dbObject.save(new SimpleDateFormat("dd-MMM").parse(dateOfBirth));
Run Code Online (Sandbox Code Playgroud)

为了简单起见,假设dbObject.save()该方法期望提供日期对象。我不想创建一个值的日期-1970年2月14日,相反它应该只是14年2月。

java time jsp date simpledateformat

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

Pandas: increase speed of rolling window (apply a custom function)

I'm using this code to apply a function (funcX) on my data-frame using a rolling window. The main issue is that the size of this data-frame (data) is very large, and I'm searching for a faster way to do this task.

import numpy as np

def funcX(x):
    x = np.sort(x)
    xd = np.delete(x, 25)
    med = np.median(xd)
    return (np.abs(x - med)).mean() + med

med_out = data.var1.rolling(window = 51, center = True).apply(funcX, raw = True)
Run Code Online (Sandbox Code Playgroud)

The only …

python performance median dataframe rolling-computation

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

How to repeat character in HTML with responsive resizing?

I am trying to create rows in a DIV where there are three pieces of information to display. A left align text, a right align text, and repeat character "." between the two

在此处输入图片说明

I tried this using the HTML below. But it is not working with a div for each piece.

 <div style="margin-bottom:5px"><!-- row 1 -->

    <div style="float:left;">Left</div> <!-- left column -->
    <div style="display: inline-block;">...</div> <!-- center column -->
    <div style="float:right;">Right</div> <!-- center column -->

  </div><!-- row 1 -->
Run Code Online (Sandbox Code Playgroud)

I …

html javascript

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