小编Dan*_*iel的帖子

UML中协作图和通信图有什么区别?

UML中协作图和通信图有什么区别?它们是相同的图表吗?

uml collaboration-diagram communication-diagram

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

关于cpu密集型任务的Hadoop Java与C/C++

我是Hadoop的新手.我想使用分层聚类来聚集约1.5亿个项目,每个项目具有约30个属性.维度/属性总数约为5000.

我已经设计了一个多级解决方案,它通过对整个数据进行分区并在每个分区上执行聚类并在那之后合并每个聚类,直到检索到所需数量的聚类.

- Clustering is performed in each map task. So, each map task would be cpu-intensive.
- I am stuck at deciding about which of the following options to use:
     - Map-Reduce in native Java.
     - Map-Reduce using Hadoop Streaming on C.(This is because of each task being cpu-intensive).

Which option should I go with?. Is there any other way I could achieve my destination?
Run Code Online (Sandbox Code Playgroud)

c java hadoop mapreduce cluster-analysis

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

可滚动的vaadin视图以显示页面中的所有组件

如何使用布局组件在vaadin中实现html网页(vaadin的新功能)

现在我在UI组件中添加的任何组件只有一些组件出现在浏览器中...

没有滚动选项可以查看我在层次结构中添加的其他组件

public class LoginView extends CustomComponent implements View,
    Button.ClickListener {

    public static final String NAME = "login";

    private TextField user;

    private PasswordField password;

    private Button loginButton;
    NativeSelect select_role;

    private HorizontalLayout fieldsBottomPanel;

    private VerticalLayout fieldsLeftPanel;

    private GridLayout loginPanelGrid;

    private VerticalLayout filedsTopPanel;

    private VerticalLayout loginFormLayout;

    private Label top_header_panel;

    private VerticalLayout virtualKeyboard;

    private VerticalLayout fieldsRightPanel;

    private VerticalLayout footer;

    private VerticalLayout header;

    private Window page;



    public LoginView() {
        setSizeFull();  
        addTopPanelToLoginForm();
        addLeftPanelToLoginForm();
        addBottomPanelToLoginForm();
        addRightPanelToLoginForm();
        addLoginFormToPage();
        addFooterToPage();
        addHeaderToPage();

        VerticalLayout viewLayout = new VerticalLayout(header,loginFormLayout,footer);
        viewLayout.setComponentAlignment(loginFormLayout, …
Run Code Online (Sandbox Code Playgroud)

java frameworks vaadin web

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

ngRepeat打破了指令的功能

我有两个连接在一起的指令(提供最少的代码示例):

  • 一个用于验证目的(apValidation).

    module.directive('apValidation', ['$compile', function($compile){
        return {
            restrict: 'A',
            compile: function (element) {
            element.removeAttr('ap-validation');   // to avoid infinite compilation
            element.attr('ng-blur', 'testMe()');   // this method has to be called for the validation to happen
            var fn = $compile(element);
                return function (scope) {
                    fn(scope);
                  };
            },
            controller: function ($scope, $attrs) {
               $scope.testMe = function () {
                   alert("Validating current text field");
               };
            }
        }
    }]);
    
    Run Code Online (Sandbox Code Playgroud)
  • 另一个是可重用的文本字段组件,定义为具有隔离范围的指令,它使用验证指令(apTextField).

    module.directive('apTextField', function(){
        return{
            restrict: 'E',
            replace:true,
            scope: {
                name: '@',
                label: '@'
            }, …
    Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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

从Java Servlet发送巨大的json对象

Java servlet返回JSON对象.

response.setContentType("application/json");
response.getWriter().write(json.toString()); 
Run Code Online (Sandbox Code Playgroud)

JSON对象包含从表(数据库)大小获取的数据,大小> 50 MB.

在运行时,servlet会抛出此错误:

java.lang.OutOfMemoryError: Java heap space
Run Code Online (Sandbox Code Playgroud)

似乎问题在于编写json数据.服务器无法为字符串分配大小> 50 MB的连续内存.

我无法找到解决此问题的方法.如何从Servlet发送巨大的JSON对象?

java json servlets

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

int和double之间的转换问题

这段代码给出了我想要的结果

double a=Math.random()*100;
int b=(int)a;
System.out.println(b);
Run Code Online (Sandbox Code Playgroud)

但是当我用这种方式做同样的事情时,总是给出零

int a=(int)Math.random()*100;
System.out.println(a);
Run Code Online (Sandbox Code Playgroud)

据我所知,类型转换会将较大的数据类型存储为小型.但是在后面的代码中,每次运行程序时我都会得到零.

java type-conversion

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