小编cb4*_*cb4的帖子

在pycharm中使用jupyter笔记本-没有这样的笔记本目录

我正在尝试使用PyCharm 2016.1中的jupyter笔记本。我打开一个先前创建的iPython笔记本,单击包含代码的单元格,然后运行它。我被提示在默认URL下启动jupyter notebook,然后单击“确定”。以下是“运行”窗口中的错误消息:

[C 13:04:23.979 NotebookApp] Bad config encountered during initialization:
The Jupyter HTML Notebook.
[C 13:04:23.979 NotebookApp] No such notebook dir: 'C:\\Users\\cb4\\Documents\\python'
Run Code Online (Sandbox Code Playgroud)

使用默认网址在PyCharm中启用了iPython Notebook。

pycharm jupyter-notebook

6
推荐指数
2
解决办法
4093
查看次数

JENKINS:当我尝试对特定 Maven 项目使用较旧的 JDK 时出现错误

我在 CentOS Linux 版本 7.3.1611 服务器上使用 Jenkins 版本 2.73-1.1。

服务器上有3个不同版本的JDK:

[root @ jenkins java] # ll
total 12
lrwxrwxrwx. 1 root root 16 27 Apr 16.25 default -> / usr / java / latest
drwxr-xr-x. 8 root root 4096 27 Mar 2013 jdk1.6.0_45
drwxr-xr-x. Root root 4096 11 Apr 2015 jdk1.7.0_80
drwxr-xr-x. 9 root root 4096 27 Apr 16.25 jdk1.8.0_131
lrwxrwxrwx. 1 root root 22 27 apr 16.25 latest -> /usr/java/jdk1.8.0_131
Run Code Online (Sandbox Code Playgroud)

如下图所示,Jenkins使用的是jdk1.8.0_131版本,在我的项目中我指定使用JDK7。

Jenkins 设置图 1

Jenkins 设置图 2

当我尝试编译我的项目 ( …

java-7 jenkins maven-toolchains-plugin

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

Eclipse:如何将Web项目转换为AspectJ项目并使用AJDT插件进行编织和运行?

我想做的事:

  • 我想在 Spring 中使用 @Configured 注释。它需要启用 AspectJ。我认为使用 AJDT 插件进行编译时编织可以解决这个问题。在安装插件之前,应该注入我的 @Configured 对象的依赖项仍然为空。

我做了什么:

  • 为 Eclipse 3.4安装了AJDT:AspectJ 开发工具插件。
  • 右键单击我的 web 项目并将其转换为 AspectJ 项目。
  • 启用编译时编织。

什么不起作用:

  • 当我现在启动 Tomcat 6 服务器时,出现异常*。

其他信息:

  • 我没有在项目属性的 AspectJ Build 和 AspectJ Compiler 部分配置任何东西。
  • 首选项下的 JDT Weaving 表示启用了编织。
  • 我仍然在项目属性下有 Java 构建路径和 Java 编译器。它们看起来像我之前配置过的(虽然上面两个新条目没有配置)。
  • 我的@Configured 对象文件的图标看起来像任何其他文件(即没有任何方面的指示,我认为应该有)。文件名是 MailNotification.java(而不是 .aj),但我想它应该仍然有效,因为我正在为 AspectJ 使用 Spring 注释?
  • 我还没有找到任何教程或类似的教程:如何将 Spring Web 应用程序项目转换为 AspectJ 项目并使用 AJDT 插件将方面编织到文件中,所有这些都在 Eclipse 3.4 中。如果那里有类似的东西,我会非常有兴趣了解它。

我想知道的是:

  • 然后去哪儿?我只想使用Spring的@Configured注解。我也在使用 @Transactional,我认为它也需要 AspectJ。
  • 如果可能的话,只要满足我的需求,我想尽可能少地学习 AspectJ。这个主题看起来很有趣,但是很庞大,我想做的就是使用上面提到的两个 Spring 注释。

*** Tomcat 6 启动时的异常:

Caused by: java.lang.IllegalStateException: …
Run Code Online (Sandbox Code Playgroud)

java eclipse spring spring-aop

5
推荐指数
1
解决办法
4478
查看次数

Spring AOP:将目标传递给Aspect

我想捕获实现Processor接口的类抛出的异常.在方面我需要访问处理器,它会抛出异常.我定义了以下切入点:

@Pointcut("target(some.package.Processor) && args(message)")
  public void processor(Message message) {
}
Run Code Online (Sandbox Code Playgroud)

方面:

@AfterThrowing(pointcut="processor(message)", throwing="ex")
public void onExceptionInProcessor(Processor target, Exception ex, Message message) {
  // code skipped
}
Run Code Online (Sandbox Code Playgroud)

但是,我得到以下异常:

Caused by: java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut 
    at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301) ~[aspectjweaver-1.6.12.jar:1.6.12]
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:193) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:182) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:163) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:209) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:263) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:295) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322) ~[spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407) …
Run Code Online (Sandbox Code Playgroud)

aop spring spring-aop

5
推荐指数
1
解决办法
3806
查看次数

便宜的Android 7'平板电脑(800x480):宽高比错误,圆圈看起来像省略号

