使用Android Studio(Beta)编译我的Android应用程序后,出现以下错误:
Error:error: Resource entry background is already defined.
res\drawable-xhdpi-v4\background.9.png:0: Originally defined here.
Run Code Online (Sandbox Code Playgroud)
当我在res文件夹中有一个名为"background"的图像文件时,会发生这种情况.
然后我制作了它的9补丁版本并将其粘贴在同一个文件夹中.这意味着有2个文件具有相同的名称.所以我不出所料,我有这个错误.
但是我现在在我的代码和布局文件中删除了所有背景图像文件的实例(包括9补丁版本和原始图像),但我仍然有这个错误.
我想打印当天的名字给出从1到7的数字.
例如:
<?php
echo date("1");
?>
Run Code Online (Sandbox Code Playgroud)
并希望得到输出Monday.但它打印1.
谁能帮我?
我正在尝试阅读本教程:http: //www.tcpdump.org/pcap.html
现在我使用以下命令安装pcap(代码提示和所有工作):
sudo apt-get install libpcap-dev
Run Code Online (Sandbox Code Playgroud)
到目前为止,我有以下代码(文件名是example_pcap.c):
#include <stdio.h>
#include <pcap.h>
int main(int argc, char *argv[]) {
char *dev, errbuf[PCAP_ERRBUF_SIZE];
dev = pcap_lookupdev(errbuf);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
根据我已经看到的许多问题,他们说使用这个编译它:
gcc -lpcap example_pcap.c -o example_pcap
Run Code Online (Sandbox Code Playgroud)
但是我仍然收到以下错误:
example_pcap.c:(.text+0x32): undefined reference to `pcap_lookupdev'
Run Code Online (Sandbox Code Playgroud) 我有类似以下的数据:
[
[0, 4, 15]
[0, 3, 7]
[1, 5, 9]
[2, 4, 15]
]
Run Code Online (Sandbox Code Playgroud)
我用oneHotEncoder http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html#sklearn.preprocessing.OneHotEncoder.fit_transform预处理这个数据,所以它适合线性回归给我这个:
[
[1, 0, 0, 4, 15]
[1, 0, 0, 3, 7]
[0, 1, 0, 5, 9]
[0, 0, 1, 4, 15]
]
Run Code Online (Sandbox Code Playgroud)
但是,我希望将这些数据标准化.
到目前为止,我只是将数据规范化,如下所示:
preprocessing.normalize(data)
Run Code Online (Sandbox Code Playgroud)
但是,这会将所有列(包括类别列)标准化.
我的问题如下:
谢谢!
我有以下文件:
foo.blade.php
<html>
<head>
</head>
<body>
<h1>Foo Template</h1>
@yield('content')
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
bar.blade.php
<h2>Bar Template</h2>
<div class="bar-content">
@yield('bar-content')
</div>
Run Code Online (Sandbox Code Playgroud)
我想创建另一个能够扩展上述模板的文件.例如:
@extends('foo')
@section('content')
<p>Hello World</p>
@extends('bar')
@section('bar-content')
<p>This is in div.bar-content</p>
@endsection
@endsection
Run Code Online (Sandbox Code Playgroud)
给:
<html>
<head>
</head>
<body>
<h1>Foo Template</h1>
<p>Hello World</p>
<h2>Bar Template</h2>
<div class="bar-content">
<p>This is in div.bar-content</p>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
使用CLion时,我发现输出有时会中断.
例如,在运行代码时:
main.cpp中
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 1000; i++) {
printf("%d\n", i);
}
fflush(stdout); // Shouldn't be needed as each line ends with "\n"
return 0;
}
Run Code Online (Sandbox Code Playgroud)
预期产出
预期的输出显然是新线上的每个数字0-999
实际产出
在CLion中多次执行代码后,输出通常会发生变化:
返回码始终为0!
截图
在终端中运行代码(即不在CLion本身)
但是,在使用终端编译和运行代码时,代码会完美地输出数字0-999.
我花了很多时间在这个问题上认为这是我的代码问题和内存问题,直到我终于意识到这只是CLion的一个问题.
操作系统:Ubuntu 14.04 LTS
版本:2016.1
构建:#CL-145.258
更新
一个合适的解决方法是在调试模式下运行代码(感谢@olaf).
有没有办法只使用终端在Ubuntu中重新加载谷歌浏览器选项卡.我不想只是打开一个新窗口,而是要实际刷新一个标签!
额外的问题: 这在其他浏览器中是否可行,例如Opera,Safari,Firefox.
我有以下代码:
foo :: Int -> IO ()
foo n = do
x <- bar 6
print "foo running..."
print x
bar :: Int -> IO Int
bar n = do
print "bar running..."
return (n*2)
Run Code Online (Sandbox Code Playgroud)
现在我想将"x < - bar 6"部分放在where子句中,如下所示:
foo :: Int -> IO ()
foo n = do
print "foo running..."
print x
where
x <- bar 6
bar :: Int -> IO Int
bar n = do
print "bar running..."
return (n*2)
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?
如何检测Angular 2上的任何按键(例如,不一定在输入框中)
目前我设法使用以下代码执行此操作:
import {Component, HostListener} from "@angular/core";
@Component(<any>{
selector: 'foo',
template: `<h1>Foo</h1>`,
})
export class FooComponent {
@HostListener('document:keypress', ['$event'])
keypress(e: KeyboardEvent) {
console.log("Key Up! " + e.key);
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码设法适用于大多数字符,例如字母数字,标点符号,符号等
问题是当按下SHIFT,CTRL,F1 ... F12,Tab,ALT等键时,此方法不会运行.
我想要一个自定义500错误页面.这可以通过创建视图来完成errors/500.blade.php.
这对于生产模式来说很好,但是在调试模式下我看不到默认的异常/调试页面(看起来是灰色的并且说"哎呀出错了").
因此,我的问题是:如何生成自定义500错误页面,但是当调试模式为真时,原始500错误页面?