小编Eva*_*aas的帖子

是否有可以在Java进程中嵌入的MQ服务器?

我正在为我的团队的一个应用程序研究排队解决方案.理想情况下,我们希望能够将其配置为轻量级进程内代理(用于线程之间的低吞吐量消息传递)和外部代理.是否有可以执行此操作的MQ服务器?大多数似乎都需要将设置作为外部实体.ZeroMQ似乎最接近于进程内解决方案,但它似乎更像是"类固醇上的UDP套接字",我们需要可靠的交付.

java jms message-queue amqp mq

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

VS2012团队资源管理器中的"按解决方案过滤"按钮在哪里?

在VS2010的团队资源管理器中,有一个选项可以显示当前解决方案的挂起更改(请参阅此处此处).VS2012中是否有相同的功能,如果有,我该怎么做?

team-explorer visual-studio-2012

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

为什么我的测试不能从其父级继承其ContextConfiguration位置?

为了DRY的利益,我想在父类中定义我的ContextConfiguration并让我的所有测试类继承它,如下所示:

家长班:

package org.my;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/org/my/Tests-context.xml")
public abstract class BaseTest {

}
Run Code Online (Sandbox Code Playgroud)

儿童班:

package org.my;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(inheritLocations = true)
public class ChildTest extends BaseTest {

    @Inject
    private Foo myFoo;

    @Test
    public void myTest() {
          ...
    }
}
Run Code Online (Sandbox Code Playgroud)

根据ContextConfiguration文档,我应该能够继承父级的位置,但我无法让它工作.当Spring /org/my/ChildTest-context.xml找不到它时,Spring仍在默认位置()和barfs中查找文件.我试过以下没有运气:

  • 使父类具体化
  • 将无操作测试添加到父类
  • 将注入的成员添加到父类
  • 以上的组合

我正在使用spring-test 3.0.7和JUnit 4.8.2.

java junit spring spring-test

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

Visual Studio 2012 Web Deploy发布预览将所有文件显示为已更改

当您是代码库中唯一的开发人员时,Visual Studio 2012中的"Web发布"对话框的"预览"窗格非常有效(请参阅下面的示例): 在此输入图像描述

但是,当多个开发人员使用它时,它似乎会倒下.它似乎使用文件时间戳作为比较的手段,因此即使您从TFS获得最新信息,您的时间戳也不同于服务器上发布的其他人的文件,因此它在列表中包含了许多幻像更改(一旦你钻进,差异的两个窗格是相同的).

有没有人想出这个场景的解决方法?

preview web-publishing one-click-web-publishing visual-studio-2012

8
推荐指数
2
解决办法
1322
查看次数

try/catch/finally语法的起源

关于词源向导的问题:哪种编程语言是第一个使用今天的Java/.NET语言中的try/catch/finally语法?

error-handling programming-languages language-history

7
推荐指数
2
解决办法
2019
查看次数

仅为某些字段自定义jQuery Validation的errorPlacement

我想errorPlacement仅针对某些字段自定义,并遵循插件的默认位置.就像是:

errorPlacement : function(error, element) {
    if($(element).prop("id") === "mySpecialField") {
        $("#mySpecialErrorMessageHolder").append(error);
    }
    else {
        // this is not valid syntax but it's what I really want...
        super.errorPlacement(error, element);
    }
}
Run Code Online (Sandbox Code Playgroud)

这可能吗?

jquery jquery-validate

7
推荐指数
2
解决办法
4526
查看次数

如何在PCL中从观众中选取两个点

我想从pointcloud中选择两个点并返回两点的坐标.为了解决这个问题,我使用了PointPickingEventPCL,编写了一个包含pointcloud,visualizer和vector的类来存储选定的点.我的代码:

#include <pcl/point_cloud.h>
#include <pcl/PCLPointCloud2.h>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/common/io.h>
#include <pcl/io/ply_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/visualization/pcl_visualizer.h>

using namespace pcl;
using namespace std;

class pickPoints { 
public: 

    pickPoints::pickPoints () { 
        viewer.reset (new pcl::visualization::PCLVisualizer ("Viewer", true)); 
        viewer->registerPointPickingCallback (&pickPoints::pickCallback, *this); 
    } 

