我正在使用Mac OS X Yosemite,版本10.10.3.
我使用macport安装了python2.7和pip,如http://johnlaudun.org/20150512-installing-and-setting-pip-with-macports/中所做的那样
我可以成功安装包并在我的python环境和python脚本中导入它们.但是,找不到与可以从终端中的命令行调用的包关联的任何可执行文件.
有谁知道什么可能是错的?(更多细节如下)
例如,按照http://wiki.ros.org/jade/Installation/Source中的说明安装名为"rosdep"的软件包时
我可以运行:sudo pip install -U rosdep
安装没有错误,相应的文件位于/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
但是,如果我尝试运行:sudo rosdep init,则会出错:"sudo: rosdep: command not found"
这不是特定于包的错误.我在计算机上使用pip安装的任何软件包都能得到这个.我甚至尝试过添加
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
我的$PATH.但是在命令行中找不到可执行文件,即使这些包在python中完美运行.
我必须使用小网站spring.所以我选择了spring template project然后new spring mvc project我尝试的是发生了一个错误
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'mTime'.Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'mTime'.
Could not calculate build plan: Failed to parse plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1 (C:\Users\User01\.m2\repository\org\apache\maven\plugins\maven-war-plugin\2.1.1\maven-war-plugin-2.1.1.jar): invalid LOC header (bad signature)
Failed to parse plugin descriptor for org.apache.maven.plugins:maven-war-plugin:2.1.1 (C:\Users\User01\.m2\repository\org\apache\maven\plugins\maven-war-plugin\2.1.1\maven-war-plugin-2.1.1.jar): invalid LOC header (bad signature)
Could not calculate build plan: Failed to parse plugin …我正在优化我的代码,我注意到使用属性(甚至是自动属性)会对执行时间产生深远的影响.请参阅以下示例:
[Test]
public void GetterVsField()
{
    PropertyTest propertyTest = new PropertyTest();
    Stopwatch stopwatch = new Stopwatch();
    stopwatch.Start();
    propertyTest.LoopUsingCopy();
    Console.WriteLine("Using copy: " + stopwatch.ElapsedMilliseconds / 1000.0);
    stopwatch.Restart();
    propertyTest.LoopUsingGetter();
    Console.WriteLine("Using getter: " + stopwatch.ElapsedMilliseconds / 1000.0);
    stopwatch.Restart();
    propertyTest.LoopUsingField();
    Console.WriteLine("Using field: " + stopwatch.ElapsedMilliseconds / 1000.0);
}
public class PropertyTest
{
    public PropertyTest()
    {
        NumRepet = 100000000;
        _numRepet = NumRepet;
    }
    int NumRepet { get; set; }
    private int _numRepet;
    public int LoopUsingGetter()
    {
        int dummy = 314;
        for (int i = 0; …我正在使用gevent构建一个应用程序.我的应用程序现在变得相当大,因为有很多工作正在产生和销毁.现在我注意到,当其中一个作业崩溃时,我的整个应用程序只是继续运行(如果异常来自非主要的greenlet),这很好.但问题是我必须查看我的控制台才能看到错误.所以我的应用程序的某些部分可能会"死",我不会立即意识到这一点并且应用程序会继续运行.
用try catch东西抖动我的应用程序似乎不是一个干净的解决方案.也许是一个自定义的spawn函数,它会做一些错误报告?
监控gevent jobs/greenlets的正确方法是什么?抓住异常?
在我的情况下,我会听取几个不同来源的事件,我应该处理每个不同的事件.有5个工作非常重要.webserver greenlet,websocket greenlet,数据库greenlet,alarm greenlet和zmq greenlet.如果任何"死",我的申请应该完全死亡.其他死亡的工作并不重要.例如,由于引发了一些异常,websocket greenlet可能会死亡,其余的应用程序一直运行良好,就像没有发生任何事情一样.它现在完全无用且危险,应该只是崩溃.
我们可以使用不同的查询参数创建相同的GET URI吗?
例如,我有两个REST GET URI:
/questions/ask/?type=rest
/questions/ask/?byUser=john
现在,REST服务没有将两个GET方法识别为单独的,并且只考虑了它被声明为第一个的1个GET方法.
如果您能引用任何资源,我们将非常感激.
我刚安装了Drools plug-inEclipse(版本3.5.2),我正在尝试运行插件附带的"Hello World"示例.
当我运行代码时,我得到runtime error以下堆栈跟踪:
org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
 at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
 at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259)
 at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
 at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:153)
 at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:242)
 at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:142)
 at org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnowledgeBuilder(KnowledgeBuilderProviderImpl.java:29)
 at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
 at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:39)
 at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: java.lang.RuntimeException: **The Eclipse JDT Core jar is not in the classpath**
 at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:94)
 at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
 at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:270)
 ... 9 more
