小编Run*_*odt的帖子

EC2上的Java 8应用程序

我想知道是否有人知道我是否可以在EC2实例上安装Java 8.我的应用程序被打包为带有嵌入式jetty的胖jar,因此仅Java 8运行时就足够了.

我对Linux不太熟悉,我看到他们只在默认的AMI上支持Java 7.是否有一个简单的命令可以运行以更新到Java 8?

java amazon-ec2 amazon-web-services

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

选择嵌入式语言

我正在使用几种不同的算法(代理)创建一个分析一个或多个数据系列的应用程序.我认为这些代理中的每一个都可以作为单独的Python脚本实现,我在我的应用程序中使用Python C API或Boost.Python运行.

我有点担心运行时开销TBH,因为我正在做一些相当重的数据处理,我不想每次模拟都要等几分钟.我通常会制作数十万甚至数百万的迭代,其中我调用外部"代理"; 我是否更好地硬编码应用程序中的所有内容,或者性能下降是否可以容忍?

另外,除了Python之外,还有其他可以使用的解释语言吗?

c++ python perl performance lua

7
推荐指数
3
解决办法
2350
查看次数

如何在web.xml中定义常规/后备错误页面

我的Java Web应用程序当前将某些错误代码映射到错误servlet(实际上是弹簧Web流程,但这应该是除此之外的),通过在web.xml中执行此操作:

<error-page>
    <error-code>500</error-code>
    <location>/spring/error?error=500</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/spring/error?error=404</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)

但是,在某些情况下,服务器仍会崩溃,并为用户提供一些例外的堆栈跟踪转储.(在IBM WebSphere btw上运行).我的问题是; 是否可以定义一个后备错误页面,如果所有其他错误都不匹配将使用该页面?因此,我们保证在任何情况下都不会以堆栈跟踪结束.

java web.xml java-ee spring-webflow

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

WebRTC,捕获屏幕

我目前的问题是,我想找到一种在Android上的webrtc连接期间捕获帧/屏幕截图的方法.我知道这里已经有一些解决方案,但没有一个适合我.

按照我目前的方法,我遵循了这个要点.

问题是它返回一个黑色位图.我会附加我的方法,但它基本上与Gist相同.如果有人有任何想法如何解决这个问题,请提前感谢.

Activity SingleFrameCapturer.BitmapListener gotFrameListener = new 
    SingleFrameCapturer.BitmapListener() {

    @Override
    public void gotBitmap(Bitmap theBitmap) {
        Log.e(TAG, "got bitmap!");

        ImageView imageView = findViewById(R.id.object_preview);
        imageView.setImageBitmap(theBitmap);

        imageView.setVisibility(View.VISIBLE);
            }
        };

        MediaStream stream = contextManager.getStream();
        SingleFrameCapturer.toBitmap(this, stream, gotFrameListener);
    }
}
Run Code Online (Sandbox Code Playgroud)

SingleFrameCapturer

import android.graphics.Bitmap;
import android.util.Base64;
import android.util.Log;
import java.nio.ByteBuffer;

import org.webrtc.VideoTrack;
import org.webrtc.MediaStream;
import org.webrtc.EglBase;
import org.webrtc.RendererCommon;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;

public class SingleFrameCapturer {

    public interface BitmapListener {
        public void gotBitmap(Bitmap theBitmap);
    }

    private static boolean firstTimeOnly = true; …
Run Code Online (Sandbox Code Playgroud)

java android webrtc

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

批处理文件中的国际字符

嘿,我在编写批处理文件时遇到了一些问题,我需要指定一些包含国际字符的文件路径(准确地说是挪威字母“ø”)。

例如,文件名axporteføljedb.vbp(在记事本中看起来很正常)axportef°ljedb.vbp在命令行上变成了,然后系统继续抱怨找不到。

有什么建议?

windows unicode ascii cmd batch-file

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

ActiveX DLL锁定主UI线程

我正在努力从一个来自C#WinForms应用程序的后台线程中的ActiveX DLL(从VB6编译)运行一个函数.

因为VB6 DLL项目包含很多对称为Sheridan Controls(threed32.ocx)的旧库的引用,我很有帮助地通知它"不支持多线程模式",所以我必须将Threading Model选项设置为Single Threaded (而不是Apartment Threaded)在VB6中编译DLL时.因此,即使我在我调用DLL的C#Thread对象上将ApartmentState属性设置为STA,它仍然会阻塞UI线程.

我不确定我的选择是什么.从DLL重构Sheridan控件将是一项繁琐的工作.另一个是接受失败,让DLL在DLL工作时挂起.

我猜我的主要问题是; 有没有人知道我可以(没有太多麻烦)在单独的进程/服务中运行单线程ActiveX DLL,可以从主C#线程异步调用?或者还有其他我不知道的选择吗?

解决:根据用户@mnistic的信息,我找到了解决方案.我不得不将ActiveX DLL重建为ActiveX EXE,它作为进程外组件运行.为了使它工作,我不得不在项目属性中将"Start Mode"设置为"Standalone".我还将VB6类的Instancing参数设置为SingleUse,以确保不跨实例共享全局状态.

更新项目引用后,我能够在C#应用程序的后台线程中调用库中的函数,而不会导致GUI延迟.

c# vb6 dll multithreading activex

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

如何使用mult-catch子句?

class Demo{
public static void main(String args[]){
    int x=3,n=5,d=0;
    int ar[]=new int[3];
    String name="Neno";

    System.out.println("Start main");
    try{
        ar[x]=name.charAt(n)/d; //n=5
    }catch(StringIndexOutOfBoundsException e){
        System.out.println("String index Error");
    }catch(RuntimeException e){
        System.out.println("Any runtime Error");
    }catch(ArrayIndexOutOfBoundsException e){
        System.out.println("Array index Error");
    }catch(ArithmeticException e){
        System.out.println("Arithmetic Error");
    }

    System.out.println("End   main");
}
}
Run Code Online (Sandbox Code Playgroud)

我使用此代码来过滤一些异常,但代码中存在错误.它说删除的追赶条款ArrayIndexOutOfBoundsArithmeticException.是因为错误弹出的catch-clauses的顺序?当我改变这样的顺序时......

class Demo{
public static void main(String args[]){
    int x=3,n=5,d=0;
    int ar[]=new int[3];
    String name="Niroth";

    System.out.println("Start main");
    try{
        ar[x]=name.charAt(n)/d; //n=5
    }catch(StringIndexOutOfBoundsException e){
        System.out.println("String index Error");
    }catch(ArrayIndexOutOfBoundsException e){
        System.out.println("Array index Error");
    }catch(ArithmeticException e){
        System.out.println("Arithmetic …
Run Code Online (Sandbox Code Playgroud)

java exception try-catch

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