小编San*_*ngi的帖子

git pull error:错误:远程ref在但是预期

完整信息:

error: Ref refs/remotes/origin/user is at 3636498c2ea7735fdcedc9af5ab3c8689e6abe77 but expected a21359c6cc2097c85775cde6a40105f4bd7100ec
From github.com:{github project url}
 ! a21359c..6273ffc  user -> origin/user  (unable to update local ref)
Run Code Online (Sandbox Code Playgroud)

git pull git-pull

211
推荐指数
11
解决办法
10万
查看次数

我们是否应该始终在第一行中检查java中方法的每个参数是否为null?

每个方法都接受一组参数值.我们是否应该始终验证输入参数的非零值或允许代码失败RunTimeException

我看过很多代码,人们并没有真正检查输入参数的空值,只是使用参数编写业务逻辑.什么是最好的方法?

void public( String a, Integer b, Object c)
{
  if( a == null || b == null || c == null)
  {
    throw new RunTimeException("Message...");
  }
  .....business logic.....
}
Run Code Online (Sandbox Code Playgroud)

java validation parameters methods null

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

释放指针并将其指定为NULL有什么区别?

有人可以告诉我之间的区别:

int *p;
p=(int*)malloc(10*sizeof(int));
free(p);
Run Code Online (Sandbox Code Playgroud)

要么

int *p;
p=(int*)malloc(10*sizeof(int));
p=NULL;
Run Code Online (Sandbox Code Playgroud)

c free pointers

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

如何用理论附加DataPoint?

@DataPoints public static final Integer[] input1={1,2};
@Theory
@Test
public void test1(int input1){

}

@DataPoints public static final Integer[] input2={3,4};
@Theory
@Test
public void test2(int input2 ){

}
Run Code Online (Sandbox Code Playgroud)

我希望test1运行数据集input1 - {1,2},test2运行input2 - {3,4}.但目前每个测试都使用两个数据集{1,2,3,4}运行.如何将特定的@DataPoints绑定到特定的@Theorys

theory junit datapoint

18
推荐指数
2
解决办法
8954
查看次数

有效的随机生成算法与否?

long timeValue = timeInMillis();
int rand = timeValue%100 + 1;
Run Code Online (Sandbox Code Playgroud)

如果我们在循环中执行上述代码N次,它将生成1到100之间的N个随机数.我知道随机数的生成是一个棘手的问题.只是想知道这是一个很好的随机数生成算法吗?还是伪随机数发生器?

为什么我认为这会产生对随机行为的良好估计?1)1到100之间的所有不均匀分布.没有偏见.2)timeInMillis将显示一些随机行为,因为我们永远无法猜测CPU将执行此功能的时间.在CPU中运行有很多不同的任务.因此,在下一次循环迭代中,timeInMillis()指令的执行的准确时间是不可预测的.

random

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

在下面的两个sql查询中,建议哪一个更好.单个查询加入或两个简单查询?

假设A)中的第一个查询结果(envelopecontrolnumber,partnerid,docfileid)=(000000400,31,35)

一个)

select envelopecontrolnumber, partnerid, docfileid 
from envelopeheader 
where envelopeid ='LT01ENV1107010000050';

select count(*) 
from envelopeheader 
where envelopecontrolnumber = '000000400' 
  and partnerid= 31 and docfileid<>35 ;
Run Code Online (Sandbox Code Playgroud)

要么

B)

select count(*)  
from envelopeheader a 
join envelopeheader b on a.envelopecontrolnumber = b.envelopecontrolnumber 
                       and a.partnerid= b.partnerid 
                       and a.envelopeid = 'LT01ENV1107010000050' 
                       and b.docfileid <> a.docfileid;
Run Code Online (Sandbox Code Playgroud)

我在sql函数中使用上面的查询.我在pgAdmin(postgres)中尝试了查询,它显示了16ms(A)和B).当我在pgadmin上分别尝试B)的查询时.它仍然分别为每一个显示16毫秒 - 为B)制作32毫秒 - 这是错误的,因为当你从B中一次运行两个查询时,它显示16毫秒.请建议哪一个更好.我正在使用postgres数据库.

sql postgresql join function

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

为什么我们需要HTTP GET?是否有任何HTTP POST无法实现的功能?

据我所知,GET可以做什么,POST也可以实现.那么为什么在定义HTTP协议时首先需要GET.如果GET仅用于获取资源,则人们仍然可以通过在URL中发送参数值来更新资源.为什么这个漏洞?或者在服务器端进行编码以在GET请求上更新资源的人编写了错误的代码?

post get http

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

标签 统计

c ×1

datapoint ×1

free ×1

function ×1

get ×1

git ×1

git-pull ×1

http ×1

java ×1

join ×1

junit ×1

methods ×1

null ×1

parameters ×1

pointers ×1

post ×1

postgresql ×1

pull ×1

random ×1

sql ×1

theory ×1

validation ×1