小编opi*_*ike的帖子

eslint:error解析错误:保留关键字"const"

我从ESLint收到此错误:

error  Parsing error: The keyword 'const' is reserved
Run Code Online (Sandbox Code Playgroud)

从这段代码:

const express = require('express');
const app = express();
const _ = require('underscore');
Run Code Online (Sandbox Code Playgroud)

我已经尝试删除node_modules并重新安装所有npm软件包(如此处所示),但无济于事.

javascript node.js ecmascript-6 eslint

161
推荐指数
6
解决办法
7万
查看次数

Java Spring:错误消息"无法为元素'util:constant'找到声明

我正在尝试使用util-constant for ioc但是我收到以下错误消息:

cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:constant'.

所有的spring 3.1.1 dist jar都在我的类路径中,我能够在进行包含使用util:constant标记的更改之前成功运行我的程序.

这是我的ioc xml文件:


<beans xmlns="http://www.springframework.org/schema/beans" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:util="http://www.springframework.org/schema/util"
 xmlns:tool="http://www.springframework.org/schema/tool"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">


<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <value>classpath:config.properties</value>
    </property>
</bean>

<bean id="main" class="pikefin.Main">
<property name="executorSample" ref="executorSample"/>
</bean>


<bean id="executorSample" class="pikefin.ExecutorSample">
    <constructor-arg ref="threadPoolExecutor" />

</bean>


<bean id="threadPoolExecutor" class="java.util.concurrent.ThreadPoolExecutor">
    <constructor-arg index="0" value="2"/>
    <constructor-arg index="1" value="2"/>
    <constructor-arg index="2" value="10"/>
    <constructor-arg index="3"><util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/></constructor-arg>
    <constructor-arg index="4" ref="arrayBlockingPool"/>
</bean>

<bean id="arrayBlockingPool" class="java.util.concurrent.ArrayBlockingQueue">
    <constructor-arg value="5"/>
</bean>

</beans>

Run Code Online (Sandbox Code Playgroud)

java spring

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

Ant脚本:让<exec>标记转储整个命令行

我有一个ant构建脚本,它有一个相当复杂的<exec>命令,有许多<arg>标签,我正在尝试进行故障排除.我想知道在构建它之后是否可以查看整个命令行; 要么在eclipse调试器中,要么可以将其转储到文件中.

这是我正在处理的事情:

<exec executable='"@{sdk}/bin/mxmlc.exe"' failonerror="true" >
                <arg line='-load-config "@{sdk}/frameworks/flex-config.xml"'/>

                <!-- Flex Build Path -->
                <!-- Source path -->
                <!-- Main source folder: -->
                <arg line='-compiler.source-path "@{project-dir}/src"'/>
                <!-- Additional source folders outside of the main source folder: -->
                <arg line='-compiler.source-path "@{project-dir}/inc/swf"'/>
                <arg line='-compiler.source-path "@{project-dir}/inc/images"'/>

                <!-- Output folder: -->
                <arg line='-output "@{output}"'/>

                <!-- Library path -->
                <!-- Build path libraries: -->
                <arg line='-compiler.library-path "@{libs}"'/>
                <arg line='-compiler.library-path "@{sdk}/frameworks/libs"'/>
                <arg line='-compiler.library-path "@{sdk}/frameworks/locale/en_US"'/>
                <arg line='-compiler.library-path "${dcradswcs.flex.path}/libs"'/>
                <arg line='-compiler.library-path "${dcradswcs.flex.path}/locale"'/>
                <arg …
Run Code Online (Sandbox Code Playgroud)

java eclipse ant

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

需要有关创建初始JAX-WS项目的帮助

我正在逐步完成本教程:http: //www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html

我正在尝试选择axis2 Web Service方面(步骤6),但我在eclipse中收到此错误消息:"Axis2 Web Services Core 1.1需要动态Web模块,版本匹配表达式为"2.2,2.3,2.4,2.5"

截图

更新:我已经下载并安装了axis2 1.5.4然后在eclipse中我进入了"windows-> preferences-> web services-> axis2 preferences".在"axis2 runtime"选项卡下,我指定了axis2位置.出现"已成功加载Axis2运行时"消息.

sreenshot2

我不知道为什么会说"Axis2 Web Services Core 1.1".eclipse wtp是否与axis2 1.1捆绑在一起,或者是整个轴版本#的轴芯是否有单独的版本#?

java eclipse axis2 web-services

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

使用spring获取错误消息"cvc-elt.1:找不到元素'beans'的声明."

