小编Gee*_*ega的帖子

线程"main"中的异常java.lang.ClassNotFoundException:WordCount

我目前想要创建Hadoop的单个实例节点.所以我正在学习本教程.我在终端中运行了以下命令:

hduser@ubuntu:/usr/local/hadoop$ bin/hadoop jar WordCount.jar geekyomega.WordCount /user/hduser/gutenberg /user/hduser/gutenberg-output
Run Code Online (Sandbox Code Playgroud)

在遇到这个错误之前,事情进展顺利:

Exception in thread "main" java.lang.ClassNotFoundException: WordCount
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
Run Code Online (Sandbox Code Playgroud)

我试图使用以下代码运行此示例,我从这里获得.这是我的代码版本:

package geekyomega;

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 …
Run Code Online (Sandbox Code Playgroud)

java debugging hadoop word-count

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

Oracle SQL Developer:失败 - 测试失败:网络适配器无法建立连接?

问题

请注意,我出于安全目的更改了详细信息.但问题仍然存在.

我在位置上的服务器上安装了Oracle 11g数据库,例如herp-devDV.derp.edu.现在我在位置的服务器上有另一个Oracle 11g数据库,比如derp-db.derp.edu.

我在Oracle SQL开发人员中为herp-devDV.derp.edu和derp-db.derp.edu输入了连接名称,用户名,密码,主机名和服务名称.我可以连接到derp-db.derp.edu中的模式,但不能连接到herp-devDV.derp.edu.它给了我这样的信息:

Failure - Test failed: The Network Adapter could not establish the connection
Run Code Online (Sandbox Code Playgroud)

细节

我有以下信息:

  • 我telnet时,任何一台服务器都没有打开端口1521
  • 我的听众已经准备好了.
  • 我可以在Oracle SQL Developer上访问derp-db.derp.edu.
  • Oracle客户端位于我的本地计算机+ Oracle SQL Developer上
  • 我可以远程桌面到两台服务器

我做了什么

  • 谷歌搜索
  • 堆栈溢出
  • 跑停并启动lnrctl命令
  • 在herp-devDB.derp.edu上我跑了 lsnrctl status

我收到了以下输出

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
Start Date                03-JUN-2014 13:37:22
Uptime                    6 days 0 hr. 53 min. 4 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP …
Run Code Online (Sandbox Code Playgroud)

oracle database-connection oracle11g oracle-sqldeveloper

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

为什么这个printf()语句不能在C中打印两个字符串变量?

我在学习C的过程中一直在疯狂地研究.我一直在调试一个C程序,我认为这里有一些重大问题.现在我有关键问题.我制作了一个虚拟程序,在一个语句中打印两个字符串,如下所示:

   #include<stdio.h>

