Objective C的iPhone开发中的"委托"是什么?
我试图将json编码的值从php脚本传递到一个GnuBookTest.js,javascript文件启动一个Bookreader对象,并使用我通过名为"result"的变量传入的值.
php脚本发送的值如下:
<div id="bookreader">
<div id="BookReader" style="left:10px; right:10px; top:30px; bottom:30px;">x</div>
<script type="text/javascript">var result = {"istack":"zi94sm65\/BUCY\/BUCY200707170530PM","leafCount":"14","wArr":"[893,893,893,893,893,893,893,893,893,893,893,893,893,893]","hArr":"[1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155,1155]","leafArr":"[0,1,2,3,4,5,6,7,8,9,10,11,12,13]","sd":"[\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\",\"RIGHT\",\"LEFT\"]"}</script>
<script type="text/javascript" src="http://localhost:8080/application/js/GnuBookTest.js"></script>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
并在GnuBookTest.js文件中我尝试使用如下值:
br = new BookReader();
// Return the width of a given page.
br.getPageWidth = function(index) {
return this.pageW[index];
}
// Return the height of a given page.
br.getPageHeight = function(index) {
return this.pageH[index];
}
br.pageW = JSON.parse(result.wArr);
br.pageH = JSON.parse(result.hArr);
br.leafMap = JSON.parse(result.leafArr);
//istack is an url fragment for location of image files
var istack = result.istack;
.
. …Run Code Online (Sandbox Code Playgroud) 我有从get.rgb(x,y)获得的整数像素,但我没有任何关于如何将其转换为RGBA的线索.例如,-16726016应为Color(0,200,0,255).有小费吗?
我正在尝试解析两个URI,但它并不像我希望的那样直截了当.
URI a = new URI("http://www.foo.com");
URI b = new URI("bar.html");
Run Code Online (Sandbox Code Playgroud)
麻烦a.resolve(b).toString()就是现在"http://www.foo.combar.html".我怎么能逃脱呢?
我正在尝试将一段 Java 代码移植到 .NET 中,该代码采用 Base64 编码的字符串,将其转换为字节数组,然后使用它来制作 X.509 证书以获得 RSA 加密的模数和指数。
这是我要转换的 Java 代码:
byte[] externalPublicKey = Base64.decode("base 64 encoded string");
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(externalPublicKey);
Key publicKey = keyFactory.generatePublic(publicKeySpec);
RSAPublicKey pbrtk = (java.security.interfaces.RSAPublicKey) publicKey;
BigInteger modulus = pbrtk.getModulus();
BigInteger pubExp = pbrtk.getPublicExponent();
Run Code Online (Sandbox Code Playgroud)
我一直试图找出将其转换为 .NET 的最佳方法。到目前为止,我想出了这个:
byte[] bytes = Convert.FromBase64String("base 64 encoded string");
X509Certificate2 x509 = new X509Certificate2(bytes);
RSA rsa = (RSA)x509.PrivateKey;
RSAParameters rsaParams = rsa.ExportParameters(false);
byte[] modulus = rsaParams.Modulus;
byte[] exponent = rsaParams.Exponent;
Run Code Online (Sandbox Code Playgroud)
在我看来它应该可以工作,但是当我使用 Java …
根据Java线程状态信息调用wait()将导致线程进入BLOCKED状态.但是,这段代码将在WAITING状态的Thread中生成(在被调用之后).
class bThread extends Thread {
public synchronized void run() {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我有什么不对吗?任何人都可以向我解释这种行为吗?任何帮助,将不胜感激!
嗯,为什么没有工作?试图用这个来切换ul:
$("#others").children(".btn").click(function(){
if ($(this).children("ul").is(":hidden"))
{
$(this).children("ul").slideDown();
} else {
$(this).children("ul").slideUp();
}
});
Run Code Online (Sandbox Code Playgroud)
和:
<div id="other">
<div id="galleries">
<a href="#" class="btn">Galleries >> </a>
<ul id="select_gallery">
...
</ul>
</div>
<div id="events">
<a href="#" class="btn">Events >> </a>
<ul id="select_event">
...
</ul>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) class MyClass {
function __constructor($A,$B,$C) {
echo("$A $B $C");
}
}
$MC=new MyClass('Hello','World','!');
Run Code Online (Sandbox Code Playgroud)
我的参数似乎没有通过构造函数...我这样做错了吗?
是否有可能在Emacs中的PHP文件中识别未使用的变量?
使用其他语言,可以使用flymake等工具.我已经启用了Flymake,以示对我的PHP文件的语法错误的飞行,但它仍然是令人沮丧的是PHP逻辑错误,有时由于类似的情况:
<?php
$foo = whatever();
$bar = something($fo);
...
Run Code Online (Sandbox Code Playgroud)
请注意$ foo上的错字将导致开发人员的头痛和他过度使用咖啡.
更新:
在Pascal和Gabor的提示之后,我在php.ini中设置:
error_reporting = E_ALL | E_STRICT
Run Code Online (Sandbox Code Playgroud)
当我从命令行运行php时,我现在能够看到有关未定义变量的通知(带或不带-l选项):
> php -r '$foo = 3; echo $fo;'
PHP Notice: Undefined variable: fo in Command line code on line 1
> php -r '$foo = 3; echo $fo;' -l
PHP Notice: Undefined variable: fo in Command line code on line 1
Run Code Online (Sandbox Code Playgroud)
这就是我目前在.emacs中使用的内容.它完全没有解析错误,但我仍然无法匹配通知,但:(
;; FlyMake for Php(需要'flymake)
(defun flymake-php-init ()
"Use php to check the syntax …Run Code Online (Sandbox Code Playgroud) 我只是设置了一个特大型重型计算EC2实例,将其抛给我的遗传算法问题,希望加快速度.
这个实例有8个Intel Xeon处理器(每个大约2.4Ghz)和7 GAG RAM.
在我的机器上,我有一个英特尔酷睿双核处理器,并且matlab能够通过runinng使用我的两个核心:
matlabpool open 2
Run Code Online (Sandbox Code Playgroud)
但是在EC2实例上,matlab只能检测到8个处理器中的1个,如果我尝试运行:
matlabpool open 8
Run Code Online (Sandbox Code Playgroud)
我得到一个错误,说ClusterSize是1,因为我的CPU上只有1个核心.没错,每个CPU上只有1个核心,但我在给定的EC2实例上有8个CPU!
因此,与我的机器和ec2实例的不同之处在于,我在本地单个处理器上拥有2个内核,而EC2实例有8个不同的处理器.
我的问题是,如何让matlab与这8个处理器一起工作?
我找到了这篇论文,但似乎与使用多个EC2实例设置matlab(与同一个实例上的多个处理器无关,EC2与否),这不是我的问题.
任何帮助赞赏!
注意:关键点不是EC2,我正在远程操作并在其上运行matlab,就好像它是任何其他机器一样.关键是我无法让matlab看到8个处理器!
java ×4
php ×3
.net ×1
amazon-ec2 ×1
c# ×1
colors ×1
concurrency ×1
cryptography ×1
delegates ×1
emacs ×1
encode ×1
flymake ×1
image ×1
ios ×1
iphone ×1
javascript ×1
jquery ×1
json ×1
matlab ×1
multicore ×1
objective-c ×1
parsing ×1
resolve ×1
url ×1