我正在尝试设置一个简单的spring应用程序,我得到以下异常.这是在eclipse indigo中独立运行的.

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Line 2 in XML document from class path resource [context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
Run Code Online (Sandbox Code Playgroud)

这是我的代码的初始部分:

public static void main(String[] args) {

        try {

            BeanFactory beanfactory = new ClassPathXmlApplicationContext(
                    "context.xml");


            FirstBean bean = (FirstBean) beanfactory.getBean("show");
Run Code Online (Sandbox Code Playgroud)

这是我的context.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:aop="http://www.springframework.org/schema/aop"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="anotherBean" …
Run Code Online (Sandbox Code Playgroud)

java eclipse spring

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

试图在tomcat中识别被遗弃连接的来源

我在tomcat(版本7)中使用dbcp连接池,并且我的代码中有某个连接泄漏.在很短的时间之后,对新连接的请求将返回以下异常:

"无法获取连接,池错误超时等待空闲对象"

我回过头来看看我的代码,看起来所有的连接都被正确关闭了(并不是每个人都说这个......).

为了调试这个,我在context.xml中添加了以下属性:

logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="300"
Run Code Online (Sandbox Code Playgroud)

所以资源标签现在看起来像这样:

 <Resource name="jdbc/findata" auth="Container" type="javax.sql.DataSource"
               maxActive="20" maxIdle="5" maxWait="10000"
               username="root" password="xxxxxx" driverClassName="com.mysql.jdbc.Driver"
               logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="300"
               url="jdbc:mysql://localhost:3306/findata"/>
Run Code Online (Sandbox Code Playgroud)

然后我重新启动了tomcat并开始点击网页,直到出现错误消息(在浏览器窗口中).但是我还没有弄清楚"logAbandoned"属性在哪里写信息.我正在寻找

/usr/share/apache-tomcat-7.0.11/logs
Run Code Online (Sandbox Code Playgroud)

但是那里唯一最近修改过的日志文件就是

localhost_access_log.2011-04-18.txt
Run Code Online (Sandbox Code Playgroud)

非常感谢任何帮助.

java tomcat jdbc

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

Mysql中Innodb和Myisam之间的性能差异

我有一个mysql表,其中有超过3000万条记录最初与myisam一起存储.这是表格的描述:

describe_table

我将针对此表运行以下查询,通常需要大约30秒才能完成.我每次都会更改@eid以避免数据库或磁盘缓存.

select count(fact_data.id) 
    from fact_data 
    where fact_data.entity_id=@eid 
        and fact_data.metric_id=1
Run Code Online (Sandbox Code Playgroud)

然后我将此表转换为innoDB而不进行任何其他更改,之后相同的查询现在每次运行查询时返回一秒钟.即使我随机设置@eid以避免缓存,查询也会在一秒钟内返回.

我一直在研究这两种存储类型之间的差异,试图解释性能的显着改善,但却未能提出任何建议.事实上,我读到的大部分内容都表明Myisam应该更快.

我正在运行的查询是针对本地数据库的,在测试时没有其他进程访问数据库.

mysql database myisam innodb

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

java:需要提高校验和计算的性能

我正在使用以下函数来计算文件的校验和:

public static void generateChecksums(String strInputFile, String strCSVFile) {
    ArrayList<String[]> outputList = new ArrayList<String[]>();
    try {
        MessageDigest m = MessageDigest.getInstance("MD5");
        File aFile = new File(strInputFile);
        InputStream is = new FileInputStream(aFile);

        System.out.println(Calendar.getInstance().getTime().toString() + 
                    " Processing Checksum: " + strInputFile);

        double dLength = aFile.length();
        try {
            is = new DigestInputStream(is, m);
            // read stream to EOF as normal...
            int nTmp;
            double dCount = 0;
            String returned_content="";
            while ((nTmp = is.read()) != -1) {
                dCount++;
                if (dCount % 600000000 == 0) {
                    System.out.println(". …
Run Code Online (Sandbox Code Playgroud)

java file-io checksum

7
推荐指数
1
解决办法
1643
查看次数

Eclipse和Java:是否有事件监控功能?

在eclipse中开发java guis(例如swing)时,是否有内置功能(或插件)允许用户监控所有被触发的事件?

java eclipse user-interface swing

7
推荐指数
1
解决办法
715
查看次数

获取消息"类型org.aopalliance.aop.Advice无法解析".在spring java程序中

我正在尝试从此页面设置spring AOP示例:

http://www.javabeat.net/articles/51-introduction-to-springs-aspect-oriented-programminga-4.html

我正在使用Eclipse Indigo作为我的开发环境.

在这些方面:

public class LogAfterThrowsAdvice implements ThrowsAdvice{

public class LogAfterReturningAdvice implements AfterReturningAdvice{ 

public class LogBeforeCallAdvice implements MethodBeforeAdvice {
Run Code Online (Sandbox Code Playgroud)

我收到的消息是:

org.aopalliance.aop.Advice类型无法解析.它是从所需的.class文件间接引用的

我从这里下载了org.aopalliance包:

http://sourceforge.net/projects/aopalliance/

jar文件是aopalliance-alpha1.jar.它不包含路径org.aopalliance.aop.我想知道我是否应该使用不同的aopalliance jar文件?

java eclipse aop spring

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