小编Rom*_*n C的帖子

我想在手机上安装未签名的apk文件。该怎么办?

我已经建立了一个应用程式。我通过Eclipse APK将其导出。

我有APK文件。我想将其发送给我的父亲(在另一个国家,所以无法做很多技术工作),以便他可以安装它并查看我的进度?

在没有在Playstore上获得开发者帐户的情况下该怎么办?

java android apk

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

无法运行hadoop wordcount示例?

我在vmware中的ubuntu 12.04上的单节点环境中运行hadoop wordcount示例.我运行这样的例子: -

hadoop@master:~/hadoop$ hadoop jar hadoop-examples-1.0.4.jar wordcount    
/home/hadoop/gutenberg/ /home/hadoop/gutenberg-output
Run Code Online (Sandbox Code Playgroud)

我在下面的位置输入文件:

/home/hadoop/gutenberg
Run Code Online (Sandbox Code Playgroud)

和输出文件的位置是:

    /home/hadoop/gutenberg-output
Run Code Online (Sandbox Code Playgroud)

当我运行wordcount程序时,我得到以下错误: -

 13/04/18 06:02:10 INFO mapred.JobClient: Cleaning up the staging area     
hdfs://localhost:54310/home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201304180554_0001       
13/04/18 06:02:10 ERROR security.UserGroupInformation: PriviledgedActionException       
as:hadoop cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory 
/home/hadoop/gutenberg-output already exists 
org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory 
/home/hadoop/gutenberg-output already exists at 

org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.j 
ava:137) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:887) at 
org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850) at 
java.security.AccessController.doPrivileged(Native Method) at 
javax.security.auth.Subject.doAs(Subject.java:416) at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121) at   
org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850) at  
org.apache.hadoop.mapreduce.Job.submit(Job.java:500) at  
org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530) at 
org.apache.hadoop.examples.WordCount.main(WordCount.java:67) at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:616) at 
org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68) 
at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139) …
Run Code Online (Sandbox Code Playgroud)

hadoop mapreduce

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

ParseException的; 必须被抓住(Try/Catch)(Java)

我正在写一个约会计划,我收到以下错误:

AppointmentNew.java:68: unreported exception java.text.ParseException; must be caught or declared to be thrown
        Date lowDate = sdf.parse(stdin.nextLine());
                                ^
AppointmentNew.java:70: unreported exception java.text.ParseException; must be caught or declared to be thrown
        Date highDate = sdf.parse(stdin.nextLine());  
                                 ^
AppointmentNew.java:77: unreported exception java.text.ParseException; must be caught or declared to be thrown
           Date newCurrentDate = sdf.parse(currentDate); 
Run Code Online (Sandbox Code Playgroud)

我很确定我需要尝试/捕捉,但我不知道如何制作它.我收到错误的部分是它要求用户输入BEGINNING和END日期,当他们这样做时程序然后打印出他们在两个日期之间做出的约会.

这是我的代码:

