小编rcr*_*ick的帖子

如何验证ssl证书?

安全验证ssl证书所需的一系列步骤是什么?我(非常有限)的理解是,当您访问https站点时,服务器将证书发送到客户端(浏览器),浏览器从该证书获取证书的颁发者信息,然后使用它来联系发布者,并以某种方式比较有效性证书.

  • 究竟是怎么做到的?
  • 该过程如何使其免受中间人攻击?
  • 是什么阻止了一些随机的人建立自己的验证服务以用于中间人攻击,所以一切"看起来"安全?

security algorithm ssl certificate

188
推荐指数
6
解决办法
10万
查看次数

使用Pylint和Django

我非常希望将pylint集成到我的python项目的构建过程中,但是我遇到了一个show-stopper:我觉得非常有用的一种错误类型 - : - E1101: *%s %r has no %r member*在使用常见的django字段时会报告错误, 例如:

E1101:125:get_user_tags: Class 'Tag' has no 'objects' member
Run Code Online (Sandbox Code Playgroud)

这是由这段代码引起的:

def get_user_tags(username):
   """
   Gets all the tags that username has used.

   Returns a query set.
   """
   return Tag.objects.filter(  ## This line triggers the error.
       tagownership__users__username__exact=username).distinct()

# Here is the Tag class, models.Model is provided by Django:
class Tag(models.Model):
   """
   Model for user-defined strings that help categorize Events on
   on a per-user basis.
   """
   name = models.CharField(max_length=500, null=False, …
Run Code Online (Sandbox Code Playgroud)

python django static-analysis pylint

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

Maven可以收集项目的所有依赖JAR以帮助进行应用程序部署吗?

我刚开始使用Maven,(真的评估它)我需要能够为我的应用程序快速生成一个JAR文件和一个包含所有依赖项的目录(例如,lib),以便我可以部署这两个以独立的方式运行.使用正确的清单生成JAR文件很简单,但我不知道如何让Maven将当前项目的依赖项复制到lib我可以部署的目录中.

由于这是针对独立的Java应用程序,我对部署到Maven存储库感兴趣,这也是相当简单的,或者至少很容易googleable.

我已经找到了除了将依赖的JAR文件复制到某个指定目录之外的所有操作.这是我正在寻找的工作流程:

$ mvn clean
$ mvn package
$ cp -r target/{lib,myApp.jar} installLocation
Run Code Online (Sandbox Code Playgroud)

然后,运行myApp.jarinstallLocation一个JAR文件应该"只是工作"无论我的$CLASSPATH.

尝试抢先一些答案:

  • 我有一个Main-class:set,它工作正常.
  • 我还在MANIFEST.MF中设置了类路径,这也很好用.
  • 我已经找到了如何使用<classpathPrefix><classpathMavenRepositoryLayout>完成这项工作 - 但仅限于我的机器.(通过:<classpathPrefix>${settings.localRepository}</classpathPrefix>)

java deployment maven-2 desktop-application

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

如何在任意Java应用程序中启用抗锯齿?

尽管Swing能够提供抗锯齿功能,但许多Java应用程序默认情况下不使用抗锯齿字体.如何强制使用任意java应用程序来使用AA字体?(对于我正在运行的应用程序和我正在开发的应用程序)

java antialiasing

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

大型django项目的项目设计/ FS布局

布局大型django项目的最佳方法是什么?这些教程提供了有关设置应用程序,模型和视图的简单说明,但是关于应如何细分应用程序和项目的信息较少,在典型项目中应用程序之间允许/必要共享的数量较少(显然这在很大程度上取决于项目)以及应保留一般模板的方式/位置.

有没有人有关于为什么某个项目布局比另一个更好的例子,建议和解释?我特别感兴趣的是结合了大量的单元测试(实际代码库大小的2-5倍)和字符串外化/模板.

python django

41
推荐指数
3
解决办法
7663
查看次数

Haskell有ORM工具吗?

使用Haskell与数据库交互的最佳方法是什么?我习惯使用某种ORM(Django的ORM,hibernate等),类似的东西在使用HAppS创建应用程序时会很好.

编辑:就实际数据库而言,我希望可以自由选择Postgresql MySql和SQLite.

database orm haskell

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

使用Junit 4.4或更高版本运行Eclipse Junit插件测试 - 为什么没有检测到测试?

我需要在一组eclipse插件测试中使用JUnit 4.4(或更新版本),但我遇到了以下问题:

使用springsource(junit44junit45)中的junit 4.4或4.5 bundle运行时,未检测到测试.可以使用eclipse获得的org.junit4包提供junit 4.3(从Ganymead/Eclipse 3.4开始).org.junit4包确实可以识别并运行测试,但它与最新版本的JMock不兼容,我需要使用模拟库.

这是一个示例测试:

package testingplugin;

import static org.junit.Assert.*;
import org.junit.Test;

public class ActivatorTest {
   @Test
   public final void testDoaddTest() {
      fail("Not yet implemented");
   }
}
Run Code Online (Sandbox Code Playgroud)

运行此测试时,我收到以下异常:

java.lang.Exception: No runnable methods
    at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:33)
    at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
    at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:574)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:195)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) …
