下面是一个简单的samlple,我想使用for/in循环显示对象属性
var Object = { x:1, y:2, z:3 };
for (property in Object) {
console.log(Object.property);
};
Run Code Online (Sandbox Code Playgroud)
它显示未定义.
但如果使用console.log(Object[property]);它有效,并显示1 2 3
为什么我不能用于Object.property显示in/in循环?
--prefer-dist使用 create-project 安装 laravel4是什么意思?
我在 mac os x 10.11 上从源代码安装了 gcc 5.3.0,并且我在环境变量 $PATH 中设置了 gcc 5.3.0。
但是当我配置 PHP 5.5.30 时,它显示
配置:错误:C++ 预处理器“/lib/cpp”未通过完整性检查
我怎样才能解决这个问题?如何使用 gcc 5.3.0 中的 c++/cpp 而不是旧版本的 gnu c++?
作为标题,其中2个有什么区别.
什么时候更好地使用Log4j 2 SLF4J Binding,何时更好地使用Log4j 2到SLF4J适配器?
在 tomcat 中使用 java.util.logging.logger 时,我遇到了日志文件名轮换的问题。
private Logger LOGGER = Logger.getLogger(MyClass.class.getName());
private FileHandler fh = null;
Log log = new Log();
private void writeLog(String terminalId, String date_time, String msg){
log.isExists();
fh = new FileHandler(log.fullPath(), true);
fh.setLevel(Level.INFO);
fh.setFormatter(new MyLogFormatter());
LOGGER.addHandler(fh);
LOGGER.setUseParentHandlers(false);
LOGGER.setLevel(Level.INFO);
LOGGER.info("Terminal: " + terminalId);
LOGGER.info("Time: " + date_time);
LOGGER.info("message: " + msg);
}
public test() {
writeLog(mapXML.get("terminalId"), mapXML.get("date_time"), "successful");
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,log.fullPath()就像“/usr/desktop/2015-05-13.log”
在我多次执行 test() 后,多个文件如
2015-05-13.log, 2015-05-13.log.1, 2015-05-13.log.2, 2015-05-13.log.3
生成。
在 2015-05-13.log 中,它包含总消息,而带有编号的文件仅包含该执行的消息。
我知道如果在每次执行后重新启动 tomcat test(),只会创建 2015-05-13.log。
但是每次执行后我都无法重新启动tomcat。那么如何让它只生成一个日志文件呢?
当我们想要返回“welcome”视图时,return View::make("welcome") 和 return Response::view("welcome") 有什么不同吗?
如果有不同,那是什么?什么时候应该使用Response::view(),什么时候应该使用View::make()?
我想问一下,我们是否必须将Media查询放在原始CSS样式之后?
如果我把媒体查询放在原始样式之前,那是行不通的。
media screen and (max-width: 760px){
#logo_bar img#logo_image {
display: block;
margin: 5px auto 0px auto;
background-color: #c0c0c0;
float: none;
}
#logo_bar form.search_wrapper{
width: 65%;
margin: 15px auto 0px auto;
padding: 0px 0px 0px 0px;
float: none;
}
}
#logo_bar img#logo_image {
width: 218px;
height: 78px;
margin-top: 33px;
background-color: #c0c0c0;
float: left;
}
#logo_bar form.search_wrapper{
width: 55%;
height: 30px;
margin-top: 58px;
float: right;
padding: 0px 0px 0px 0px;
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我将媒体查询放在原始样式之后,它将起作用并更改样式。
#logo_bar img#logo_image {
width: 218px;
height: 78px;
margin-top: 33px; …Run Code Online (Sandbox Code Playgroud) 下面是我的代码:
String DirectoryPath = "/Users/xxx/uploads/image";
Path newDirectoryPath = Paths.get(DirecotryPath);
if (!Files.exists(newDirectoryPath)) {
Set<PosixFilePermission> permissions = PosixFilePermissions.fromString("rwxrwxrwx");
FileAttribute<Set<PosixFilePermission>> fileAttributes = PosixFilePermissions.asFileAttribute(permissions);
Files.createDirectories(newDirectoryPath, fileAttributes);
}
Run Code Online (Sandbox Code Playgroud)
创建目录后,目录的权限不是777。
我向一个地址发送一个post请求,这个地址将返回一个xml格式的数据。
我可以打印出数据,readLine(),但是当我使用readUTF(),它时总是抛出IOException。下面是代码
DataInputStream input = new DataInputStream(urlCon.getInputStream());
String inputLine = "";
if((inputLine = input.readUTF()) != null) {
System.out.println(inputLine.toString());
}
input.close();
Run Code Online (Sandbox Code Playgroud)
为什么 readUTF() 不起作用?是不是因为数据是xml格式的?
在代码中,.moneychoose是moneychoose.jsp中的div.$(".moneychoose")无法在ajax调用中选择.
$("input[name='money']").on("click", function() {
if ($("#money").find(".moneychoose")) {
$(".moneychoose").remove();
}
//append external html
$.get("moneychoose.jsp", function (data) {
$("#money").append(data);
});
$.ajax({
type: "POST",
url: "src/province_price.json",
data: '',
dataType: "json",
async: "false",
success: function(response) {
console.log($(".moneychoose"));
},
error: function(qXhr, status, error) {
alert(status + ':' + error + ':' + qXhr.responseText);
}
});
});
Run Code Online (Sandbox Code Playgroud)
但是如果我在"附加外部html"之后添加console.log($(".moneychoose")),则可以选择ajax调用中的$(".moneychoose").为什么?但是,"附加外部html"之后的$(".moneychoose")仍然无法选择.
$("input[name='money']").on("click", function() {
if ($("#money").find(".moneychoose")) {
$(".moneychoose").remove();
}
//append external html
$.get("moneychoose.jsp", function (data) {
$("#money").append(data);
});
console.log($(".moneychoose"));
$.ajax({
type: "POST",
url: "src/province_price.json",
data: '',
dataType: "json",
async: …Run Code Online (Sandbox Code Playgroud)