小编Don*_*d_W的帖子

在使用pax-exam的单元测试中,BundleContext为null

我正在使用pax-exam来加载,激活和访问osgi包.

以下源代码是我的pax-exam测试,它使用pax-exam 2.3使用本机容器运行.

package fr.xlim.ssd.vtg.osgi;

import java.net.URISyntaxException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Inject;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.ExamReactorStrategy;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.Assert.assertNotNull;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.options;

@RunWith(JUnit4TestRunner.class)
@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
public class BasicOSGILoaderTest {

    private Logger logger = LoggerFactory.getLogger(BasicOSGILoaderTest.class);

    @Inject
    private BundleContext bundleContext;

    @Configuration
    public Option[] config() {

    String projectRoot = null;

    try {
       projectRoot = ClassLoader.getSystemResource(".").toURI().toURL().toString();
       projectRoot = projectRoot.toString().substring(0,projectRoot.toString().length() - 27);
       logger.debug("project root: {}", projectRoot);
    } …
Run Code Online (Sandbox Code Playgroud)

java osgi pax pax-exam

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

如何使用MPI发送和接收字符串

我正在尝试使用MPI发送和接收字符串,但结果是无跳的.

发送功能:

MPI_Send(&result, result.size(), MPI_CHAR, 0, 0, MPI_COMM_WORLD);
Run Code Online (Sandbox Code Playgroud)

和recv功能:

    MPI_Recv(&result,      /* message buffer */
        128,                 /* one data item */
        MPI_CHAR,        /* of type char real */
        MPI_ANY_SOURCE,    /* receive from any sender */
        MPI_ANY_TAG,       /* any type of message */
        MPI_COMM_WORLD,    /* default communicator */
        &status);          /* info about the received message */
Run Code Online (Sandbox Code Playgroud)

结果是字符串.

我没有得到任何错误,但程序不想完成.

c c++ mpi

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

如何终止 RDB 或 HDB 中的 KDB 查询?

我们有一个股票行情工厂,有时有人错误地在没有日期的 HDB 中运行查询,或者在没有时间的 RDB 中运行查询,或者使用一些其他处理逻辑,这可能会杀死 KDB。我们如何在不重新启动 KDB 实例的情况下找到并终止查询?

kdb q-lang

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

关于Ping的延迟

ping返回的延迟是什么意思?

即下面的'时间'

C:\Users\guest>ping -n 2 www.google.com

Pinging www.google.com [62.252.60.89] with 32 bytes of data: 
Reply from 62.252.60.89: bytes=32 time=11ms TTL=58 
Reply from 62.252.60.89: bytes=32 time=15ms TTL=58

Ping statistics for 62.252.60.89:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss), 
Approximate round trip times in milli-seconds:
    Minimum = 11ms, Maximum = 15ms, Average = 13ms
Run Code Online (Sandbox Code Playgroud)

networking latency ping

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

Jetty SSL配置Apache karaf

我正在尝试配置jetty以在Apache Karaf OSGI容器中使用SSL.http有效,但https不起作用.可能是什么问题呢?

我的配置详情如下:

等/的jetty.xml

<Call name="addConnector">
    <Arg>
        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host">
                <Property name="jetty.host" />
            </Set>
            <Set name="port">
                <Property name="jetty.port" default="8282" />
            </Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
            <Set name="lowResourcesConnections">20000</Set>
            <Set name="lowResourcesMaxIdleTime">5000</Set>
        </New>
    </Arg>
</Call>
<Call name="addConnector">
 <Arg>
   <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
     <Arg>
       <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
         <Set name="KeyStore">/opt/keystore</Set>
    <Set name="KeyStorePassword">password</Set>
    <Set name="KeyManagerPassword">password</Set>
    <Set name="TrustStore">/opt/keystore</Set>
    <Set name="TrustStorePassword">password</Set>
       </New>
     </Arg>
     <Set name="port">8443</Set>
     <Set name="maxIdleTime">30000</Set>
   </New>
 </Arg>
Run Code Online (Sandbox Code Playgroud)

在/etc/org.ops4j.pax.web.cfg文件中输入

org.ops4j.pax.web.config.file=${karaf.home}/etc/jetty.xml
Run Code Online (Sandbox Code Playgroud)

ssl jetty apache-karaf jetty-8

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

如何在 kdb 中一次添加多个列?

不知何故,我只能找到显示如何添加一列的示例。

所以我编写了这段代码,它可以工作,但我知道有一种更好的方法可以做到这一点:表 t 已经存在,其中列填充了数据,我需要添加最初为空的新列。

