我正在阅读有关部分和细分的内容.似乎您可以列出部分和段之间的映射,如下所示.
$ readelf -l test
Elf file type is EXEC (Executable file)
Entry point 0x8048330
There are 9 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4
INTERP 0x000154 0x08048154 0x08048154 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x08048000 0x08048000 0x0065c 0x0065c R E 0x1000
LOAD 0x000f14 0x08049f14 0x08049f14 0x00104 0x00110 RW 0x1000
DYNAMIC 0x000f28 0x08049f28 0x08049f28 0x000c8 0x000c8 RW 0x4 …Run Code Online (Sandbox Code Playgroud) 我无法识别stat抛出的错误.以下程序读取目录中的所有文件并打印文件名:
DIR *dp;
struct dirent *dirp;
struct stat sb;
if((dp = opendir(argv[1]))==NULL)
{
perror("can't open dir");
}
while((dirp = readdir(dp))!=NULL)
{
if (stat(dirp->d_name, &sb) == -1) {
perror("stat");
}
printf("File name: %s \n",dirp->d_name);
}
Run Code Online (Sandbox Code Playgroud)
样本输出:
/home/eipe
stat error: No such file or directory
File name: copyofsample
File name: a.out
File name: .
stat error: No such file or directory
File name: udpclient.c
File name: ..
stat error: No such file or directory
File name: client.c
stat error: No such file …Run Code Online (Sandbox Code Playgroud) 我在shell中读到,true命令返回0 =>逻辑真.false命令返回1 =>逻辑错误.但是当我跑步时,我得到了惊人的结果.
if [ 0 ]
then
echo "0 is true."
else
echo "0 is false."
fi
if [ 1 ]
then
echo "1 is true."
else
echo "1 is false."
fi
if [ false ]
then
echo "false is true."
else
echo "false is false."
fi
if [ true ]
then
echo "true is true."
else
echo "true is false."
fi
Run Code Online (Sandbox Code Playgroud)
我得到了这些结果.
0是真的.1是真的.错是真的.的确如此.
我做到了
a=1234
let "a=a+1"
Run Code Online (Sandbox Code Playgroud)
在命令行上,它很好.但是当我在shell脚本中执行相同操作时.它打印出一个"让:未找到"的错误.这是脚本文件.
#!/bin/sh
a=1234;
let "a=a+1";
echo "$a";
Run Code Online (Sandbox Code Playgroud)
谢谢,
作为javascript的初学者,我试图从这里了解Object.create()方法
https://developer-new.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create
在示例代码中,第18行.创建一个accessable属性,其writeable设置为true.我还读到可写只适用于数据描述符.
试过跑,
var o = Object.create(Object.prototype, {
// foo is a regular "value property"
foo: {
writable:true, configurable:true, value: "hello"
},
// bar is a getter-and-setter (accessor) property
bar: {
writable: true,
configurable: false,
get: function() { return 10 },
set: function(value) { console.log("Setting `o.bar` to", value) }
}
});
console.log(o);
Run Code Online (Sandbox Code Playgroud)
我得到invalid property error.
什么时候应该使用像这样的通用多态类型,它的含义是什么?
1. List<? super Dog> list = new ArrayList<Animal>();
2. List<? extends Animal> list = new ArrayList<Dog>();
3. List<?> list = new ArrayList<Dog>();
Run Code Online (Sandbox Code Playgroud)
有人会用这样的东西
List<? super Dog> list = new ArrayList<Dog>();
List<? extends Animal> list = new ArrayList<Animal>();
Run Code Online (Sandbox Code Playgroud)
注意:我理解人们何时使用List<? super Dog>或List<? extends Animal>在方法定义中.但我不明白的是多态泛型类型对象创建.
我的第一个问题 - 是否可以在不使用数字证书的情况下使用https?我的第二个问题 - 我在我的网络应用程序中保护了几页.所以添加了以下内容
<security-constraint>
<web-resource-collection>
......
</web-resource-collection>
<auth-constraint>
......
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)
我尝试运行应用程序,并且没有加载ssl的页面.所以我继续创建证书.在server.xml中添加了以下内容?
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150"
scheme="https"
secure="true"
keystoreFile="C:\Program Files\apache-tomcat-7.0.11-windows-x86\apache-tomcat-7.0.11\.keystore"
keystorePass="johneipe"
clientAuth="optional"
sslProtocol="TLS" />
Run Code Online (Sandbox Code Playgroud)
我仍然无法访问这些页面,也无法访问https:// localhost:8443.
是否可以在不修改基类和派生类的情况下调用基类函数?
class Employee {
public String getName() {
return "Employee";
}
public int getSalary() {
return 5000;
}
}
class Manager extends Employee {
public int getBonus() {
return 1000;
}
public int getSalary() {
return 6000;
}
}
class Test {
public static void main(String[] args) {
Employee em = new Manager();
System.out.println(em.getName());
// System.out.println(em.getBonus());
System.out.println(((Manager) em).getBonus());
System.out.println(em.getSalary());
}
}
Run Code Online (Sandbox Code Playgroud)
输出:员工1000 6000
如何在em对象上调用Employee的getSalary()方法?
list和islice对象都是可迭代的,但为什么会产生这种差异.
r = [1, 2, 3, 4]
i1, i2 = tee(r)
print [e for e in r if e < 3]
print [e for e in i2]
#[1, 2]
#[1, 2, 3, 4]
r = islice(count(), 1, 5)
i1, i2 = tee(r)
print [e for e in r if e < 3]
print [e for e in i2]
#[1, 2]
#[]
Run Code Online (Sandbox Code Playgroud) 似乎没有一种特定的标准方法可以让我在网上找到@DataJpaTest可以正确运行的方法。
@DataJpaTest现在没有使用并且所有测试都使用在服务或控制器级别运行是真的@SpringBootTest吗?
@Repository
public interface MyBeanRepository extends JpaRepository<MyBean, Long> {
}
@Configuration
@EnableJpaRepositories("com.app.repository.*")
@ComponentScan(basePackages = { "com.app.repository.*" })
public class ConfigurationRepository {
}
@Entity
public class MyBean {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@Version
@Column(name = "version")
private Integer version;
@NotNull
@Size(min = 2)
private String name;
}
@DataJpaTest
public class MyBeanIntegrationTest {
@Autowired
MyBeanRepository myBeanRepository;
@Test
public void testMarkerMethod() {
}
@Test
public void testCount() {
Assertions.assertNotNull(myBeanRepository , "Data …Run Code Online (Sandbox Code Playgroud) java ×3
unix ×3
c ×2
shell ×2
generics ×1
gradle ×1
https ×1
inheritance ×1
java-ee ×1
javascript ×1
junit5 ×1
linux ×1
mozilla ×1
polymorphism ×1
python ×1
segments ×1
spring-boot ×1
ssl ×1
stat ×1
tomcat ×1