小编Rav*_*rma的帖子

Spring 3.1 Hibernate 4继承异常[无法强制转换为org.hibernate.mapping.RootClass]

嗨,我刚刚开始使用Spring,使用Hibernate4和maven.基本上我的类层次结构是从MicroTask扩展的HUmanMicroTask.将来可能会有其他几个类从MicroTask扩展.我试图为每个具体类创建一个表,这是使用spring3和hibernate 4启动和运行的最简单方法.但是当我运行我的代码时.我一直得到以下异常

13:11:52,260 ERROR TestContextManager:324 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6ef137d] to prepare test instance [HumanMicroTaskBaseHibernateTest@52c05d3b]
java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate spring-orm

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

如何在java中编写FLAC文件

我需要在java中编写FLAC文件.之前我将音频输入写入WAV文件,然后使用外部转换器将其转换为FLAC文件

我正在研究JFlac以找到可以通过其编写FLAC文件的任何API.我发现java中的AudioFileFormat.TYPE仅支持以下文件格式 - AIFC,AIFF,SND,AU,WAVE.

我想有一种方法可以从麦克风中捕获音频,并使用Audiosystem.write等API将其写入FLAC文件而不是WAV文件.

请建议可以解决我的问题的方法或API.

java audio wav audio-streaming

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

Hadoop采用伪分布式模式.拒绝连接

PS:请不要将此标记为重复

嗨,

我一直在尝试在伪分布式模式下设置和运行Hadoop.当我运行start-all.sh脚本时,我得到了这个输出:

starting namenode, logging to /home/raveesh/Hadoop/hadoop-0.20.2/bin/../logs/..
localhost: ssh: connect to host localhost port 22: Connection refused
localhost: ssh: connect to host localhost port 22: Connection refused
starting jobtracker, logging to /home/raveesh/Hadoop/hadoop-0.20.2/bin/../logs/..
localhost: ssh: connect to host localhost port 22: Connection refused
raveesh@raveeshL:~/Hadoop/hadoop-0.20.2/bin$ 
Run Code Online (Sandbox Code Playgroud)

这就是我所做的.我使用以下命令安装了open-ssh服务器和客户端:

sudo apt-get install openssh-server openssh-client
Run Code Online (Sandbox Code Playgroud)

我已经启动了ssh服务器

sudo service ssh start
Run Code Online (Sandbox Code Playgroud)

我得到的输出为:

ssh start/running, process 5466
Run Code Online (Sandbox Code Playgroud)

我还运行了以下命令:

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
Run Code Online (Sandbox Code Playgroud)

但是当我运行start-all脚本时,它仍然显示连接被拒绝.我也尝试了这里提到的技巧,但我无法让它工作.我在防火墙后面,我正在使用Ubuntu.有什么东西我错过了吗?

任何帮助都非常感谢.

谢谢.

ssh ubuntu hadoop

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

Hadoop -pseudo分布式模式:输入路径不存在

我是Hadoop的新手..我只是以独立模式运行我的hadoop应用程序.它运作得很好.我现在决定将其移至伪分布式模式.我提到了配置更改.显示我的xml文件的片段:

我的core-site.xml如下所示:

<name>fs.default.name</name>
<value>hdfs://localhost/</value>
</property>
<property>
    <name>hadoop.tmp.dir</name>
    <value>/tmp/hadoop-onur</value>
    <description>A base for other temporary directories.</description>
   </property>
Run Code Online (Sandbox Code Playgroud)

我的hdfs-site.xml是

<property>
<name>dfs.replication</name>
<value>1</value>
</property>
Run Code Online (Sandbox Code Playgroud)

我的mapred.xml是

<property>
<name>mapred.job.tracker</name>
<value>localhost:8021</value>
</property>
Run Code Online (Sandbox Code Playgroud)

我运行了start-dfs.sh和start-mapred.sh的脚本,它开始很好

root@vissu-desktop:/home/vissu/Raveesh/Hadoop# start-dfs.sh 
starting namenode, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-namenode-vissu-desktop.out
localhost: starting datanode, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-datanode-vissu-desktop.out
localhost: starting secondarynamenode, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-secondarynamenode-vissu-desktop.out
root@vissu-desktop:/home/vissu/Raveesh/Hadoop# start-mapred.sh 
starting jobtracker, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-jobtracker-vissu-desktop.out
localhost: starting tasktracker, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-tasktracker-vissu-desktop.out
root@vissu-desktop:/home/vissu/Raveesh/Hadoop# 
Run Code Online (Sandbox Code Playgroud)

