由买买提看人间百态

topics

全部话题 - 话题: lasttime
(共0页)
w*******e
发帖数: 395
1
来自主题: JobHunting版 - 面完了G
bool cancall() {
static int array[1000]={0};
static int totCnt;
static int lastTime;
static int index;
if(getTime()-lastTime<1) {
lastTime = getTime();
if(totCnt>=N) return false;
array[index]++;
totCnt++;
return true;
}
else {
lastTime = getTime();
index = (index+1)%1000;
totCnt -= array[index];
array[index] = 1;
totCnt++;
return true;
}
}
if you need improve the g... 阅读全帖

发帖数: 1
2
来自主题: JobHunting版 - G面试题求解
小白抛砖引玉一下。
public class Solution {
private long lastTime = System.currentTimeMillis();
private int limitPerSecond;
private int remains = limitPerSecond;

public Solution(int permitsPerSecond) {
this.limitPerSecond = permitsPerSecond;
}

public boolean acquire() {
long curTime = System.currentTimeMillis();
double timeEplaseInSec = (curTime - lastTime) / 1000.0;
lastTime = curTime;
remains += (int)(timeEplaseInSec * limitPerSecon... 阅读全帖
m*********k
发帖数: 10521
3
来自主题: _mitbbscheck版 - 2014.05.15首页文章奖励
本次统计截止时间为:2014-05-15 02:00:00 (美东时间)
成功奖励 20 伪币的用户: qingshi601, tnc, jingagain, oshzzd, SnowDen, cgjq001
, civic2002, lasttime, franey, realbug, atong, zhangmeng, BearComing, tywodx
, dsb, lulupp, zoubu, IceAge4, zhaoce073, motrin, yakima, youforever20,
ilovegmu, bmedcl, zsj2725, sjoption, aside, isakuraai, melisma, Matianleilei
, lickey1981, ZhangDejiang, monkeyqin, Emerald01, msvstar, minuszero, zwmpt,
saja, wh, yvonne33, Xiangbaobao, mitpodcast, svca, lct, cqsun83,
nationalcar, lemma
奖... 阅读全帖
c****r
发帖数: 2
4
来自主题: UESTC版 - [转载] "骄傲" 们的反应
【 以下文字转载自 ChinaNews 讨论区 】
【 原文由 LastTime 所发表 】
读到一个母子二人心灵扭曲而发生的一场悲剧, 实在令人叹息.
然而真正令人齿冷的是, 各位清华的 "骄傲" 的反应. 只想着怎么
撇清关系, 生怕污了名声. 根本就没有想到他们是活生生的人. 一有
校友作出成绩, 纷纷盛赞母校之功. 一有问题, 纷纷说与和学校没关系.
是呀, 重要的是伟大光荣正确的清华. 至于个人的悲剧, 我们眼中只
不过是丑闻而已, 不关心.
势利.
h***i
发帖数: 11
5
来自主题: Database版 - pls help me in this Sql query
ok. now i am using this query:
select fieldUserID, max(fieldvisitTime) as lastTime, fieldIP from T1 group by
fieldUserID
but the problem is, it will not return the "corresponding fieldIP". simply
it just pick the first IP for each userID group.
:(
so how?
thx
m**c
发帖数: 90
6
来自主题: Database版 - pls help me in this Sql query

Should you group by all fields instead of just fieldUserID:
... GROUP BY fieldUserID, lastTime, fieldID
by
n***n
发帖数: 10
7
来自主题: Database版 - pls help me in this Sql query
试试这个:
select t.fieldUserID, t.fieldvisitTime as lastTime, t.fieldIP
from T1 t, (select fieldUserID, max(fieldvisitTime) as visitTime
from T1 group by fieldUserID) m
where t.fieldUserID = m.fieldUserID
and t.fieldvisitTime = m.visitTime

by
p*****2
发帖数: 21240
8
来自主题: Programming版 - 怎样能把go写的稍微漂亮一点?

github
我看了,不就是我说的这样吗? 一个return。这就是你说的现代化C程序?
aeEventLoop *aeCreateEventLoop(int setsize) {
aeEventLoop *eventLoop;
int i;
if ((eventLoop = zmalloc(sizeof(*eventLoop))) == NULL) goto err;
eventLoop->events = zmalloc(sizeof(aeFileEvent)*setsize);
eventLoop->fired = zmalloc(sizeof(aeFiredEvent)*setsize);
if (eventLoop->events == NULL || eventLoop->fired == NULL) goto err;
eventLoop->setsize = setsize;
eventLoop->lastTime = time(NULL);
eventLoop->timeEventHead = ... 阅读全帖
(共0页)