import java.util.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class AppointmentNew 
{
public static void main (String[] args)
{
  ArrayList<String> list = new ArrayList<String>();
  Scanner stdin = new Scanner(System.in); …
Run Code Online (Sandbox Code Playgroud)

java parseexception

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

不正确的Resharper建议 - 未使用的变量(实际用于数据绑定)

我有一段代码,Resharper告诉我有未使用的变量,但变量肯定是使用的.变量在Databind()中使用,而要绑定的字段指定为字符串.由于使用字符串变量访问字段名称,因此Resharper认为它们不被使用.

在下面的代码示例中,Resharper告诉我将公共变量更改为private.这样做后,它告诉我变量未使用,可以删除.这两个建议都是错误的,因为变量是使用的,必须是公开的.

我不喜欢Resharper警告我这个并且是黄色的.我想检查我的代码绿色.我知道我可以忽略这个使用选项来抑制评论,但在过去我从来没有必要使用此选项,并能够找到其他解决方案,以使我的代码绿色.在这种情况下,我无法找到另一种方式.有谁知道我怎么能让Resharper认识到这个变量正被使用?

using System;
using System.Collections;
using System.Web.UI.WebControls;

public partial class TestCode_General_ResharperTest : System.Web.UI.Page
{
    private class TestClass
    {
        public TestClass(string name, string id)
        {
            ID = id;
            Name = name;
        }

        public string ID;  /*Resharper says this can be made private*/
        public string Name; /*Resharper says this can be made private*/
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DropDownList testList = new DropDownList();
            ArrayList groups = getTestList();
            testList.DataSource = groups;
            testList.DataValueField = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net resharper

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

关键事件

我想为JButton添加一个KeyEventListener,它响应Enter键,使用以下代码段:

   private void jButton3KeyPressed(java.awt.event.KeyEvent evt) {
        if (evt.getKeyCode() == 10) {
           eventRegister();
        }
   }                                   
Run Code Online (Sandbox Code Playgroud)

我按空格键而不是输入,if条件设置为true并eventRegister调用.为什么?我怎么能阻止这种方式?

java swing keylistener jbutton

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

如何防止struts中的通配符命名空间?

我遇到了一个问题,我无法找到关键词来解决以下情况:

<package name="Main" namespace="/" extends="struts-default">
    <action name="administrator" class="com.xyz.AdminAction">
        <result name="success">/WEB-INF/jsp/admin.jsp</result>
    </action>
</package>
Run Code Online (Sandbox Code Playgroud)

上面的网址应该是http://xyz.com/administrator,它运行正常.但是,如果我将网址更改为http://xyz.com/asdasd/asdasdasd/administrator,它仍然有效,但我不能接受这个!那么任何告诉struts的设置只接受http://xyz.com/administrator吗?谢谢!

struts2 struts2-namespace

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

在Struts 2中使用ActionForward和动态参数

将应用程序从Struts 1迁移到Struts 2时

在某些地方,根据请求参数,相同的动作类已用于不同类型的视图.

例如:如果createType1表示需要附加一个参数,或者createType2表示需要追加一些额外的参数,就像我需要将动态参数传递给其他一些动作一样ActionForward.

struts-config.xml中

<action path="/CommonAction" type="com.example.CommonAction" scope="request">
    <forward name="viewAction" path = "/ViewAction.do"/>
</action>
Run Code Online (Sandbox Code Playgroud)

行动类

public class CreateAction extends Action
{
    public ActionForward execute(ActionMapping m, ActionForm f, HttpServletRequest req, HttpServletResponse res) throws ServletException, Exception
    {
            String actionPath = m.findForward("viewAction").getPath();
            String createType = req.getParameter("createType");
            String params = "&action=view";
            if("1".equals(createType)){
               params = params + "&from=list";
            }else if("2".equals(createType)){
               params = params + "&from=detail&someParam=someValue";
            }//,etc..
            String actionUrl = actionPath+"?"+params;
            return new ActionForward(actionUrl);
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,我无法在Struts 2中做同样的事情.在Struts …

java struts struts2 actionresult

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

你好,没有主要方法的世界(由Horstmann提供)

Core Java第7版中的Horstmann写道,可以显示Hello,没有main方法的世界.它是这样完成的:

public class Hello{
    static{
        System.out.println("Hello, world");
    }
}
Run Code Online (Sandbox Code Playgroud)

他说,首先你好,世界将被写入.只有这样您才会收到错误消息.

我用

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
Run Code Online (Sandbox Code Playgroud)

我没有对此进行建模.它已经修好了吗?

java

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

java中的夏令时

请看看你是否可以告诉我如何处理我的DST问题.

首先,我的应用程序是一个物流系统,它适用于全球用户,所以它涉及时区问题,我将在设置用户本地预订日期时处理如下:

1.当用户登录应用程序,我们可以得到根据登录IP用户的时区,但仅仅是一个偏移量(我不记得这东西的术语),例如,"GMT + 08"(北京)或"GMT-06" (芝加哥) .

2.在用户保存预订之前,我们需要设置预订当地日期,因为我无法直接获得用户本地日期.所以我将首先获得服务器日期(在我的情况下,它是北京时间),然后根据当地日期计算到服务器日期和用户时区,例如,如果用户时区是"GMT-08",则服务器日期是2013-08-29 17:45:00.服务器时区是"GMT + 08",然后我将使用服务器日期-8-8,结果将是2013-08-29 01:45:00.但由于我不考虑夏令时,计算的本地日期将与实际日期不同.现在在旧金山,实际的本地日期将比我用这种方式计算的结果早一个小时,

我发现java TimeZone已经考虑了DST问题,但我需要在构造TimeZone时提供"位置"名称(例如US/Alaska,Pacific/Apia).虽然在我的情况下,我能得到的只是偏移量.你能告诉我如何在我的情况下解决DST问题吗?

java timezone datetime

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

随着时间的推移来回改变颜色与css

我想知道是否有人可以帮助我在两秒后将div的颜色从黑色变为白色,然后在两秒后从白色变为黑色,再次返回等等,只要div存在.换句话说,只有当用户点击并拖动表面时才显示div(就像桌面选择区域一样),我的目标是在用户仍在选择时更改边框的颜色,如上所述表面就像重新调整div一样.

html javascript css jquery colors

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