小编luc*_*fer的帖子

找不到Hadoop命令

我已经在linux机器上安装并配置了hadoop.现在我正在尝试运行一个示例MR作业.我已经通过命令/usr/local/hadoop/bin/start-all.sh启动了hadoop,输出是

namenode running as process 7876. Stop it first.
localhost: datanode running as process 8083. Stop it first.
localhost: secondarynamenode running as process 8304. Stop it first.
jobtracker running as process 8398. Stop it first.
localhost: tasktracker running as process 8612. Stop it first.
Run Code Online (Sandbox Code Playgroud)

所以我认为我的hadoop配置成功.但是当我试着在命令下运行时它正在给予

jeet@jeet-Vostro-2520:~$ hadoop fs -put gettysburg.txt /user/jeet/getty/gettysburg.txt
hadoop: command not found
Run Code Online (Sandbox Code Playgroud)

我是hadoop.somebody的新人请帮助.我也发布了我正在尝试的截图在此输入图像描述

java hadoop

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

Mapreduce wordcount作业中找不到类的异常

我正在尝试在hadoop中运行wordcount作业.但总是得到一个类未找到异常.我发布了我写的类和我用来运行作业的命令

import java.io.IOException;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;

 public class WordCount {

 public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> {
    private final static IntWritable one = new IntWritable(1);
    private Text word = new Text();

    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        StringTokenizer tokenizer = new StringTokenizer(line);
        while (tokenizer.hasMoreTokens()) {
            word.set(tokenizer.nextToken());
            context.write(word, one);
        }
    }
 } 

 public …
Run Code Online (Sandbox Code Playgroud)

java debugging hadoop

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

如何在JavaFx中将列表值填充到组合框中

我有一个值列表,我想在javaFx中的组合框中填充.这是我的combo.xml

 <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-    Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2">
<children>
<ComboBox id="comboId" layoutX="210.0" layoutY="108.0" prefHeight="27.0" prefWidth="102.0" promptText="Select">
  <items>
       <FXCollections fx:factory="observableArrayList">
      <String fx:value="Item 1" />
      <String fx:value="Item 2" />
      <String fx:value="Item 3" />
       </FXCollections>
     </items>
   </Com boBox>
  </children>
  </AnchorPane>
Run Code Online (Sandbox Code Playgroud)

这是我的主要

public class JavaFXExperiment extends Application {
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("combo.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    final ComboBox comboId = new ComboBox();
    comboId.getItems().addAll(
            "jacob.smith@example.com",
            "isabella.johnson@example.com",
            "ethan.williams@example.com",
            "emma.jones@example.com",
            "michael.brown@example.com");
} …
Run Code Online (Sandbox Code Playgroud)

javafx

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

如何在onclick上更改D3节点的大小

我有一个d3 api,我在其中显示数字之间的关系,我正在使用servlet来获取json格式的数据.现在我希望当我点击某个节点时它的大小会更大.我看到了一个例子这个,我也尝试把它放在我的api中,但它不能正常工作.我发布了我的代码和该示例的链接.

这是我的代码..

<script>


                    var links = [];
                    var nodes = {};

                    // Compute the distinct nodes from the links.