我需要很多Android平板电脑才能通过我的应用程序进行转售.我从网上买了一些(便宜的中国产品),但所有7'800x480平板电脑都显示为椭圆形(正方形为矩形),所有东西都被拉伸......

有些是Android 2.3.3,有些是Android 4.0,但所有这些都显示了拉伸的UI.

有人遇到过同样的问题吗?

geometry android ellipsis aspect-ratio

5
推荐指数
1
解决办法
8189
查看次数

通过保持不同屏幕分辨率的宽高比来计算图像大小

我试图通过保持纵横比来调整图像大小.它应该足够大,可以填充屏幕,没有空白区域,如果需要,一些图像应该在屏幕外.

下图显示了如何根据黑屏尺寸调整黄色图像的大小.

在此输入图像描述

这是我实际使用的代码,有没有更好的方法来做到这一点?

if(bwidth > bheight) {
    if(bwidth > swidth && bheight > sheight) {
        new_height = sheight;
        new_width = (int) ((double) (bwidth/100)*(sheight/((double) (bheight)/100)));

    } else if(bwidth > swidth && bheight < sheight) {
        new_height = sheight;
        new_width = (int) ((double) (bwidth/100)*(sheight/((double) (bheight)/100)));

    } else if(bwidth < swidth && bheight < sheight) {
        new_height = sheight;
        new_width = (int) ((double) (bwidth/100)*(sheight/((double) (bheight)/100)));

    } else if(bwidth < swidth && bheight > sheight) {
        new_height = sheight;
        new_width = (int) ((double) (bwidth/100)*(sheight/((double) …
Run Code Online (Sandbox Code Playgroud)

java image aspect-ratio

5
推荐指数
2
解决办法
4476
查看次数

如何配置aspectj以进行编译后的编织(使用maven)?

如何配置AspectJ以获得编译后的编织?我只是在下面的插件中将“ compile”替换为“ post-compile” :(不必说这是不成功的)

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.5</version>
    <configuration>
        <complianceLevel>1.6</complianceLevel>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>post-compile</goal>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

但我错过了一些东西,因为它给出了以下错误:

'post-compile' was specified in an execution, but not found in the plugin
Run Code Online (Sandbox Code Playgroud)

configuration aspectj compile-time-weaving pom.xml maven

5
推荐指数
1
解决办法
2509
查看次数

为什么我不能在嵌入式tomcat的spring boot web中获得@EnableLoadTimeWeaving

我正在编写一个打包为可执行jar文件的spring boot web应用程序,我需要加载时间AspectJ编织.使用-javaagent对我来说不是一个选项,因为它需要我们的DevOps来更改部署工具链,我现在不想处理它.这是我的主课.

@SpringBootApplication
@EnableLoadTimeWeaving(aspectjWeaving=AspectJWeaving.ENABLED)
public class Application extends SpringBootServletInitializer {
  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }

  @Bean
  public LoadTimeWeaver loadTimeWeaver() {
    return new InstrumentationLoadTimeWeaver();
  }
}
Run Code Online (Sandbox Code Playgroud)

这没用.我认为注入InstrumentationLoadTimeWeaver嵌入式Tomcat 可能效果不佳.我尝试用它替换它TomcatLoadTimeWeaver.但结果是Spring上下文无法加载以下错误消息.

引起:java.lang.IllegalStateException:无法初始化TomcatLoadTimeWeaver,因为Tomcat API类不可用

spring-boot github问题上的这个错误得出结论,当前AspectJ加载时编织不能与嵌入式tomcat一起使用.我的问题是为什么不可能?我想了解什么是加载时间编织机制,这使得无法在可执行的Spring启动Web jar中工作.

spring tomcat spring-aop load-time-weaving spring-boot

5
推荐指数
0
解决办法
1595
查看次数

如何为扩展特定类的所有类指定单个切入点

我有来自不同包的多个类,它们扩展了一个类 Super。我想创建一个 AOP 切入点来匹配所有扩展 Super 的类中的所有方法。我试过这个:

@Around("within(com.mypackage.that.contains.super..*)")
public void aroundAllEndPoints(ProceedingJoinPoint joinPoint) throws Throwable {
        LOGGER.info("before Proceed ");
        joinPoint.proceed();
        LOGGER.info("after Proceed");
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用。有什么建议?

java spring-aop pointcut

5
推荐指数
1
解决办法
3428
查看次数

如何使用 git rebase -i 进行压缩

我对变基有点陌生,而且之前肯定没有压缩过提交。

当签出到我的本地分支“whatever”时,我会执行 git add 和 git commit,然后进行 rebase。

我想这是变基的正确方法或至少是一种方法:

git rebase -i development
Run Code Online (Sandbox Code Playgroud)

development 是我们的主线分支,我们在此基础上重新调整我们的提交。当我执行该命令时,我得到: 在此输入图像描述

我必须向下滚动才能看到我刚刚尝试在开发分支顶部重新建立基础的最新提交:在此输入图像描述

我不知道此时该怎么办。我显然已经提交了更改,然后进行了变基。有挤压命令吗?我要挤压什么?我不想破坏开发分支的整个历史。在rebase之前你会做squash吗?我有点迷失了。

git rebase

5
推荐指数
1
解决办法
6271
查看次数