我正在运行这段代码
require_once 'windowsazure\windowsazure.php';
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Blob\Models\CreateContainerOptions;
use WindowsAzure\Blob\Models\PublicAccessType;
use WindowsAzure\Common\ServiceException;
try {
$connectionString = "DefaultEndpointsProtocol=http;AccountName=xxx;AccountKey=yyyy";
// Create blob REST proxy.
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
$createContainerOptions = new CreateContainerOptions();
$createContainerOptions->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);
// Set container metadata
$createContainerOptions->addMetaData("key1", "value1");
$createContainerOptions->addMetaData("key2", "value2");
// List blobs.
$blob_list = $blobRestProxy->listBlobs("mycontainer");
$blobs = $blob_list->getBlobs();
foreach($blobs as $blob)
{
echo $blob->getName().": ".$blob->getUrl()."<br />";
}
// Create container.
$blobRestProxy->createContainer("phpcontainer", $createContainerOptions);
}
catch(ServiceException $e) {
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code . ": " . $error_message . "<br/>";
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用此链接集成Facebook android sdk .一切都运行得很完美,除了我在尝试获取email登录用户时遇到一个JSONException .
下面是我得到的logcat,
07-28 16:22:37.420:W/System.err(15793):org.json.JSONException:没有电子邮件的值07-28 16:22:37.421:W/System.err(15793):at org.json .JSONObject.get(JSONObject.java:354)07-28 16:22:37.421:W/System.err(15793):at org.json.JSONObject.getString(JSONObject.java:510)07-28 16:22 :37.421:W/System.err(15793):at in.airangle.foodapp.activities.TestActivity $ 1 $ 1.onCompleted(TestActivity.java:83)07-28 16:22:37.421:W/System.err(15793) :at com.facebook.GraphRequest $ 1.onCompleted(GraphRequest.java:295)07-28 16:22:37.421:W/System.err(15793):at com.facebook.GraphRequest $ 5.run(GraphRequest.java:1243 )07-28 16:22:37.421:W/System.err(15793):at android.os.Handler.handleCallback(Handler.java:615)07-28 16:22:37.421:W/System.err(15793) ):在android.os.Handler.dispatchMessage(Handler.java:92)07-28 16:22:37.422:W/System.err(15793):在android.os.Looper.loop(Looper.java:153)07-28 16:22:37.422:W/System.err(15793):at android.app.ActivityThread.main (ActivityThread.java:5000)07-28 16:22:37.422:W/System.err(15793):at java.lang.reflect.Method.invokeNative(Native Method)07-28 16:22:37.422:W/System.err(15793):at java.lang.reflect.Method.invoke(Method.java:511)07-28 16:22:37.422:W/System.err(15793):at com.android.internal.os .ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:821)07-28 16:22:37.423:W/System.err(15793):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 07-28 16:22:37.423:W/System.err(15793):at dalvik.system.NativeStart.main(Native Method)main(ActivityThread.java:5000)07-28 16:22:37.422:W/System.err(15793):at java.lang.reflect.Method.invokeNative(Native Method)07-28 16:22:37.422:W /System.err(15793):at java.lang.reflect.Method.invoke(Method.java:511)07-28 16:22:37.422:W/System.err(15793):at com.android.internal. os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:821)07-28 16:22:37.423:W/System.err(15793):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584 )07-28 16:22:37.423:W/System.err(15793):at dalvik.system.NativeStart.main(Native Method)main(ActivityThread.java:5000)07-28 16:22:37.422:W/System.err(15793):at java.lang.reflect.Method.invokeNative(Native Method)07-28 16:22:37.422:W /System.err(15793):at …
我有这个模型app/models/product.php:
class Product extends AppModel
{
var $hasAndBelongsToMany = 'WishList';
var $actAs = array('Domainable');
function beforeFind($query)
{
echo "A";
}
}
Run Code Online (Sandbox Code Playgroud)
哪个使用此行为app/models/behaviors/Domainable.php:
class DomainableBehavior extends ModelBehavior
{
function beforeFind(&$model, $query)
{
echo "B";
}
}
Run Code Online (Sandbox Code Playgroud)
当我查看产品页面时,A回显但B不回显.我没有错.
我甚至认为行为根本没有加载.
我将文件权限设置Domainable.php为0777- 仍然不起作用,因此不是权限问题.
我换了一行:
var $actAs = array('Domainable');
Run Code Online (Sandbox Code Playgroud)
至:
var $actAs = array('does-not-exist');
Run Code Online (Sandbox Code Playgroud)
我没有区别.没错.
首先,我不明白为什么:如果没有加载Behavior,它就不会给我一些错误信息,原因如:"not found"或"access denied".这会产生错误吗?
我的Hadoop文件系统中有一个文件,我需要创建一个InputStream对象,以便将其作为输入参数传递给as ApiMethod(inputstreamObject)。
我正在使用《权威指南》中提到的以下方法来创建输入流对象,但不起作用。
class test {
static {
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory()); }
InputStream in = null;
try {
in = new URL("hdfs://host/path").openStream();
IOUtils.copyBytes(in, System.out, 4096, false);
Object = new ApiMethod(in);
} finally {
IOUtils.closeStream(in); }
}
Run Code Online (Sandbox Code Playgroud)
请帮忙。