小编Pau*_*ulG的帖子

你如何解析MWS GetMatchingProduct中的关系?

数据:

<Relationships>
      <ns2:VariationChild>
        <Identifiers>
          <MarketplaceASIN>
            <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
            <ASIN>B002KT3XQC</ASIN>
          </MarketplaceASIN>
        </Identifiers>
        <ns2:Color>Black</ns2:Color>
        <ns2:Size>Small</ns2:Size>
      </ns2:VariationChild>
      <ns2:VariationChild>
        <Identifiers>
          <MarketplaceASIN>
            <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
            <ASIN>B002KT3XQW</ASIN>
          </MarketplaceASIN>
        </Identifiers>
        <ns2:Color>Black</ns2:Color>
        <ns2:Size>Medium</ns2:Size>
      </ns2:VariationChild>
</Relationships>
Run Code Online (Sandbox Code Playgroud)

代码:

$data = simplexml_load_string($response);
foreach($data->GetMatchingProductResult AS $GetMatchingProductResult){
     $Product = $GetMatchingProductResult->Product;
     $Relationships = $Product->Relationships;

     foreach($Relationships->children('ns2', true)->VariationChild AS $VariationChild){

          $Identifiers = $VariationChild->Identifiers;
               $MarketplaceASIN = $Identifiers->MarketplaceASIN;
                    $MarketplaceId = $MarketplaceASIN->MarketplaceId;
                    $ASIN = $MarketplaceASIN->ASIN;

                    echo "$ASIN<br />";

     }
}
Run Code Online (Sandbox Code Playgroud)

这回复了回归,但没有数据,所以它实际上循环遍历XML.但是,我尝试的任何内容都不会实际返回$ ASIN变量中的数据.这是因为命名空间还是simpleXML,还是我完全错过了其他东西?

编辑:尝试过其他方法

foreach($Relationships->children('http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd', true)->VariationChild AS $VariationChild){

     $Identifiers           = $VariationChild->Identifiers;
          $MarketplaceASIN  = $Identifiers->MarketplaceASIN;
               $MarketplaceId   = $MarketplaceASIN->MarketplaceId;
               $ASIN            = $MarketplaceASIN->ASIN;

               echo "[$ASIN]<br />";

} …
Run Code Online (Sandbox Code Playgroud)

php xml amazon-mws

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

如何使用intuit(quickbook)处理信用卡?

如何使用处理信用卡

大家好,

