小编You*_*sef的帖子

将内联块DIV与容器元素顶部对齐

当两者inline-block div的高度不同时,为什么两者中的较短者不对齐容器的顶部?(演示):

.container { 
    border: 1px black solid;
    width: 320px;
    height: 120px;    
}

.small {
    display: inline-block;
    width: 40%;
    height: 30%;
    border: 1px black solid;
    background: aliceblue;    
}

.big {
    display: inline-block;
    border: 1px black solid;
    width: 40%;
    height: 50%;
    background: beige;    
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
    <div class="small"></div>
    <div class="big"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

如何对齐div容器顶部的小?

css

181
推荐指数
2
解决办法
14万
查看次数

INTERFACES或TARGET_CLASS:我应该选择哪个proxyMode?

我正在寻找一种存储我的对象的方法,似乎最好的方法是使用代理.我在互联网上找到了2个注释,我应该使用哪个注释:

@Scope(value = "session", proxyMode = ScopedProxyMode.INTERFACES)
Run Code Online (Sandbox Code Playgroud)

要么

@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS )
Run Code Online (Sandbox Code Playgroud)

此外,代理是否是使用@Component @Scope("session")或使用的最佳方式@SessionAttributes

spring spring-mvc

31
推荐指数
3
解决办法
2万
查看次数

在Querydsl中生成Qclasses时,Maven构建和JDK的Eclipse问题

当我在下面添加此代码pom.xml以支持Querydsl时

<plugin>
  <groupId>com.mysema.maven</groupId>
  <artifactId>apt-maven-plugin</artifactId>
  <version>1.0.6</version>
  <executions>
    <execution> 
      <goals>
        <goal>process</goal>
      </goals>
      <configuration>
        <outputDirectory>target/generated-sources/java</outputDirectory>
        <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
      </configuration>
    </execution>
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

使用Eclipse构建时出现此错误.我认为它与classpath和JDK jar有关系

You need to run build with JDK or have tools.jar on the classpath.
If this occures during eclipse build make sure you run eclipse under  JDK as well 
(com.mysema.maven:apt-maven-plugin:1.0.6:process:default:generate-sources)
Run Code Online (Sandbox Code Playgroud)

.classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes> …
Run Code Online (Sandbox Code Playgroud)

java eclipse maven querydsl

24
推荐指数
2
解决办法
3万
查看次数

只用纯CSS顺畅滚动

如何使用纯css进行平滑滚动.

我有这个代码小提琴

HTML

<a id="up" href="#down">down</a>
<div class="up"></div>

<a id="down" href="#up">up</a>
<div class="down"></div>
Run Code Online (Sandbox Code Playgroud)

CSS

.up {
    width:100px;
    height: 600px;
    background-color: red;
}

.down {
    width:100px;
    height: 400px;
    background-color: yellow;
}
Run Code Online (Sandbox Code Playgroud)

我知道:target可以提供帮助,但我不知道如何使用它transition.

css

22
推荐指数
2
解决办法
11万
查看次数

捕获重复条目异常

我怎么能抓住这个例外:

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: 
                                      Duplicate entry '22-85' for key 'ID_CONTACT'
Run Code Online (Sandbox Code Playgroud)

java mysql hibernate jpa sqlexception

22
推荐指数
3
解决办法
6万
查看次数

使用身份标识符生成器时,Hibernate禁用插入批处理

Hibernate文档说:

如果您使用身份标识符生成器,​​Hibernate会透明地禁用JDBC级别的插入批处理.

但是我的所有实体都有这样的配置:

@Id
@GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)
private Integer id;
Run Code Online (Sandbox Code Playgroud)

当我在上面使用这个身份时

  1. 有什么问题IDENTITY
  2. 是否禁用批量插入?
  3. 我怎么解决这个问题?

java spring hibernate jpa transactions

21
推荐指数
1
解决办法
8647
查看次数

上传文件停止,并在套接字Exception上读取意外的EOF

有时当我尝试在远程vps上传文件时,我得到此异常(上传进程停止在60%)

06-Jan-2016 11:59:36.801 SEVERE [http-nio-54000-exec-9] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [mvc-dispatcher] in context with path [] threw exception [Request processing failed;
nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request;
nested exception is org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket]
with root cause
 java.io.EOFException: Unexpected EOF read on the socket
Run Code Online (Sandbox Code Playgroud)

并且在Google Chrome连接中丢失了,就像服务器停机一样,我明白了ERR_CONNECTION_ABORTED

我在spring mvc上传这样的文件

public void save_file(MultipartFile upfile , String path){

        try {

            File fichier = new File( path ) ;
            byte[] …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat spring-mvc

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

Mysqldump和表的顺序

我复制我的数据库mysqldump - uroot -p pagesjaunes > E:\db.sql
但是当我尝试mysql pagesjaunes < db.sql在我的家用电脑中执行时我得到了错误,因为mysqldump没有将正确的顺序放在文件中db.sql,没有外键的表必须首先例如.

DROP TABLE IF EXISTS `fonction`;

CREATE TABLE `fonction` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(20) NOT NULL,
  `id_qualite` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fonction_qualite_fk` (`id_qualite`),
  CONSTRAINT `fonction_qualite_fk` FOREIGN KEY (`id_qualite`) REFERENCES `qualite` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `qualite`;
CREATE TABLE `qualite` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nom` varchar(40) NOT NULL,
  PRIMARY KEY (`id`) …
Run Code Online (Sandbox Code Playgroud)

mysql

14
推荐指数
2
解决办法
4514
查看次数

@ExceptionHandler的顺序

@ControllerAdvice用来处理我的所有app异常:

@ControllerAdvice
public class ExceptionHandlingController {

  @ExceptionHandler({UnauthorizedException.class})
  public String unauthorizedException()  {
        .........
  }


  @ExceptionHandler({UnauthorizedAjaxException.class})
  @ResponseBody
  public void unauthorizedAjaxException()  {
        .........
  }

  @ExceptionHandler({Exception.class})
  public String globalException(){
        .........
  }


}
Run Code Online (Sandbox Code Playgroud)

在我的代码中的某个地方,我做到了 throw new UnauthorizedException();

   @Around("@annotation(Authenticated)")
   public Object profilingAuthentication(ProceedingJoinPoint pjp) throws Throwable  {

       HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();

       if( request.getSession().getAttribute("idContact") == null ) {
            if( "XMLHttpRequest".equals(request.getHeader("X-Requested-With")) )
                throw new UnauthorizedAjaxException();
            throw new UnauthorizedException();
       } 
       return pjp.proceed();
   }
Run Code Online (Sandbox Code Playgroud)

但遗憾的是,Spring MVC似乎通过使用最通用的case(Exception)而不是更具体的case(UnauthorizedException例如)来随机行动.有时他会选择正确的!

订单如何运作?并且有什么方法可以指定订单吗?

UnauthorizedException 是一个自定义的例外

public class UnauthorizedException extends Exception …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc

10
推荐指数
1
解决办法
5496
查看次数

运行mysqld时出现问题

我下载mysql-5.7.9-winx64.zip,当我尝试运行时,mysqld我收到此错误:

E:\Softwares\mysql-5.7.9-winx64\bin>mysqld
mysqld: Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually, or turn off
logging for that application.
mysqld: Can't change dir to 'E:\Softwares\mysql-5.7.9-winx64\data\' (Errcode: 2 - No such file or directory)
2015-11-13T10:45:09.715411Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_ti
mestamp server option (see documentation …
Run Code Online (Sandbox Code Playgroud)

mysql

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