现在我试图运行我的应用程序:但得到以下错误.

root@vissu-desktop:/home/vissu/Raveesh/Hadoop/hadoop-0.20.2# hadoop jar ResultAgg_plainjar.jar ProcessInputFile /home/vissu/Raveesh/VotingConfiguration/sample.txt 
ARG 0 obtained = ProcessInputFile
12/07/17 17:43:33 INFO preprocessing.ProcessInputFile: Modified File Name is /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/sample.txt_modf …
Run Code Online (Sandbox Code Playgroud)

java hadoop mapreduce

4
推荐指数
1
解决办法
6426
查看次数

抑制wav文件中的噪音

我正在使用wav文件作为输入进行语音2文本转换的原型.我目前正在试验几个ASR,如Microsoft SAPi,Sphinx等.传递的音频wav文件包含来自背景的几个失真/噪音.我尝试使用大胆来完全消除噪音,识别变得更好了.噪音去除部分,我目前通过提供的Ui进行.我的背景是java,我想用java实现相同的噪声消除部分.我已经下载了Audacity源代码,我想知道哪种方法更好.1)只需尝试对已存在的C++方法进行jni调用.2)使用傅立叶变换实现我自己的噪声门机制.然而在后一种方法中,它更像是重新发明轮子.是否有一个标准的api /算法已经在java中实现,它将接收wav文件输入并通过实现高/低通滤波器或任何其他方法来执行噪声消除.
我试图搜索"带有Java的数字音频"这本书,它似乎包含DSP算法,但它不可用.任何有关采取的方法或apis可用的帮助都会非常有帮助.

java speech-recognition

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

在Java中运行连续批处理

我有一个批处理文件,它执行收听麦克风并将其转换为文本的操作(我正在使用口袋狮身人面像).

我用来运行批处理文件的命令是pocketsphinx_continuous.exe -dict <dict name> -lm <language model> -hmm <acoustic model location>.批处理文件启动并继续监听麦克风.每当我们说完一个句子时,它会在命令提示符下将其转换为文本.由于这种持续运行,我们通过Ctrl- 终止此任务C.

我试图将其变成一个独立的Java应用程序.我想通过Java运行这个批处理文件,所以我使用Runtime.getRuntime().exec("cmd /c start pocketsphinx_continuous.exe ...")了所有参数.但奇怪的是,它在单独的命令提示符中启动批处理,但会立即退出.我尝试使用process.waitfor(),但它只是开始执行批处理然后终止.我没有打电话process.destroy,所以我无法弄清楚为什么它会退出批处理过程.

另一个问题是,由于批处理文件连续运行,在每个口语句子被转录后,我希望在我的Java应用程序中获得输出.我知道我可以将批处理重定向到一个文件然后读取文件,只是想知道是否有更直接的过程.你能不能帮我弄清楚我犯了什么错误.

java sphinx runtime.exec cmusphinx

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

sphinx4中的语音识别响应很差

目前,我们正在研究使用sphinx4进行语音识别.我们正在尝试为听写类型应用程序实现良好的响应.输入是一个wav文件,我们希望转录它.我查看了Sphinx4提供的LatticeDemo和Transcriber演示.当我使用相同的配置时,响应非常差.我试图调整配置文件,但它根本无法识别单词.提供的转录器演示是为数字,我修改了配置文件以理解单词.但我不确定我是否遗漏了一些东西.我已经附加了配置文件.请提出可以进行的任何改进.

<config>        
    <!-- ******************************************************** -->
    <!-- frequently tuned properties                              -->
    <!-- ******************************************************** --> 
    <property name="absoluteBeamWidth"  value="500"/>
    <property name="relativeBeamWidth"  value="1E-60"/>
    <property name="absoluteWordBeamWidth" value="20"/>
    <property name="relativeWordBeamWidth" value="1E-40"/>
    <property name="wordInsertionProbability" value="1E-16"/>
    <property name="languageWeight" value="7.0"/>
    <property name="silenceInsertionProbability" value=".1"/>
    <property name="frontend" value="epFrontEnd"/>
    <property name="recognizer" value="recognizer"/>
    <property name="showCreations" value="false"/>


    <!-- ******************************************************** -->
    <!-- word recognizer configuration                            -->
    <!-- ******************************************************** --> 

    <component name="recognizer" 
                          type="edu.cmu.sphinx.recognizer.Recognizer">
        <property name="decoder" value="decoder"/>
        <propertylist name="monitors">
            <item>accuracyTracker </item>
            <item>speedTracker </item>
            <item>memoryTracker </item>
            <item>recognizerMonitor </item>
        </propertylist>
    </component>

    <!-- ******************************************************** -->
    <!-- The Decoder   configuration                              --> …
