小编Gth*_*ma2的帖子

Phonegap应用程序出错:未定义模块cordova/plugin_list已定义

我一直试图解决从Phonegap 2更新到Phonegap 3.3的许多问题,但我似乎无法解决这个问题.

我从一些用户那里读到,未捕获的模块异常会导致导入的插件停止运行.我有一些奇怪的错误与本地通知插件,所以我想解决这个问题,看看它是否有帮助.

这是Eclipse中logcat中出现的错误:

[INFO:CONSOLE(79)] "Uncaught module cordova/plugin_list already defined", source: file:///android_asset/www/cordova.js (79)
Run Code Online (Sandbox Code Playgroud)

我知道这是一个奇怪的问题,因为Phonegap 3的性质(插件已被重做).我认为问题在于导入cordova_plugins.js脚本,因为该脚本的顶行如下:

cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
    "file": "plugins/org.apache.cordova.file/www/DirectoryEntry.js",
    "id": "org.apache.cordova.file.DirectoryEntry",
    "clobbers": [
        "window.DirectoryEntry"
    ]
}, ...
Run Code Online (Sandbox Code Playgroud)

这是唯一可以找到错误中引用的cordova/plugin_list存在的地方.

但是,我不确定解决此问题的正确方法.我没有使用plugman来导入我的插件,而是使用Phonegap 3.3 API中概述的CLI命令

android phonegap-plugins cordova cordova-3

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

扫雷程序中的NullPointerException

所以我是一名计算机科学专业的学生,​​也是一名刚刚掌握Java的程序员.有人让我帮他们完成一项任务,他们必须创建一个非常基本的扫雷程序.该程序根本不使用标记地雷,但除此之外,它在功能上与任何其他扫雷游戏相同.

当我尝试运行程序时,我遇到了NullPointerException.我已经研究了这可能意味着什么,现在知道这应该是NoObjectException或DereferenceException,但我仍然没有更接近解决问题.

调用Tile类的makeField方法时会出现此异常.此外,我真的试图围绕正确的继承,静态与非静态,公共与私人,以及所有这些相互关联的方式,所以如果这是一个完全的noob问题,我很抱歉.

所以,我有一个主文件,一个Tile超类,以及tile类的两个子类--Bomb和Flat.炸弹是一个带有炸弹的瓷砖,而Flat是任何不是炸弹的瓷砖.

public class MineSweeperMain{
public static void main(String[] args)
{
    Scanner kybd = new Scanner(System.in);
    int dimension;
    Tile[][] gameBoard;

    System.out.print("Enter the dimension of the board you would like to play on:\t");
    dimension = kybd.nextInt();

    gameBoard = Tile.makeField(dimension);
    Tile.printField(gameBoard, dimension);
}

}
Run Code Online (Sandbox Code Playgroud)

//

public class Tile {

static Random rand = new Random();

boolean isBomb;
boolean isRevealed;
int posX, posY;
int noOfAdjacentMines;

public Tile()
{
    isRevealed = false;
}

public static int detectMines(Tile[][] board, int dimensions)
{
    int …
Run Code Online (Sandbox Code Playgroud)

java inheritance class nullpointerexception

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

Smalltalk不会识别声明的临时变量

因此,当谈到Smalltalk时,我是一个完全初出茅庐的人,现在我正在编写一个带GUI的非常简单的应用程序.所有这个应用程序都是从两个输入字段一起添加两个操作数,并在第三个只读输入字段中显示总和.

我在使用VisualWorks识别我已经声明的临时变量时遇到了麻烦.

我尝试使用声明的临时变量突出显示任何行,并且它将声明此类变量尚未声明; 我想将它声明为temp,instance,shared等...它特别奇怪,因为当我通过GUI运行它时,该方法可以被接受甚至读取(虽然我遇到了将变量类型转换为整数的问题)但是如果我想打印或检查具有声明的临时变量的任何行,它会说它不会识别它并且我是否要将其声明为此或那样.

代码:

add
"adds two input fields"

| op1 op2 result |

op1 := #InputOperand1 value asInteger.
op2 := #InputOperand2 value asInteger.

result := op1 + op2.

^result
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

smalltalk visualworks

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

Smalltalk程序内存不足; 通过参考问题传递?

所以我正在开发一个程序,该程序应该"堆积"用户添加到集合中的整数等等.但是,当我尝试访问作为参数传递给函数的Node的左子节点时,我现在遇到了问题.Visual Works耗尽内存......

奇怪的是,在调试器中,我可以看到传递节点的Left子节点已创建并正确分配给传递的节点.但是当我尝试通过源代码访问它时,我得到一个疯狂的内存错误.

这是相应的代码.希望它是可读的

一旦被调用,就会发生错误的函数:

addLeftChildTo: aNode

"Determine Left child of passed node. Set that child's parent node as self. Imprint the index where that value was retrieved from the array."

| temp leftChildIndex |
2 * aNode indexOfNode <= arrayOfInput size
    ifTrue: 
        [leftChildIndex := 2 * aNode indexOfNode.
        aNode left: (arrayOfInput at: leftChildIndex).
        aNode left parentNode: aNode.                   <---VW Runs out of memory and crashes here. This occurs once the debugger dives into the 'left' accessor method of the passed …
Run Code Online (Sandbox Code Playgroud)

smalltalk pass-by-reference binary-heap

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