小编Max*_*asy的帖子

在git中,有没有办法在不应用存储的情况下显示未跟踪的存储文件?

如果我运行git stash -u,我可以存储未跟踪的文件.但是,所说的未跟踪文件根本没有出现git stash show stash@{0}.有没有办法在不应用存储的情况下显示未跟踪的存储文件?

git git-stash

87
推荐指数
6
解决办法
1万
查看次数

如何使用AngularJS渲染动态定义列表?

如何使用AngularJS渲染动态定义列表?

例:

数据:

[
    {
        key: 'a',
        value: 'x'
    }, {
        key: 'b',
        value: 'y'
    }
]
Run Code Online (Sandbox Code Playgroud)

期望的HTML:

<dl>
    <dt>a</dt>
    <dd>x</dd>
    <dt>b</dt>
    <dd>y</dd>
</dl>
Run Code Online (Sandbox Code Playgroud)

http://docs.angularjs.org/tutorial/step_08上的示例:

<dl>
    <dt>Availability</dt>
    <dd ng-repeat="availability in phone.availability">{{availability}}</dd>
</dl>
Run Code Online (Sandbox Code Playgroud)

适用于动态数量的dds和静态dts数,但不是两者的动态数.

angularjs

71
推荐指数
3
解决办法
1万
查看次数

有没有办法更改Jenkins Maven构建的工作目录?

有没有办法更改Jenkins Maven构建的工作目录?

用例

有一个Maven构建只有在当前工作目录是包含pom.xml的目录时才能工作,所以我希望Maven构建在该目录中执行.

包含pom.xml的目录位于git项目的子目录中.

jenkins

28
推荐指数
4
解决办法
5万
查看次数

我可以制作一个Maven配置文件将webResources添加到战争中并仍添加非配置文件的webResources吗?

例:

我希望并期望以下pom在"profile"配置文件处于活动状态时部署profileResources和commonResources,但它只部署profileResources.我能做些什么来达到预期的效果?

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>test</artifactId>
  <packaging>war</packaging>
  <version>0.0.0</version>
  <profiles>
    <profile>
      <id>profile</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
              <webResources>
                <resource>
                  <directory>src/main/profileResources</directory>
                </resource>
              </webResources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
          <webResources>
            <resource>
              <directory>src/main/commonResources</directory>
            </resource>
          </webResources>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>test</artifactId>
  <packaging>war</packaging>
  <version>0.0.0</version>
  <profiles>
    <profile>
      <id>profile</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
              <webResources>
                <resource>
                  <directory>src/main/profileResources</directory>
                </resource>
              </webResources>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <build> …
Run Code Online (Sandbox Code Playgroud)

maven maven-war-plugin

9
推荐指数
1
解决办法
4541
查看次数

Spring的@Cacheable注释是否与注释方法的bean具有相同的范围?

是否有一种简单的方法可以将Spring的@Cacheable注释与非单例(例如会话范围的)bean一起使用,并且缓存与所述bean具有相同的范围?

例:

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Scope;
import org.springframework.security.core.context.SecurityContextHolder;

@Named
@Scope("session")
public class UserNameRetriever {

    @Inject private UserDao userDao;

    @Cacheable("userName")
    public String getUserName() {
        return userDao.getUserByLogin((String)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getName();
    }

}
Run Code Online (Sandbox Code Playgroud)

理想情况下,UserNameRetriever.getUserName()会从UserDao每个会话中获取一次用户名,但此代码实际上会缓存应用程序范围内的用户名.

java spring

7
推荐指数
2
解决办法
7945
查看次数

AJAX load 和history.pushState 的建议顺序是什么?

例如,在 jQuery 中,设置一个链接以将某些内容加载到某个区域中,我应该在调用 History.pushState 之前加载内容吗?

$('#link').click(function () {
    $('#region').load('regionContent', function () {
        history.pushState(null, null, 'newUrl');
    });
    return false;
});
Run Code Online (Sandbox Code Playgroud)

或者我应该在调用history.pushState后加载内容?

$('#link').click(function () {
    history.pushState(null, null, 'newUrl');
    $('#region').load('regionContent');
    return false;
});
Run Code Online (Sandbox Code Playgroud)

前者对我来说似乎更可取,因为我觉得在内容改变之前 URL 不应该改变,但我更经常看到后者(例如https://github.com/blog/760-the-tree-slider) ,所以我想知道哪一个被认为是最佳实践。

javascript browser-history

4
推荐指数
1
解决办法
1058
查看次数

如何为此tar命令构建Ant TarTask?

tar zcvf Test.tar.gz/var/trac/test/var/svn/test

到目前为止,我有:

<target name="archive" depends="init">
    <tar compression="gzip" destfile="test.tar.gz">
        <tarfileset dir="/">
            <include name="/var/trac/test" />
        </tarfileset>
        <tarfileset dir="/">
            <include name="/var/trac/svn" />
        </tarfileset>
    </tar>
</target>
Run Code Online (Sandbox Code Playgroud)

通过调试,它始终显示"找不到任何来源",所以我对下一步该做什么感到有点困惑.

ant tar

2
推荐指数
1
解决办法
7528
查看次数