Run Code Online (Sandbox Code Playgroud)

speech-recognition speech-to-text sphinx4 cmusphinx

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

使用 apache spark 进行温度预测

我是 Spark 的新手,刚刚开始认真研究它。
我们正在构建一个平台,在该平台上我们从特定时间戳的站点接收温度数据。因此,数据将作为 csv 发布到 RabbitMQ,例如

WD1,12.3,15-10-12T12:23:45
WD2,12.4,15-10-12T12:24:45
WD1,12.3,15-10-12T12:25:45
WD1,22.3,15-10-12T12:26:45
Run Code Online (Sandbox Code Playgroud)

我们将数据转储到 Cassandra 中,我们想使用 spark 从中构建模型。我们从模型中的目标是找到在短时间内发生的急剧升温。例如,在数据中,1 分钟内温度升高了 10 度。我正在考虑使用线性回归来构建模型。然而,火花线性回归模型似乎只接受双值,在阅读文档后我明白了寻找权重的等式更多的是

y = a1x1+a2x2+a3x3
Run Code Online (Sandbox Code Playgroud)

y = mx+c
Run Code Online (Sandbox Code Playgroud)

所以 spark 可以给出权重和截距值。但我不确定我可以使用这个模型。只是为了满足我的好奇心,我确实尝试用这些数据构建模型。但是所有的预测都是可怕的,我认为数据也是如此。我试图建立一个温度与时间戳的矩阵,但预测非常不正确。

我的问题如下

  1. 我构建模型的方式是完全错误的。如果是这样,我该如何纠正?
  2. 如果不是线性回归模型,是否还有其他模型机制可以表明这种急剧上升?

我的示例代码:

JavaRDD<LabeledPoint> parsedData = cassandraRowsRDD.map(new Function<String, LabeledPoint>() {
            public LabeledPoint call(String line) {
                String[] parts = line.split(",");
                double value = Double.parseDouble(parts[1]);
                System.out.println("Y = " + Double.parseDouble(parts[0]) + " :: TIMESTAMP = " + value);
                return new LabeledPoint(Double.parseDouble(parts[0]), Vectors.dense(value));
            }
        });
        parsedData.cache();

        StandardScaler scaler = new StandardScaler();
        DataFrame dataFrame …
Run Code Online (Sandbox Code Playgroud)

java linear-regression apache-spark

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

vertx内的多线程

我是vert.x的新手.我正在尝试使用vert.x"NetServer"功能.http://vertx.io/core_manual_java.html#writing-tcp-servers-and-clients,它就像一个魅力.

但是,我还读到"一个Verticle实例严格单线程.

如果您创建一个简单的TCP服务器并部署它的单个实例,那么该服务器的所有处理程序总是在同一个事件循环(线程)上执行."

目前,对于我的实现,我想接收TCP字节流,然后触发另一个组件.但这不应该是Verticle的"start"方法中的阻塞调用.那么,在start方法中编写执行程序是一种好的做法吗?或者vertx会自动处理这种情况.

这是一个片段

public class TCPListener extends Verticle {

    public void start(){

        NetServer server = vertx.createNetServer();

        server.connectHandler(new Handler<NetSocket>() {
            public void handle(NetSocket sock) {
                container.logger().info("A client has connected");
                sock.dataHandler(new Handler<Buffer>() {
                    public void handle(Buffer buffer) {
                        container.logger().info("I received " + buffer.length() + " bytes of data");

                        container.logger().info("I received " + new String(buffer.getBytes()));
                        //Trigger another component here. SHould be done in a sperate thread. 
                        //The previous call should be returned . No need to wait for component …
Run Code Online (Sandbox Code Playgroud)

java tcp vert.x

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