使用标签的任何一个data-src或src属性有什么区别和后果(好的和坏的)img?我可以同时使用两者获得相同的结果吗?如果是这样,何时应该使用它们?
默认情况下,ubuntu附带openjdk.我从sun安装了jdk,并删除了openjdk,但是使用openjdk我必须删除maven2.如何在不安装openjdk的情况下重新安装?
~$ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) Server VM (build 22.1-b02, mixed mode)
~$ sudo apt-get install maven2
(...)
The following extra packages will be installed:
(...)
openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless
openjdk-6-jre-lib
(...)
The following NEW packages will be installed:
(...)
openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless
openjdk-6-jre-lib
Run Code Online (Sandbox Code Playgroud)
任何帮助表示感谢,我已经google了很多,我没有找到任何解决方案:/
我已经阅读过,以避免循环依赖,我可以@Autowired在setter而不是构造函数上使用.
如果是这样,为什么会失败?
@Component
private static class A {
@Autowired
public A(B b) {
}
}
@Component
private static class B {
private A a;
public B() {
}
@Autowired
public void setA(A a) {
this.a = a;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我A类似地定义类B,一切都还可以,但上面的那个应该已经有效了,为什么不呢?我处于无法摆脱A类的构造函数中的依赖的情况.在这种情况下我该怎么办?
编辑:我使用的是Spring 3.2.1.RELEASE
编辑2:我的例外:
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dependencyTest.A' defined in file [/home/adam/workspaces/testproject/target/classes/mypackage/test/DependencyTest$A.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [mypackage.test.DependencyTest$B]: : Error …Run Code Online (Sandbox Code Playgroud) 我试图了解如何构建用于plot_surface的数组(在Axes3d中).我试图建立一个简单的表面来操纵那些数组的数据:
In [106]: x
Out[106]:
array([[0, 0],
[0, 1],
[0, 0]])
In [107]: y
Out[107]:
array([[0, 0],
[1, 1],
[0, 0]])
In [108]: z
Out[108]:
array([[0, 0],
[1, 1],
[2, 2]])
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚它们是如何被解释的 - 例如我的情节中z = 2中没有任何东西.任何人都可以准确地解释哪些值将被用来制作点,哪一个用于行,最后用于表面.
例如,我想建立一个与线点连接的表面:[0,0,0] - > [1,1,1] - > [0,0,2] [0,0,0] - > [1,-1,1] - > [0,0,2]和这些线之间的表面.数组plot_surface看起来应该是什么样的?
我有这样的事情:
if(! -e $filename) {
# do something
}
Run Code Online (Sandbox Code Playgroud)
但我需要改变它,以便它甚至在我的PATH上查找文件.有没有办法在不分析PATH的情况下实现这一目标?
当我在XML文件中包装行时,我当前的格式化太多了.我明白了:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Run Code Online (Sandbox Code Playgroud)
但我想要这个
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Run Code Online (Sandbox Code Playgroud)
我尝试改变继续缩进in Code Style -> Generaland in Code Style -> XML但没有奏效.
假设我有一个包含复杂元素的RepeatingView(例如包含applet).我想用ajax向RepeatingView添加(或删除)一个新元素,但我不想刷新所有元素,因为它会导致applet重新加载,这显然我不想要.
我正在使用wicket 1.4.18
添加到目标只有我想要添加的元素,不起作用,我得到:
Component with id (...) was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update
我已经阅读了这个问题和一些类似的问题,我想知道是否有任何情况我应该在单例模式上使用静态类?
我用rpm -maven-plugin构建了三个包.一个父级和两个需要同一版本父级的插件.一切正常,直到我用XY-SNAPSHOT版本构建它.然后我的rpm版本被截断为XYpart,但值${project.version}仍然是XY-SNAPSHOT.它导致插件需要XY-SNAPSHOT父版本,而我已经安装了XY版本.
我想知道我是否可以在"requires"部分使用"截断"版本或强制插件不截断我的版本......
这是我的配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<id>parent-package</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>parent-package</name>
<mappings>
(...)
</mappings>
</configuration>
</execution>
<execution>
<id>first-plugin</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>first-plugin</name>
<mappings>
(...)
</mappings>
<requires>
<require>parent-package = ${project.version}</require>
</requires>
</configuration>
</execution>
<execution>
<id>second-plugin</id>
<goals>
<goal>rpm</goal>
</goals>
<configuration>
<name>second-plugin</name>
<mappings>
(...)
</mappings>
<requires>
<require>parent-package = ${project.version}</require>
</requires>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我试图迭代HashMap并重写一些元素到另一个地图,但我有以下问题:
@Test
public void test() {
Map<SubClass, String> map = new HashMap<SubClass,String>();
Map<SubClass, String> anotherMap = new HashMap<SubClass,String>();
map.put(new SubClass(), "10");
for(SubClass i : map.keySet()) {
System.out.println(i); // initial (because toString is implemented)
System.out.println(map.get(i)); // 10
// here it's ok...
i.name="another";
System.out.println(i); // another
System.out.println(map.get(i)); // null!
// but here it occurs that map.get(i) returns null!
anotherMap.put(i, map.get(i));
}
for(SubClass i : anotherMap.keySet()) {
System.out.println(i); // another
System.out.println(map.get(i)); // null!
}
}
// SubClass has String name; and …Run Code Online (Sandbox Code Playgroud) 我有一个Set对象,我不想允许在那里存储任何类的多个实例.哪种解决方案最好:
hashCode返回常量并equals返回o != null && o.getClass() == getClass()Set(几乎像第一个选项)我为Arduino设备编写程序,但问题是一般的(我认为).
假设我有以下代码:
char* ClassB::generateUrl()
{
char* someString = (char*) malloc(...);
// something...
return someString;
}
char* ClassA::getMyUrl()
{
ClassB b;
return b.generateUrl();
}
void developerMethod()
{
ClassA a;
char* url = a.getMyUrl();
print(url);
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,使用的开发人员ClassA::getMyUrl必须记住释放为url分配的内存.有没有更方便用户使用的方法呢?
重要提示:由于Arduino板上的内存限制,我不想返回整体ObjectB,只返回它生成的内容.并且因为它可能是长字符串,我不想将它复制到getMyUrl方法中提供的任何缓冲区作为参数.
更新:
我一定不够清楚:).我想要实现的目标:
ClassB b内存ClassA a也没有 char* url内存,没有释放.我知道在这里使用malloc是错误的,这就是为什么我问这个问题,可能摆脱malloc并且"自动"(至少从开发人员写的角度来看developerMethod)内存管理.
我想这可能很难/不可能实现,但即使这是不可能的,只要让我知道,我会接受这样的答案(如果有人在几天内确认或没有其他答案).