    ~pickPoints () {} 

    void setInputCloud (PointCloud<PointXYZ>::Ptr cloud) 
    { 
        cloudTemp = cloud; 
    } 

    vector<float> getpoints() { 
        return p; 
    } 

    void simpleViewer () 
    { 
        // Visualizer
        viewer->addPointCloud<pcl::PointXYZ>(cloudTemp, "Cloud"); 
        viewer->resetCameraViewpoint ("Cloud"); 
        viewer->spin(); 
    } 

protected: 
    void pickCallback (const pcl::visualization::PointPickingEvent& event, void*) 
    { 
        if …
Run Code Online (Sandbox Code Playgroud)

viewer point-cloud-library

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

防止回归的单元测试示例

我是我的 IT 商店(一家中型零售商)中唯一编写单元测试的开发人员。管理层责成我向我们的开发人员介绍这样做的好处。

“啊哈!”之一。导致我对单元测试上瘾的时刻是我意识到单元测试套件可以防止代码回归,而如果您手动测试,您永远不会想到重新测试这些代码(因为它似乎与您所做的更改无关)。

我正在寻找此类测试的示例以包含在演示文稿中。理想情况下,它应该足够“真实”以具有可信度,但又足够独立以适合课堂环境。自制测试和指向相关文本的指针都很好。实施语言并不重要。

testing unit-testing regression-testing

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

如何重命名从手机图库中检索的图像并将其保存为新名称

我通过以下代码从图库中获取图像:

接受其他答案解释了如何发送意图,但没有很好地解释如何处理响应。以下是一些有关如何执行此操作的示例代码:

protected void onActivityResult(int requestCode, int resultCode, 
       Intent imageReturnedIntent) {
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent); 

    switch(requestCode) { 
    case REQ_CODE_PICK_IMAGE:
        if(resultCode == RESULT_OK){  
            Uri selectedImage = imageReturnedIntent.getData();
            String[] filePathColumn = {MediaStore.Images.Media.DATA};

            Cursor cursor = getContentResolver().query(
                               selectedImage, filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String filePath = cursor.getString(columnIndex);
            cursor.close();


            Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,我想从文件路径中获取文件名,将其重命名并再次保存。这可能吗?如果是,怎么办?

android gallery filepath

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

应该在哪个包中实现Java接口?

假设我有一个界面:

package org.my.dicom.CEchoSCU;

public interface CEchoSCU {
    // stuff here...
}
Run Code Online (Sandbox Code Playgroud)

我还将有一个接口的实现:

public class SimpleCEchoSCU implements CEchoSCU {
    // stuff here...
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,哪个包应该包含实现?我已经看到其他开发人员将实现放在与接口相同的包中(org.my.dicom在本例中),以及使用单独包的情况(通常类似org.my.dicom.impl).除了个人喜好之外,还有什么理由更喜欢一个而不是另一个?

java interface package

4
推荐指数
2
解决办法
4683
查看次数

从android studio中的图库中选择一张图片?

有人可以告诉我这是什么问题,它不起作用,所以请快速帮助我真的需要:

 imagePick.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent, "Select Contact Image"),1);
        }
    });


  public void onActivityResult(int reqCode, int resCode, Intent data)
{
    if(resCode==RESULT_OK)
    {
        if(reqCode==1) {
            imageURI=data.getData();
            iv.setImageURI(data.getData());

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

android styles

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

PID控制器,用于以速度精确行进

我试图通过发送线性速度的消息来使仿真中的机器人移动精确的距离。现在,我的实现并不能使机器人移动精确的距离。这是一些示例代码:

void Robot::travel(double x, double y)
{
    // px and py are the current positions (constantly gets updated as the robot moves in the simulation)
    // x and y is the target position that I want to go to
    double startx = px;
    double starty = py;
    double distanceTravelled = 0;

    align(x, y);
    // This gets the distance from the robot's current position to the target position
    double distance = calculateDistance(px, py, x, y);

    // Message with velocity
    geometry_msgs::Twist msg; …
Run Code Online (Sandbox Code Playgroud)

c++ distance ros

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