这段代码是由我们的老师给我们的,但很遗憾,没有解释.我们刚刚在课堂上试过这个,然后被解雇了.
如果有人能够彻底向我解释这段代码,那将会非常有帮助.提前致谢.
-module(pingpong).
-compile(export_all).
start_pong() ->
register(pong, spawn(pingpong,pong,[])).
pong() ->
receive
finished ->
io:format("Pong finished ~n");
{ping, Ping_Pid} ->
io:format("i am the receiver ~n"),
Ping_Pid ! pong,
pong()
end.
start_ping(Pong_Node) ->
spawn(pingpong, ping, [3, Pong_Node]).
ping(0, Pong_Node) ->
{pong, Pong_Node} ! finished,
io:format("Pong finished ~n");
ping(N, Pong_Node) ->
{pong, Pong_Node} ! {ping, self()},
receive
pong ->
io:format("i am the sender ~n")
end,
ping(N-1,Pong_Node).
Run Code Online (Sandbox Code Playgroud) 我有这个用于在java中的jpeg图像中编码数据.我正在将文本转换为二进制形式,并将其插入LSB(取决于用户选择的内容.1,2,3,4),每个像素中的RGB从(0,0)到(宽度,高度) .
outer:
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++){
Color c = new Color(image.getRGB(j, i));
int red = binaryToInteger(insertMessage(integerToBinary((int)(c.getRed())),numLSB));
int green = binaryToInteger(insertMessage(integerToBinary((int)(c.getGreen())),numLSB));
int blue = binaryToInteger(insertMessage(integerToBinary((int)(c.getBlue())),numLSB));
Color newColor = new Color(red,green,blue);
image.setRGB(j,i,newColor.getRGB());
}
}
gui.appendStatus("Binarized message is: " + binarizedMessage);
File output = new File(gui.getOutput()+".jpg");
ImageIO.write(image, "png", output);
Run Code Online (Sandbox Code Playgroud)
目前,我正在把它写成一个png,它运作良好,但我希望在jpeg中做到这一点.我成功地在png中获取这些数据.但正如预期的那样,jpeg失败了.
我能够解码所写图像中的隐藏位,并在选择正确的LSB时看到消息.
我目前正在阅读有关JPEG隐写术的内容,但我没有准确地了解它应该如何启动它.我见过算法,也没有帮助我.
我看到一个没有找到任何主类的代码.
我是否必须在我的应用程序中调用它?修改它?我怎么解码?
我有这个复选框,每当我选中复选框时,如何禁用表(禁用表中的所有输入字段)?
<label><input type="checkbox" name="view" value="d">N/A</label>
Run Code Online (Sandbox Code Playgroud)
是否可以使用纯JavaScript而不是jQuery.
这是现在的代码
var elems = document.getElementById('table-id').querySelectorAll('input,select,textarea');
document.getElementById('check').onchange = function () {
if (document.getElementById('check').checked) {
for (var i = 0; i < elems.length; i++) {
elems[i].disabled = true;
}
} else {
for (var i = 0; i < elems.length; i++) {
elems[i].disabled = false;
}
}
}
Run Code Online (Sandbox Code Playgroud)
和桌子
<table id='table-id' border="1">
Run Code Online (Sandbox Code Playgroud)
但它显示如下错误:
未捕获的TypeError:无法读取null的属性'querySelectorAll'
我有一个哈希.
'20111124' => undef,
'20111125' => undef,
'20111129' => undef,
'20111130' => '126002',
'20111201' => '126002',
'20111202' => '126002',
'20111205' => '126002',
'20111206' => '126002',
'20111207' => '126002'
Run Code Online (Sandbox Code Playgroud)
我想得到第一个有价值的键.
我已经尝试迭代哈希,但由于哈希有时很大,获得第一个具有定义值的键的最快方法是什么?
compression ×1
concurrency ×1
erlang ×1
hash ×1
html-table ×1
image ×1
java ×1
javascript ×1
jpeg ×1
perl ×1