Run Code Online (Sandbox Code Playgroud)

java eclipse junit unit-testing eclipse-pde

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

登录Eclipse/OSGi插件

我开始开发一个Eclipse插件(技术上,一个OSGi插件),我遇到的第一个问题之一就是我似乎无法像往常一样控制commons-logging输出.

我在插件依赖项中包含了commons-logging软件包,实际上,当我记录某些内容时(在INFO或更高的严重级别),它会被记录到控制台.但是,我似乎无法登录任何较低级别(例如DEBUG或TRACE).

我已经指定了一个log4j.properties文件,它位于类路径上(对于运行时,就像commons-logging软件包一样),但该属性文件中的所有设置都不会对记录器的行为产生任何影响.

这是log4j.properties文件:

#  Log4j Logging levels, in order of decreasing importance are:
#   FATAL, ERROR, WARN, INFO, DEBUG, TRACE
#

# Root logger option
log4j.rootLogger=ERROR,stdout
#,LOGFILE

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %r (%l) %t%n - %m%n
Run Code Online (Sandbox Code Playgroud)

我需要做什么才能实际控制记录器的输出?

以下是一些示例输出消息,希望格式化可能与java.util.logging的默认值一致,或者向某人提供其他提示:

Oct 21, 2008 11:01:23 PM com.stottlerhenke.sentinel.client.Activator start
SEVERE: fatal_message
Oct 21, 2008 11:01:23 PM com.stottlerhenke.sentinel.client.Activator start
WARNING: warn_message
Oct 21, 2008 11:01:23 PM com.stottlerhenke.sentinel.client.Activator start
INFO: info_message
Run Code Online (Sandbox Code Playgroud)

更新:

我现在尝试了各种组合:

java eclipse logging osgi

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

了解RDF/OWL的最佳方法是什么?

什么参考文献提供了使用RDF/OWL的好的总结/教程?似乎有足够的工具(Protege,Topbraid,Jena等)知道标记语言的语法是不必要的,但当然,了解这些概念仍然是至关重要的.

我正在研究w3c文档(特别是RDF Primer),但我也想找到其他资源/技术.

rdf semantic-web owl web-standards

20
推荐指数
4
解决办法
7675
查看次数

自动化Eclipse插件开发的单元测试(junit)

我正在开发Eclipse插件,我需要能够为每个插件自动构建和执行测试套件.(使用Junit)

测试是在Eclipse中工作,并按照上述方法我可以打破插件到实际的插件和片段插件单元测试在这里,这里和在几个地方在这里.

但是,上述每种方法都会导致相同的问题:发出构建或应触发测试的java ant task/commandline命令,不会产生可观察到的副作用,并返回值"13".我已经尝试了所有我能找到的东西,并且我已经了解了Eclipse如何启动(例如:从v3.3开始,你不能再使用startup.jar - 它不存在 - 但你应该使用org.eclipse.equinox.launcher).不幸的是,虽然这显然是必要的信息,但远远不够.

我正在使用Eclipse 3.4,Junit 4.3.1(org.junit4包,但我更喜欢使用JUnit 4.4.请看这里.)

所以,我的问题是:你如何自动化Eclipse插件的构建和测试?

编辑:为了澄清,我使用像ant +巡航控制这样的东西,但我甚至无法让单元测试 Eclipse之外运行.我说"类似的东西",因为有其他技术可以实现同样的目标,而且我不会那么挑剔,因为它丢弃了一个解决方案,只是因为它使用了say,Maven或Buckminster,如果这些技术使这变得更容易.

Edit2:上面提到的'Java Result 13'似乎是由于无法找到coretestrunner造成的.从日志中:

java.lang.RuntimeException: Application "org.eclipse.test.coretestapplication" could not be found in the registry. The applications available are: org.eclipse.equinox.app.error, com.rcpquickstart.helloworld.application.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
    at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1212) …
Run Code Online (Sandbox Code Playgroud)

java testing junit eclipse-pde eclipse-3.4

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