int main(int argc, char* argv[])
{
    char *herp = "Derp";
    char *derp = "Herp";

    printf("Herp %s Derp %s\n", herp, derp);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这按预期打印出来.我明白了

Herp Derp Derp Herp
Run Code Online (Sandbox Code Playgroud)

所以,我想,让我通过做类似的事情调试我自己的程序.我的程序中的以下行

printf("word is: %s and jumbled word is: %s\n", word, jumbleWord);
Run Code Online (Sandbox Code Playgroud)

应打印出类似的东西

Word is: word and jumbled word is: dowr
Run Code Online (Sandbox Code Playgroud)

但它打印出类似的东西

and jumbled word is: dowr
Run Code Online (Sandbox Code Playgroud)

输出的第一部分在哪里?我需要能够在同一行上打印这两个进行调试.此外,这样的陈述不起作用这一事实告诉我,真的很奇怪的事情正在发生,我秃头撕裂了我的头发.正如我的链接帖子所示,我最终想比较这些字符串值,但是如果printf()不能正常工作,我怎么能这样做呢?

我发布了下面的整个程序,这样你就可以看到一切都在发生.我只是在学习如何使用指针.当我想混淆一个单词并且效果不好时,我最初有两个指针指向相同的内存!所以我修复了它,并用我需要的单词获得了两个独立的内存空间.现在,我只是无法打印它们.鉴于以下代码,这一切都有意义:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MAX_WORD_LENGTH 25

//Define global variables 
int numWords; 

//Preprocessed Functions 
void jumblegame();
void readFile(char *[]);
void …
Run Code Online (Sandbox Code Playgroud)

c string debugging printf

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

为什么这个 C 代码给我一个总线错误?

像往常一样,我在这里阅读了很多帖子。我发现了一篇关于一般总线错误的特别有用的帖子,请参阅此处。我的问题是我无法理解为什么我的特定代码会给我一个错误。

我的代码是自学C语言的一次尝试,是对我学Java时做的一个游戏的修改。我的游戏的目标是获取一个巨大的 5049 x 1 文本文件。随机选择一个单词,将其打乱并尝试猜测它。我知道如何做到这一切。所以无论如何,文本文件的每一行都包含一个单词,例如:

   5049
   must
   lean 
   better 
   program 
   now
   ...
Run Code Online (Sandbox Code Playgroud)

所以,我在C中创建了一个字符串数组,尝试读取这个字符串数组并将其放入C中。我没有做任何其他事情。一旦我将文件放入 C 中,其余的事情就很容易了。更奇怪的是它遵守了。当我用./blah命令运行它时,我的问题出现了。

我得到的错误很简单。它说:

zsh: bus error ./blah
Run Code Online (Sandbox Code Playgroud)

我的代码如下。我怀疑这可能与内存或缓冲区溢出有关,但这完全不科学,而且是一种直觉。所以我的问题很简单,为什么这个 C 代码会给我这个总线错误消息?

#include<stdio.h>
#include<stdlib.h>

//Preprocessed Functions 
void jumblegame();
void readFile(char* [], int);


int main(int argc, char* argv[])
{
    jumblegame();

}

void jumblegame()
{
    //Load File 
        int x = 5049; //Rows
        int y = 256; //Colums
        char* words[x]; 
        readFile(words,x);

    //Define score variables 
        int totalScore = 0;
        int currentScore = 0; 

   //Repeatedly pick a random work, …
Run Code Online (Sandbox Code Playgroud)

c arrays function bus-error

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

如何更新我的通知以显示我的时间计数器更改?

我差不多完成了我正在制作的玩具应用游戏.

问题: 我的通知总是显示我的计数器是30000.为什么不是时间减少?

我做了什么: 我已经实现了一个简单的Service类和一个自定义计时器来记下来.最终,一旦我确定计时器正在运行,我将退出整个游戏.

这是我的代码:

package com.example.redshirtmarblez;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.IBinder;
import android.widget.Toast;

public class TimingService extends Service{

    public long counter = 30000;
    private Context ctx;
    private Activity localActivity;


    private NotificationManager nm;

    @Override
    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void onCreate() 
    {
          super.onCreate();
          nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
          declareNotification();
          timer.start();
          //Toast.makeText(this, "Timer is :" + counter, Toast.LENGTH_LONG).show();
          //showNotification(); …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-service android-notifications android-3.0-honeycomb

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

为什么strcpy()也会复制\n?我可以摆脱它吗?

我调试了一个函数,它正在工作.所以,自己教C似乎也很顺利.但我想让它变得更好.也就是说,它读取这样的文件:

want 
to 
program
better
Run Code Online (Sandbox Code Playgroud)

并将每个单独的字符串行放入一个字符串数组中.然而,当我打印出来时,事情变得奇怪.据我所知,strcpy()应该只是复制一个字符串,直到\ 0字符.如果这是真的,为什么以下打印字符串需要和\n?就像strcpy()也复制\n而且它挂在那里.我想摆脱它.

我的复制文件的代码如下.我没有包括整个计划,因为我不相信这与正在发生的事情有关.我知道问题出在这里.

void readFile(char *array[5049]) 
{
    char line[256]; //This is to to grab each string in the file and put it in a line. 
    int z = 0; //Indice for the array

    FILE *file;
    file = fopen("words.txt","r");

    //Check to make sure file can open 
    if(file == NULL)
    {
        printf("Error: File does not open.");
        exit(1);
    }
    //Otherwise, read file into array  
    else
    {
        while(!feof(file))//The file will loop until end of file
        {
           if((fgets(line,256,file))!= NULL)//If the …
Run Code Online (Sandbox Code Playgroud)

c arrays printf strcpy

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

查询:为什么我的正则表达式代码不能读取所有字符?

我有以下描述我想要使用我的程序废料.

<hr>通过接触美国空军的职能,部署和就业运营,为AFROTC学员提供多达13种选择,以实现实际领导和专业培训.外语和文化沉浸也可用/可能,但总体重点仍然是领导力发展和实践.所有项目都在选定的空军基地以及美国和国外的其他地点进行.<br>

我有以下代码:

findDescription = re.findall('<hr>(.*?)(?:<strong>|<br>)', coursePage)
Run Code Online (Sandbox Code Playgroud)

我得到以下输出:

[通过接触美国空军的职能,部署和就业运营,为AFROTC学员提供多达13种实用领导和专业培训选项.\ xc2\xa0外语和文化沉浸也可用/可能,但总体重点仍然是领导力发展和实习.\xc2\xa0所有节目都在选定的空军基地以及美国和国外的其他地点进行.']

为什么我会\xc2\xa0在这里得到奇怪的东西?我的代码也会被引号符号绊倒".坦率地说,我相信.我的正则表达式代码中的句点应该接受所有字符串.出了什么问题?

我很欣赏任何快速提示.我星期五只听说过正则表达式而且我已经取得了巨大的进步,但是这个让我真的绊了几个小时.

温馨的问候,GeekyOmega

python regex web-scraping

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

Perl:匹配时清空$ 1正则表达式值?

读者朋友,

我有以下正则表达式问题:

 #!/usr/bin/perl -w
use 5.010;
use warnings;

my $filename = 'input.txt';
open my $FILE, "<", $filename or die $!;

while (my $row = <$FILE>)
{                   # take one input line at a time
    chomp $row;
    if ($row =~ /\b\w*a\b/)
    {
       print "Matched: |$`<$&>$'|\n";  # the special match vars
       print "\$1 contains '$1' \n";
    }
    else
    {
       #print "No match: |$row|\n";
    }
}
Run Code Online (Sandbox Code Playgroud)

input.txt中

I like wilma. 
this line does not match
Run Code Online (Sandbox Code Playgroud)

产量

Matched: |I like <wilma>|
Use of …
Run Code Online (Sandbox Code Playgroud)

regex perl matching

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