小编And*_*een的帖子

是否可以用x86汇编语言编写if语句?

是否有可能在x86汇编语言中模仿if-statment(使用masm语法)?我想在x86汇编语言中做这样的事情,但我不确定我应该使用哪个运算符来模仿if-else语句.我应该使用jl指令,cmp指令还是其他指令?

int i = 2;
int j = 3;
if(i > j){
    i = 1;
}
else{
    i = 4;
}
Run Code Online (Sandbox Code Playgroud)

x86 assembly masm

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

获取 x86 汇编语言中变量的位置

在x86汇编语言中,是否可以确定变量在内存中的位置?

在这里,我试图找到 X 在内存中的位置,以便我可以找到紧随其后的地址存储的值。

.686p
.model flat,stdcall
.stack 2048

.data
X   byte         "1234"

ExitProcess proto, exitcode:dword
.code
start:

mov ah, X;
;now how can I obtain the location of X in memory?

invoke  ExitProcess, 0
end start ;what does the end statement do?
Run Code Online (Sandbox Code Playgroud)

x86 assembly

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

鼠标悬停时显示下拉菜单

每当有人将鼠标悬停在图像上时,我都会尝试下拉菜单.

    <div>
        <img id="whoimg" onmouseover="forImg(this)" src="/static/images/whoisitfor.png" height="70" style="cursor:pointer;">
    </div>

    <div style="position: absolute; right:30px; top: 23px;">
        <span style="font-weight: bold;font-size:30px; color: #C4066B;">FOR</span>
    </div>

</div>
Run Code Online (Sandbox Code Playgroud)

我能写onmouseover功能.但由于我是网络开发的新手,我不知道接下来该做什么.我有三个水平放置的图像,包括上面的一个.

function forImg()
{
alert("FOR");
}
Run Code Online (Sandbox Code Playgroud)

我尝试过javascript,但我没有在哪里.不知道该怎么办......请帮帮我

html javascript css jquery web-applications

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

使用分隔符拆分字符串数组

在JavaScript中,是否可以使用分隔符在多维字符串数组中拆分每个字符串?我正在尝试使用字符串分隔符拆分多维数组的字符串,但我还不知道如何在不使用多个for循环的情况下迭代多维数组.

var theArray = [["Split,each"],["string, in"],["this, array"]];
Run Code Online (Sandbox Code Playgroud)

据我所知,不可能将该string.split(",")方法应用于多维数组.我需要找到一种解决方法,因为此代码无效:

alert([["Split,each"],["string, in"],["this","array"]].split(","));
Run Code Online (Sandbox Code Playgroud)

javascript string split

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

是否可以在Haskell中递归地定义列表?

在几种编程语言(包括JavaScript,Python和Ruby)中,可以在其自身内部放置一个列表,这在使用列表表示无限详细的分形时非常有用.但是,我尝试在Haskell中执行此操作,但它没有按预期工作:

--aList!!0!!0!!1 should be 1, since aList is recursively defined: the first element of aList is aList.
main = putStrLn $ show $ aList!!0!!0!!1

aList = [aList, 1]
Run Code Online (Sandbox Code Playgroud)

1程序产生了这个编译错误,而不是打印:

[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:3:12:
    Occurs check: cannot construct the infinite type: t0 = [t0]
    In the expression: aList
    In the expression: [aList, 1]
    In an equation for `aList': aList = [aList, 1]
Run Code Online (Sandbox Code Playgroud)

是否有可能在Haskell中放入一个列表,因为我试图在这里做?

haskell

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

在NODE.JS中重新加载变量值

我终于意识到我需要在这个上面输入大的'StackOverflow'枪.这是我的代码,因为这个修复程序继续躲避我

var express = require('express'),
    fs = require('fs'),
    http = require('http');

var ppm = JSON.parse(fs.readFileSync('./data/ppm.json', 'utf8'));

var timestamp = {"timestamp" : ppm.RTPPMDataMsgV1.timestamp };

var app = express()
    .use(express.bodyParser())
    .use(express.static('public'));

app.all('/', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    next();
});

app.get('/ppm/timestamp', function (req, res) {
    res.send(timestamp);
});

app.get('/*', function (req, res) {
    res.json(404, {status: 'not found'});
});

http.createServer(app).listen(3000, function () {

    setInterval(function(){
        var ppm = JSON.parse(fs.readFileSync('./data/ppm.json', 'utf8'));
        var timestamp = {"timestamp" : ppm.RTPPMDataMsgV1.timestamp };
        console.log("File changed");
    }, 30000);

    console.log("Server ready …
Run Code Online (Sandbox Code Playgroud)

javascript json node.js express

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

Java,将字符串转换为整数然后将所有整数添加到一起

我需要从一个字符串中添加8个数字.Eg如果有人输入说1234它会将数字加在一起1 + 2 + 3 + 4 = 10然后1 + 1 = 2.我到目前为止已经这样做了.我无法弄清楚如何使用for循环添加这些数字.

String num2;     
String num3;   
num2 = (jTextField1.getText());
num3 = num2.replaceAll("[/:.,-0]", "");

String[] result = num3.split("");

int inte = Integer.parseInt(num3);

for (int i = 0; i < 8; i++){

// Stuck

}
Run Code Online (Sandbox Code Playgroud)

java

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

表达式的类型必须是数组类型,但它将解析为Object

我希望这能编译,但我不断得到错误"表达式的类型必须是数组类型,但它被解析为Object".有一个简单的解决方法吗?

public class NodeTest {
    public static void main(String[] args) {

    Object[] arr = new Object[5]; // each element of object will be an array of integers.
    for(int i = 0; i < 5; i++){
        int[][] a = new int[2*(i+1)][2*(i+1)];
        arr[i] = a;
    }
    arr[0][0][0] = 0; //error here
}
Run Code Online (Sandbox Code Playgroud)

}

java arrays object

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

使用shell脚本写入程序的标准输入

我想从Unix(bash)命令行向以下Java程序发送文本输入,以便它将打印输入的文本.如何编写一个shell脚本,将字符串"Print this"发送到Java程序?

import java.util.Scanner;
public class ReadStuff{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter some text:");
        System.out.println(scan.nextLine());
    }
}
Run Code Online (Sandbox Code Playgroud)

java unix bash

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

Haxe中方法内的条件编译

在Haxe编程语言中,是否可以在方法定义中检测目标语言,如下所示?

class Test {
    static function main() {
        trace("Hello World !");
        #if java
            trace("This is compiled to Java");
        #elseif js
            trace("This is compiled to Javascript");
    }
}
Run Code Online (Sandbox Code Playgroud)

haxe

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

标签 统计

java ×3

javascript ×3

assembly ×2

x86 ×2

arrays ×1

bash ×1

css ×1

express ×1

haskell ×1

haxe ×1

html ×1

jquery ×1

json ×1

masm ×1

node.js ×1

object ×1

split ×1

string ×1

unix ×1

web-applications ×1