我正在使用这个公式
ThisWorkbook.Sheets("Overview").Range(formrange).Formula = "=IF(OR(ISBLANK(B2);WEEKDAY(DATE($B$38;$B$37;B2);2)>5;DAY(EOMONTH(DATE($B$38;$B$37;B$3);0))<B2);0;IF(C2=""Y"";0,5;1))"
Run Code Online (Sandbox Code Playgroud)
我有以下错误
Run-time error "1004"
Application-denied or object-defined error
Run Code Online (Sandbox Code Playgroud)
你们想知道那是什么吗?
子类具有IS-A与其基类一起描述的关系,但是基类不与其子类共享这种关系。我一直在徘徊接口与实现类之间的关系,因为该类的对象可以传递给接口对象,并且接口对象只能访问为它定义的具体接口的方法。
public class main {
public static void main(String[]args){
Nigeria ng = new Nigeria(){};
//Interface object can accept Nigerias object which is not posible in Inheritance
Continent continent = ng;
//prints Country is in Africa
continent.Africa();
//continent.language(); will not compile language is not in the interface
//Print Democratic thought this should print Undefined since it is inialied with default.
continent.Goverment();
}
}
interface Continent{
public void Africa();
default void Goverment(){
System.out.println("Undefined");
}
}
class Nigeria implements Continent{
@Override …Run Code Online (Sandbox Code Playgroud) 我经常有一个问题Optional和相似的类Option,Try,Either从VAVR例如。
假设我有一些Optional,如果它为空,我想立即从一个方法中返回(无例外,因为我的方法Optional也在返回,所以getOrElseThrow不在图片之列),如果存在,我想进一步处理它。
public Optional<Integer> converter() {
Optional<String> opt = getSomething();
if(!opt.isPresent())
return Optional.empty();
String value = opt.get();
// some manipulations on value, such as map and flatMap would cause a huge mess
return Integer.parseInt(value);
}
Run Code Online (Sandbox Code Playgroud)
我只需要在值为空的情况下立即返回,就不能建立mapand的链flatMap。整个痛苦都在做.get()。有点像getOrElseThrow,但是用return代替throw会很棒- getOrElseReturn。显然在Java中是不可能的,因此我考虑在Kotlin中尝试此操作。
fun safeOptional(): Optional<Int> {
val extracted = Optional.of("123")
.getOrElseReturn { return Optional.empty() }
val …Run Code Online (Sandbox Code Playgroud) 有人可以解释为什么循环检查条件是否不同于-1?
while ((c = in.read()) != -1) {
out.write(c);
}
Run Code Online (Sandbox Code Playgroud) 我有这些帮助方法:
public static IQueryable<T> All<T>(this IUnitOfWork unitOfWork)
where T : class
{
return unitOfWork.Context.Set<T>();
}
public static T Find<T>(this IUnitOfWork unitOfWork, Func<T, bool> predicate)
where T : class
{
return unitOfWork.All<T>().FirstOrDefault(predicate);
}
Run Code Online (Sandbox Code Playgroud)
当我打电话给第二个这样的时候:
var payment = _unitOfWork.Find<ContactRow>
(p => p.PaymentAttemptRef == paymentAttemptRef
&& p.ContactType == type);
Run Code Online (Sandbox Code Playgroud)
我希望谓词成为查询的一部分!! 但问题是生成的选择是没有where子句并且拉回表中的所有行.
知道为什么会这样吗?第二种方法调用第一种方法,返回一个iqueryable,所以我认为不会这样做?
我有一个例子如下.我只想转换由','分隔的字符串,并将其转换为长数组而不使用空字符串.productIdParams包含[1],但是当我执行它时,我得到一个例外.
java.lang上的java.lang.System.arraycopy(Native Method)中的java.lang.ArrayStoreException java.util.stream.Nodes上的java.util.stream.SpinedBuffer.copyInto(SpinedBuffer.java:194).$ SpinedNodeBuilder.copyInto(Nodes.java) :1290)java.util.stream上的java.util.stream.SpinedBuffer.asArray(SpinedBuffer.java:215)java.util.stream.Nodes $ SpinedNodeBuilder.asArray(Nodes.java:1296)java.util.stream.ReferencePipeline.toArray( ReferencePipeline.java:439)
String test = "1,";
String[] productIdParams = Iterables.toArray(com.google.common.base.Splitter.on(",").omitEmptyStrings().split(test), String.class);
try {
Long[] productIds = Arrays.stream(productIdParams).filter(productId -> !productId.isEmpty()).toArray(Long[]::new);
System.out.println(productIds[0]);
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
有什么不对?
谢谢.