以下是一些相关的Java代码:
public static final void main(String[] args) {
    try {
        // load up the knowledge base
        KnowledgeBase kbase = readKnowledgeBase();
    }
}
private …简而言之
每次我对模块代码进行一些更改时,如何强制 python 解释器加载模块的最新代码版本?
或者至少通过键入重新加载最后修改的版本
>>> from myModule import *
进入控制台,无需重新启动整个 python 控制台并在我进行一些更改时一次又一次地设置所有内容?这对于调试来说是极其不愉快的行为。
--------- 更长的故事 -----------
我尝试删除 .pyc 文件,然后再次导入它 - 但没有效果。它甚至不会再次创建 .pyc 文件 - 所以我希望如果模块已经加载,它会完全忽略我的“导入”命令。
这也没有帮助:
>>> mymodule.myfunc()    # the old version
>>> del myModule         # unload mymodle from python conole / interpeter
...                  # now I removed .pyc
...                  # now I make some modifications in mymodule.myfunc() code   
>>> mymodule.myfunc()    # module is unknonwn, ... OK
>>> import myModule      # try to load modified version
>>> mymodule.myfunc() …我在DAO中创建了一个方法:
public String getUserName(int userid){
    String sql="SELECT userName from UserDetail where userid=?";
    return jdbcTemplate.queryForObject(sql, new Object[]{userid}, String.class);
}
这一行:jdbcTemplate.queryForObject(sql, new Object[]{userid}, String.class)给出以下错误:
The method queryForObject(String, Object[], Class<String>) from the type JdbcTemplate refers to the missing type DataAccessException
Multiple markers at this line
- The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
- The method queryForObject(String, Object[], Class<String>) from the type JdbcTemplate refers to the missing type 
 DataAccessException
我使用spring-jdbc 4.0.0与mysql-connector 5.1.25,commons-dbcp-1.4和commons-pool-1.6.你能告诉我我在做什么吗?
使用名称创建bean时出错
'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Invocation of init method failed; nested exception …我在接受采访时被问到这个问题.
问题:一个二叉树和相应的子树的高度,也给我们的.然后我们必须按顺序在特定位置找到一个元素.
例如:树结构是:D(根节点)[子树大小= 6] - > B,F(D的子节点)[子树大小= 2] - > A,C,E,G(叶子)节点)[subtree-size = 0].
所以共有3个级别:0级:D; 1级:B,F; 等级2:A,C,E,G
我们必须按顺序计算特定顺序/位置的节点,比如p.如果p = 2,那么节点将是B(按顺序遍历).
我的解决方案:我建议我们需要进行一次遍历遍历(通过BFS/DFS),然后我们可以给出第i个顺序节点,时间复杂度为O(n).
现在我被问到可以根据子树大小信息改进解决方案.但我无法想出子树大小可以减少时间复杂度的任何方式.
子树大小信息可以减少时间复杂度吗?如果是,请分享算法/伪代码.
我是Java初学者,并且知道try...catch语句用于处理异常; 表示当try块抛出异常时,catch执行块.所以,我的问题是,当我尝试下面的代码(没有try catch)它抛出一个未报告IOException的read()方法,但当我使用   try catch  它工作正常.
当try块中出现上述异常并exception occured打印时,为什么控件不会转移到catch语句?这是我的代码:
class Test00 {
    public static void main(String args[]) {
        char ch;
        try {
            ch=(char)System.in.read();//here exception is thrown without using try..catch
            System.out.println(ch);
        } catch(Exception e) {
            System.out.print("exception occured");
        }
    }
}
我认为编译器会抛出一个异常,这就是代码与try catch一起工作的原因.但是为什么不执行catch块呢?我得错了.
如何找到丢失的号码?
给定:两个数组作为输入,并找到第一个数组中存在但第二个数组中缺失的数字。
public class Array2 
 {
public void missingnos(int a[],int b[])
{
    for(int i=0;i<a.length;i++)
    {
        for(int j=i+1;j<a.length;j++)
        {
            if(a[i]>a[j])
            {
                int c=a[i];
                a[i]=a[j];
                a[j]=c;
            }
        }
        System.out.print(a[i]);
    }
    for(int i=0;i<b.length;i++)
    {
        for(int j=i+1;j<b.length;j++)
        {
            if(b[i]>b[j])
            {
                int c=b[i];
                b[i]=b[j];
                b[j]=c;
            }
        }
        System.out.print(b[i]);
    }
    int d[]=new int[a.length];
    d=b;
    int missing=0;
    for(int i=0;i<b.length;i++)
    {
        if(a[i]!=d[i])
        {
            missing=a[i];
            break;
        }
    }
    System.out.println();
    System.out.print(missing);
}
public static void main(String[] args) {
    Array2 a2= new  Array2();
    int a[]={1,4,3,5,6};
    int b[]={4,1,5,3};
    a2.missingnos(a,b);
}
} …java ×6
python ×2
.net ×1
algorithm ×1
binary-tree ×1
c# ×1
database ×1
drools ×1
eclipse ×1
eclipselink ×1
exception ×1
gevent ×1
jboss ×1
jpa ×1
junit4 ×1
macos ×1
macports ×1
maven ×1
mysql ×1
optimization ×1
performance ×1
pip ×1
rebuild ×1
rest ×1
resteasy ×1
spring ×1
spring-3 ×1
spring-jdbc ×1
spring-mvc ×1
spyder ×1
struts2 ×1
tree ×1