我正在为我的客户做购物车项目,其中一项要求是使用intuit(http://www.intuit.com/)产品以真实方式处理信用卡,因为客户要将在线商店与quickbook集成在后期.

我的问题是,直觉产品纯粹是支付网关解决方案吗?在这个阶段,我们没有参与任何关于quickbook的开发工作,我们的主要关注点是提供高质量的购物车解决方案,我们阅读了关于intuit的网上商店解决方案,但似乎这需要在桌面上运行的quickbook同步数据?

现在很困惑,如果有人有过经验,请帮忙!

payment-gateway intuit

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

线程安全StreamWriter C#怎么做?2

所以这是我上一个问题的延续 - 所以问题是"构建一个线程安全的程序的最佳方法是什么,它需要将双值写入文件.如果通过streamwriter保存值的函数是多线程调用的?最好的方法是什么?"

我修改了一些在MSDN上找到的代码,以下怎么样?这个正确地将所有内容写入文件.

namespace SafeThread
{
    class Program
    {
        static void Main()
        {
            Threading threader = new Threading();

            AutoResetEvent autoEvent = new AutoResetEvent(false);

            Thread regularThread =
                new Thread(new ThreadStart(threader.ThreadMethod));
            regularThread.Start();

            ThreadPool.QueueUserWorkItem(new WaitCallback(threader.WorkMethod),
                autoEvent);

            // Wait for foreground thread to end.
            regularThread.Join();

            // Wait for background thread to end.
            autoEvent.WaitOne();
        }
    }


    class Threading
    {
        List<double> Values = new List<double>();
        static readonly Object locker = new Object();
        StreamWriter writer = new StreamWriter("file");
        static int bulkCount = 0;
        static int bulkSize …
Run Code Online (Sandbox Code Playgroud)

c# thread-safety writer

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

如何构建通用的ios静态库

我正在尝试构建一个可以与ios3.x和ios4.x一起使用的静态库.我可以使用ios3.0构建一个静态库,它可以在ios3.0中与另一个项目一起使用,但不能在ios4中编译.从ios4到ios3也是如此.

以下是重新创建的方法:

  1. 打开XCode 3.2.4并启动一个名为Library4的Cocoa Touch静态库的新项目
  2. 单击classes文件夹并创建一个名为"TestViewController"的新UIViewController
  3. 右键单击Frameworks文件夹,添加现有框架,选择UIKit
  4. 在左侧面板中,展开目标,右键单击我的库目标,然后单击获取信息.更改为所有配置,将基本sdk更改为iphone模拟器4.0,将ios部署目标更改为ios3.0
  5. 单击带有二进制文件的链接库文件夹.在右侧窗格中,将两者的角色更改为"Weak"
  6. 建立图书馆
  7. 打开Xcode 3.2.2并启动一个名为Library4Test的基于View的新应用程序
  8. 将TestViewController.h复制到classes文件夹
  9. 将libLibrary4.a文件复制到frameworks文件夹.它会自动添加到目标的链接器阶段
  10. 右键单击Library4Test Target并单击获取信息.在其他链接器标志中,添加"-ObjC"和"-all_load"
  11. 在app delegate header中添加Import"TestViewController.h"
  12. 在app delegate header的应用程序的didFinishLaunchingWithOptions方法中添加

    TestViewController*test = [TestViewController alloc] init;

  13. 使用ios3.0模拟器进行编译

当我编译时,我得到:

Ld build/Debug-iphonesimulator/library4Test.app/library4Test normal i386
cd /Users/test/Documents/Testing/library4Test
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/GrandpaIPhone/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/GrandpaIPhone/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/GrandpaIPhone/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/GrandpaIPhone/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk -L/Users/test/Documents/Testing/library4Test/build/Debug-iphonesimulator -L/Users/test/Documents/Testing/library4Test -F/Users/test/Documents/Testing/library4Test/build/Debug-iphonesimulator -filelist /Users/test/Documents/Testing/library4Test/build/library4Test.build/Debug-iphonesimulator/library4Test.build/Objects-normal/i386/library4Test.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -llibrary4_1 -o /Users/test/Documents/Testing/library4Test/build/Debug-iphonesimulator/library4Test.app/library4Test

Undefined symbols:
"_objc_msgSendSuper2", referenced from:
-TestViewController didReceiveMemoryWarning in liblibrary4_1.a(TestViewController.o)
-TestViewController viewDidUnload in liblibrary4_1.a(TestViewController.o)
-TestViewController dealloc in liblibrary4_1.a(TestViewController.o)
"__objc_empty_vtable", referenced …
Run Code Online (Sandbox Code Playgroud)

iphone xcode static-libraries universal-binary ios

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

EWS:如何更新EmailMessage的IsRead属性

如何更新使用EWS或其他方法的IsRead属性EmailMessage

只是设置mail.IsRead=true似乎没有持续.

c# asp.net exchangewebservices

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

动态添加Angular指令

我对角度JS很新,我发现它是一个陡峭的学习曲线,我觉得我真的错过了这里的重点但是这里有:

我想从控制器向我的页面添加一个指令.所以我想如果我将指令标签添加到页面,指令和相关的控制器/模板等都会添加它.在阅读了$ compile方法之后,我认为这将用于将此指令绑定到其新创建的标记.这部分在下面被注释掉了,但无论是否有这个,我需要登录这个词出现,它的控制器来控制它?

当加载时指针标记在页面上时,我可以在web上找到许多相似的例子,并且可以使它们正常工作,所以这就是认为它与$ compile方法有关 - 我错过了什么?

HTML:

<div ng-app="application" ng-controller="myController"></div>
Run Code Online (Sandbox Code Playgroud)

JS:

var myApp = angular.module('application', []);

myApp.controller('myController', ['$scope', function($scope) {

        function showLoginDirective () {
            $scope.login = angular.element(document.createElement('login'));

            angular.element(document.body).append($scope.login);
        };

        showLoginDirective();
    }
]);

angular.module('directives', [])
    .directive('login', function($compile) {
        return {
            restrict: 'E',
            controller: 'LoginController',
            template: '<div>login</div>',
            link: function(scope, element, attrs) {
                //$compile(element.contents())(scope.$new);
                console.log('should I not have a div containing login controlled by loginController at this point?');
            }
        };
});
Run Code Online (Sandbox Code Playgroud)

上面的代码也在这里:http://jsfiddle.net/d5n6L/7/

javascript angularjs angularjs-directive

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

Kubernetes服务连接耗尽

Kubernetes是否支持连接耗尽?例如,对于某些部署,我将使用新版本的webapp容器推出新的容器版本.在连接排放模式下,Kubernetes应该从新映像中启动新容器,将所有新流量用于服务此新实例.但旧实例将存在一段时间,并且能够发送对现有连接的响应.

kubernetes

8
推荐指数
2
解决办法
3916
查看次数

Amazon DynamoDB的Spring数据

我们开始使用亚马逊网络服务.因为我正在寻找一个Spring库,但找不到任何东西.这是一个案例,已经做出决定不包括此功能或没有人提供任何代码.有没有兴趣有spring-data-dynamodb?

spring spring-data amazon-dynamodb

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

有没有办法在AWS账户中核算所有AWS资源?

我有一个AWS账户,其中多个所有者设置了多个EC2实例,负载均衡器,目标组,安全组等。我们使用terraform进行设置,但是有时由于腐败,状态会变得不一致。当前的恢复机制是手动销毁特定所有者拥有的该帐户中的所有资源。是否有一种简便的方法可以核算属于特定所有者的AWS账户中的所有资源?

amazon-web-services terraform

8
推荐指数
3
解决办法
4760
查看次数

使用xmlwriter附加xml文件

感谢早先建议使用"XMLWriter",每次创建新的xml文件,所以我使用xmldoc加载xml文件然后追加到该文件中,这是我的代码,但它抛出异常说"这个文档已经有'DocumentElement'节点."

//Append to xml file

XmlDocument doc = new XmlDocument();
doc.Load(@"c:\\test.xml");
using (XmlWriter xmlWrite = doc.CreateNavigator().AppendChild())
{
    xmlWrite.WriteStartElement("image name=",Name);
    xmlWrite.WriteElementString("width", widthValue[1]);
    xmlWrite.WriteElementString("Height", heightValue[1]);
    xmlWrite.WriteElementString("file-size", FileSizeValue[1]);
    xmlWrite.WriteElementString("file-format", FileFormatValue[1]);
    xmlWrite.WriteElementString("resolution", ResolutionValue[1]);
    xmlWrite.Close();
}
Run Code Online (Sandbox Code Playgroud)

这是我的示例test.xml

<job-metadata>
    <slug>730s_Sales/CupWinner_0111</slug>
    <locations>Africa</locations>
    <primary-location>Africa</primary-location>
    <reporter>Leigh Sales</reporter>
    <genre>Current</genre>
    <copyright>CBS</copyright>
    <autopublish>true</autopublish> 
</job-metadata>
Run Code Online (Sandbox Code Playgroud)

我试图像下面的xml一样追加

<job-metadata>
    <slug>730s_Sales/CupWinner_0111</slug>
    <locations>Africa</locations>
    <primary-location>Africa</primary-location>
    <reporter>Leigh Sales</reporter>
    <genre>Current</genre>
    <copyright>CBS</copyright>
    <autopublish>true</autopublish> 
    <image name="557684_20111101-730s_SalesCupWinner_0111_80x60.jpg">
        <width>80</width>
        <height>60</height>
        <file-size>7045</file-size>
        <file-format>JPEG Baseline</file-format>
        <resolution>72</resolution>
        <custom-name>newsthumbnail</custom-name>
    </image>
</job-metadata>
Run Code Online (Sandbox Code Playgroud)

提前致谢

c# xml

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