                    var width = 960, height = 500;
                    function loadNewData(){
                        var svg = d3.select("#linkAnalysis").append("svg").attr("width", width).attr(
                        "height", height);

                        // Per-type markers, as they don't inherit styles.
                        svg.append("defs").selectAll("marker").data(
                        [ "suit", "licensing", "resolved" ]).enter().append("marker")
                        .attr("id", function(d) {
                            return d;
                        }).attr("viewBox", "0 -5 10 10").attr("refX", 15).attr("refY",
                            -1.5).attr("markerWidth", 6).attr("markerHeight", 6)
                        .attr("orient", "auto").append("path").attr("d",
                        "M0,-5L10,0L0,5");


                        d3.json(
                        "DirectedServlet",
                        function(error, directed) {

                            links=directed.links;


                            links.forEach(function(link) {
                                link.source = nodes[link.source]
                                    || (nodes[link.source] …
Run Code Online (Sandbox Code Playgroud)

javascript d3.js

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

如何在java中保存变量的值

我要求我需要保存变量的值.我的问题是我需要从一个网页发送一个值到servlet,其中变量的值是第一次为null但是当我从选择框中选择一个值时它会调整到servlet并且它会带有值,但是我的问题在这里我需要在选择值后重新页面.所以现在当我这样做时,值再次变为零并且操作没有发生我可以在从选择中选择一些值后保存变量的值吗?

这是我的代码..

   <body>
    Select Country:
    <select id="country">
        <option>Select Country</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>

    </select>

    <input type="button" value="Reload page" onclick="reloadPage()">
</body>


<script>
    function reloadPage(){

        location.reload();
    }
</script>  



 <script>
        $(document).ready(function() {
            $('#country').change(function(event) {  
                var $country=$("select#country").val();
                $.get('JsonServlet',{countryname:$country},function(responseJson) {   
                    var $select = $('#states');                           
                    $select.find('option').remove();                          
                    $.each(responseJson, function(key, value) {               
                        $('<option>').val(key).text(value).appendTo($select);      
                    });
                });
            });
        });          
    </script>
Run Code Online (Sandbox Code Playgroud)

这是我的servlet

public class JsonServlet extends HttpServlet {

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    PrintWriter out = response.getWriter();
    String value = request.getParameter("countryname");
    System.out.println("comes from ajax" …
Run Code Online (Sandbox Code Playgroud)

java servlets

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

如何格式化Apache POI中的XWPFTable中的文本

XWPFTable使用Apache POI 创建了一个单词.现在,表格正确地显示在列中的文本.现在我想格式化表格中的文字以及大小,字体等.我该怎么做?我所看到的是每个技巧都与运行选项相关联.但我想要的是TableRow.看看到目前为止我做了什么:

XWPFTable tableTwo = document.createTable();
XWPFTableRow tableTwoRowOne = tableTwo.getRow(0);
tableTwo.getCTTbl().getTblPr().unsetTblBorders();
tableTwoRowOne.getCell(0).setText("No Match – Location: ");
tableTwoRowOne.addNewTableCell().setText("Prospect has expressed unwillingness to relocate or is based out of area where commute is not feasible");

XWPFTableRow tableTwoRowTwo = tableTwo.createRow();
tableTwoRowTwo.getCell(0).setText("No Match – Scalability: ");
tableTwoRowTwo.getCell(1).setText("Prospect’s recent organizational size, structure, and complexity is not scalable to client’s environment");
Run Code Online (Sandbox Code Playgroud)

我想格式化表的文本tableTwotableTwoRowTwo.我怎样才能做到这一点?

java apache-poi

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

如何在 D3 中创建工具提示以获取图表中节点上 MouseOver 上的图像

我有一个 D3 应用程序,它正在形成一个图表,上面有一些节点,显示图表的一些年份,并且在节点上执行鼠标悬停事件时还会显示一些信息。现在,当我们将鼠标悬停在图表的节点上时,我想在鼠标悬停事件上显示图像。我在 tsv 文件中做了一些更改,但它没有生效,图像也没有出现。这是我所做的,

  <!DOCTYPE html>
<meta charset="utf-8">
<style> /* set the CSS */

body { font: 12px Arial;}

path { 
    stroke: green;
    stroke-width: 2;
    fill: none;
}

.axis path,
.axis line {
    fill: none;
    stroke: grey;
    stroke-width: 1;
    shape-rendering: crispEdges;
}

div.tooltip {                   /* set the CSS for tooltip divs */
    position: absolute;         /* reference for measurement */
    text-align: center;         /* align the text to the center */
    width: 60px;                    /* set the width of the rectangle */ …
Run Code Online (Sandbox Code Playgroud)

javascript tooltip d3.js

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

如何使用 apache POI 在文档中换行

我正在使用 POI 在 word 中创建一个表格表格已成功创建,但我想在单元格中的每个文本之间做一个新行,我无法做到这一点,这是我到目前为止所做的,

XWPFTable candidateTrackerTable = document.createTable();
XWPFTableRow canndidateTrackerTableRowOne =  candidateTrackerTable.getRow(0);
canndidateTrackerTableRowOne.getCell(0).setText("Presented ");
canndidateTrackerTableRowOne.addNewTableCell().setText("Interview ");
canndidateTrackerTableRowOne.addNewTableCell().setText("Phone ");
canndidateTrackerTableRowOne.addNewTableCell().setText("Final Interview ");
canndidateTrackerTableRowOne.addNewTableCell().setText("Offer ");

XWPFTableRow canndidateTrackerTableRowTwo = null;
for(Map.Entry<Integer, ArrayList<String>> candidateName:aMap.entrySet()){
    canndidateTrackerTableRowTwo =  candidateTrackerTable.createRow();
    for(String s:candidateName.getValue()){
        //System.out.println("------>>"+s);
        canndidateTrackerTableRowTwo.getCell(0).setText(String.valueOf(s)+"\n");
    }
    for(Map.Entry<Integer, ArrayList<String>> candidatePhone:bMap.entrySet()){
        for(String s1:candidatePhone.getValue()){
            //System.out.println("------>>"+s1);
            canndidateTrackerTableRowTwo.getCell(1).setText(String.valueOf(s1));
        }
        for(Map.Entry<Integer, ArrayList<String>> candidateSkyped: cMap.entrySet())
            for(String s2:candidateSkyped.getValue())
                canndidateTrackerTableRowTwo.getCell(2).setText(String.valueOf(s2));
        for(Map.Entry<Integer, ArrayList<String>> candidateOnsite : dMap.entrySet())
            for(String s3:candidateOnsite.getValue())
                canndidateTrackerTableRowTwo.getCell(3).setText(String.valueOf(s3));
        for(Map.Entry<Integer, ArrayList<String>> candidateOffered : eMap.entrySet())
            for(String s4:candidateOffered.getValue())
                canndidateTrackerTableRowTwo.getCell(4).setText(String.valueOf(s4));
    }
}       
Run Code Online (Sandbox Code Playgroud)

我想在每个 canndidateTrackerTableRowTwo.getCell(0).setText(String.valueOf(s)+"\n"); 之间添加新行;

java apache ms-word apache-poi

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

如何使用css在div中创建专业盒子阴影效果

在此输入图像描述我正在创建一个应用程序,我使用div来显示信息,并使用一些jQuery来操纵它们.在我的应用程序中,我想给我的div给盒子阴影,并试图做一个专业的外观.我已经创建了盒子阴影到我的div但它看起来并不专业.我正在使用此链接准备我的应用程序. 反思UI

现在我想创建我的个人信息div与该应用程序中的Summary div完全相同.我也发布了我的代码,到目前为止我已经完成了一个小提琴

#personalInformation{
    font-size: 1em;
    border-bottom: 3px solid #98AFC7;
    border-top: 3px solid #98AFC7;
    border-left: 3px solid #98AFC7;
    border-right: 3px solid #98AFC7;    
    box-shadow: 10px 10px 5px;
    line-height: 0; 
    width: 45%;
}
Run Code Online (Sandbox Code Playgroud)

我的示例代码

现在任何人都可以帮助我使我的div与该应用程序完全相同吗?或者如果不可能那么如何只在底部制作盒子阴影?有人请帮忙.

html javascript css jquery

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

如何在图形的 D3 节点中添加自定义颜色

在此处输入图片说明

我正在将 D3 api 用于图形,其中从父节点形成几个节点我想以每个父节点具有固定颜色而子节点具有不同颜色的方式为整个图的节点着色,即根节点总是有红色,左边的孩子是蓝色的,右边的孩子是绿色的,如果只有一个孩子在那里,它是绿色的。我正在使用这个 api,,

<!DOCTYPE html>
<html>
 <head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.27.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?1.27.1"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?1.27.1"></script>
    <style type="text/css">

 line.link {
  stroke: #ccc;
}

circle.node {
 fill: #000;
 stroke: #fff;
 stroke-width: 1.5px;
}

    </style>
  </head>
  <body>
    <script type="text/javascript">

   var w = 960,
  h = 500,
  r = d3.scale.sqrt().domain([0, 20000]).range([0, 20]);

 var force = d3.layout.force()
.gravity(.01)
.charge(-120)
.linkDistance(60)
.size([w, h]);

var svg = d3.select("body").append("svg:svg")
.attr("width", w)
.attr("height", h);

d3.xml("flare.xml", "application/xml", function(xml) {
  var nodes = self.nodes = d3.select(xml).selectAll("*")[0],
    links = …
Run Code Online (Sandbox Code Playgroud)

javascript svg d3.js force-layout

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