 t: update column1:` from t;
 t: update column2:` from t;
 t: update column3:` from t;
 t: update column4:` from t;
Run Code Online (Sandbox Code Playgroud)

我尝试将其设为一个函数:

 colNames:`column1`column2`column3`column4;
 t:{update x:` from t}each colNamesList;
Run Code Online (Sandbox Code Playgroud)

但这只添加了一列并将其称为x。

任何改进此代码的建议将不胜感激。我必须添加的不仅仅是 4 列,因此我的代码很长。谢谢你!

kdb q-lang

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

在FusedLocation中接收模拟位置

我设置了模拟位置,但是在启用模拟模式时我无法接收任何位置,通常我每3秒接收一次位置并更新位置 - 当模拟模式被禁用时 - 但是使用模拟模式启用我无法获得任何位置

@Override
public void onConnected(Bundle bundle) {
    Utils.printDebug("onConnected");

    Location mockLocation = new Location("network");
    mockLocation.setLatitude(50.120089);
    mockLocation.setLongitude(18.993206);
    mockLocation.setAccuracy(4.0f);
    mockLocation.setTime(System.currentTimeMillis());
    LocationServices.FusedLocationApi.setMockMode(mGoogleApiClient, true);
    LocationServices.FusedLocationApi.setMockLocation(mGoogleApiClient, mockLocation);

    mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
            mGoogleApiClient);

    if(mLastLocation!=null)
        Utils.showToast(getApplicationContext(), "Last know location is " + mLastLocation.getLatitude() + ", " + mLastLocation.getLongitude());

    startLocationUpdates();
}
Run Code Online (Sandbox Code Playgroud)

我有<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />和开发人员选项模拟位置启用.

我怎样才能收到那个模拟位置?

android

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

kdb单项列表未初始化

我正在通过Kx技术培训课程,有一条线说

"Enlist适用于所有数据对象;任何数据对象的结果都是单项目列表,其项目是该对象.例如"

 enlist(2 5;3.5 10 12)
    ,(2 5;3.5 10 12)
Run Code Online (Sandbox Code Playgroud)

该结果不是浮点数的一维列表.它是一个二维列表,其中唯一的元素是浮点数的一维列表

但是,当我完全按照QI做的例子时,不要那样做.我明白了

enlist(2 5;3.5 10 12)
2 5 3.5 10 12
Run Code Online (Sandbox Code Playgroud)

所以下面的工作,我期望不能工作给出所谓的结构的解释:

enlist(2 5;3.5 10 12)+1
3 6 4.5 11 13
Run Code Online (Sandbox Code Playgroud)

这是怎么回事?

kdb q-lang

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

从 KDB HDB 和 KDB RDB 查询时的区别

我听说从 HDB 和 RDB(内存中)数据库查询(选择等)时会有所不同。当我们应该使用 HDB 特定查询和 RDB 特定查询以及如何查询时,是否可以描述所有可能的场景:即 HDB 查询的示例和 RDB 的相同示例?

kdb q-lang

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

如何接收从服务器发送的字节数组,一次读取4个单字节

我需要从服务器接收320字节的数据,该服务器包含80个4字节的int字段.我如何以4的字节接收它们并显示它们各自的int值?谢谢.

不确定这是否适合接收部分:

//for reading the data from the socket 

BufferedInputStream bufferinput=new BufferedInputStream(NewSocket.getInputStream());

DataInputStream datainput=new DataInputStream(bufferinput);

byte[] handsize=new byte[32];

// The control will halt at the below statement till all the 32 bytes are not read from the socket.  

datainput.readFully(handsize); 
Run Code Online (Sandbox Code Playgroud)

java sockets bufferedinputstream

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

标签 统计

kdb ×4

q-lang ×4

java ×2

android ×1

apache-karaf ×1

bufferedinputstream ×1

c ×1

c++ ×1

jetty ×1

jetty-8 ×1

latency ×1

mpi ×1

networking ×1

osgi ×1

pax ×1

pax-exam ×1

ping ×1

sockets ×1

ssl ×1