小编per*_*ter的帖子

是否可以调整持久卷的大小?

我正在Kubernetes上运行MySQL部署但是看起来我的分配空间不够,最初我添加了一个持续的卷,50GB现在我想扩展它100GB.

我已经看到一个持久的卷声明在创建后是不可变的,但我能以某种方式调整持久卷的大小,然后重新创建我的声明吗?

kubernetes google-kubernetes-engine

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

对于动画,将CGPoints从一个视图转换为另一个视图

我正在尝试做一个动画,我将一个CGPoint从一个视图移动到另一个视图,我想找到该点将参考第一个的坐标,这样我就可以做动画了.

所以,假设我在view2中有一个点(24,15)并且我想将它设置为view1,我仍然希望在新视图中保持该点的值,因为我将该点添加为子视图新的视图,但对于动画我需要知道点的位置的值,所以我可以做一个补间.

请参考此图表:

在此输入图像描述

现在这就是我要做的事情:

customObject *lastAction = [undoStack pop];
customDotView *aDot = lastAction.dot;
CGPoint oldPoint = aDot.center;
CGPoint  newPoint = lastAction.point;

newPoint = [lastAction.view convertPoint:newPoint toView:aDot.superview];


CABasicAnimation *anim4 = [CABasicAnimation animationWithKeyPath:@"position"];
anim4.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim4.fromValue = [NSValue valueWithCGPoint:CGPointMake(oldPoint.x, oldPoint.y )];
anim4.toValue = [NSValue valueWithCGPoint:CGPointMake( newPoint.x,  newPoint.y )];
anim4.repeatCount = 0;
anim4.duration = 0.1;
[aDot.layer addAnimation:anim4 forKey:@"position"];


[aDot removeFromSuperview];


[lastAction.view addSubview:aDot];
[lastAction.view bringSubviewToFront:aDot];

aDot.center = newPoint;
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

c objective-c ios

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

使用具有多个名称空间的SimpleXML解析XML

我有这个丑陋的XML,它上面有很多命名空间,当我尝试用simpleXML加载它时,如果我指的是第一个命名空间我会得到一个xml对象,但是跟随其他命名空间的标记不会进入该对象.

我该如何解析这个XML?

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Header>
        <eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0" soap-env:mustUnderstand="1">
            <eb:From>
                <eb:PartyId eb:type="URI">wscompany.com</eb:PartyId>
            </eb:From>
            <eb:To>
                <eb:PartyId eb:type="URI">mysite.com</eb:PartyId>
            </eb:To>
            <eb:CPAId>something</eb:CPAId>
            <eb:ConversationId>moredata.com</eb:ConversationId>
            <eb:Service eb:type="compXML">theservice</eb:Service>
            <eb:Action>theaction</eb:Action>
            <eb:MessageData>
                <eb:MessageId>a certain messageid</eb:MessageId>
                <eb:Timestamp>2009-04-11T18:43:58</eb:Timestamp>
                <eb:RefToMessageId>mid:areference</eb:RefToMessageId>
            </eb:MessageData>
        </eb:MessageHeader>
        <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
            <wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">an impresive binary security toekn</wsse:BinarySecurityToken>
        </wsse:Security>
    </soap-env:Header>
    <soap-env:Body>
        <SessionCreateRS xmlns="http://www.opentravel.org/OTA/2002/11" version="1" status="Approved">
            <ConversationId>the goodbye token</ConversationId>
        </SessionCreateRS>
    </soap-env:Body>
</soap-env:Envelope>
Run Code Online (Sandbox Code Playgroud)

我试图用下面的代码解析它

<?php
$xml = simplexml_load_string($res,NULL,NULL,"http://schemas.xmlsoap.org/soap/envelope/");
?>
Run Code Online (Sandbox Code Playgroud)

但是$ xml对象只包含以下内容

SimpleXMLElement Object
(
    [Header] => SimpleXMLElement Object
        (
        )

    [Body] => SimpleXMLElement Object
        (
        )

)
Run Code Online (Sandbox Code Playgroud)

php soap namespaces simplexml

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

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

如何将整个POST数据转储到ASP.NET中的文件

我目前正在尝试将应用程序从asp.net移植到php,但是我只是碰壁,需要一只手.

我需要将.aspx通过POST收到的所有数据转储到文件中,但我不知道如何做到这一点

有任何想法吗 ?

asp.net postdata request

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

在子视图对其进行操作后,防止父视图接收触摸事件

我在iOS应用程序上遇到了响应者事件链的问题.

问题如下,我在一个更大的视图(正方形)上有一组子视图(气泡),如果我点击按钮,我希望能够显示某个视图,但是如果我点击其他任何地方我想要相同视图隐藏.

问题是当我点击一个气泡时,两个视图(孩子和父母)都在触发,我该如何防止这种情况?

如果孩子已经采取过触摸事件,那不应该结束吗?

My Bubbles正在使用UITapGestureRecognizer识别Tap手势,而父视图(square)使用touchesBegan:方法

此图表说明了我当前具有多个气泡的设置:

在此输入图像描述

码:

@implementation Bubble
...
-(id) initWithFrame: (CGRect) frame {
    UITapGestureRecognizer *singleFingerDTap = [[UITapGestureRecognizer alloc]
                                                initWithTarget:self action:@selector(handleSingleTap:)];
    singleFingerDTap.numberOfTapsRequired = 1;
    [self addGestureRecognizer:singleFingerDTap];

}

-(void) handleSingleTap {
NSLog(@"Bubble tapped, show the view");
}
Run Code Online (Sandbox Code Playgroud)

为了广场

@implementation Square
...
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"square touched, lets hide the view");
}
Run Code Online (Sandbox Code Playgroud)

点击后我在控制台上看到两个NSLog

cocoa-touch objective-c uigesturerecognizer ios

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

如何从SVN repo中读取更改

我正在尝试做一些奇怪的Facebook应用程序,通知开发人员SVN的变化,如新的分支和版本,但要实现这一点,我需要询问SVN已经做了哪些更改以及这些更改的评论,版本,然而,我在tigris.org上为SVN找到的所有电话都谈到了如何更新我的文件等等,我只是想知道是否有办法知道项目树的实际状态以及如何从中查找详细信息一个具体的变化

欢迎任何建议:)

svn facebook

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

jQuery如何进行跨域ajax调用,以及如何使用mootools复制em

在我永恒的内部斗争中,是否留下mootools或跳转到jQuery我在jQuery文档中找到了引起我注意的东西,这就是jQuery可以向不同的域请求JSON,这通常是浏览器禁止的.

我已经看到了跨域的一些变通方法,但从来没有跨域,我真的很兴奋,首先我认为我是服务器相关的但是尝试了一点点我已经看到从jQuery做同样的JSON请求关于Mootools的文档不起作用!

这适用于jQuery:

$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
        function(data){
          $.each(data.items, function(i,item){
            $("<img/>").attr("src", item.media.m).appendTo("#images");
            if ( i == 3 ) return false;
          });
        });
Run Code Online (Sandbox Code Playgroud)

这不是Mootools:

var jsonRequest = new Request.JSON({url: "http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", onComplete: function(person, responseText){
    alert(responseText);
}}).get({});
Run Code Online (Sandbox Code Playgroud)

我该如何复制这种行为?是什么导致的?

jQuery Doc:http: //docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback Mootols Doc:http://mootools.net/docs/Request/Request.JSON

jquery mootools cross-domain

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

使用DQL嵌套条件

现在我已经阅读了所有DQL文档,我仍然有一些疑问,我试图在我的DQL中做一些嵌套的限制,但是玩DQL我似乎无法归档它们

为了让自己更清楚:

我有这个DQL查询

    $q = Doctrine_Query::create()
        ->select('c.nombre,c.webpage')
        ->addSelect('COUNT(m.marca_id) as total_marcas')
        ->from('Corporativos c')
        ->leftJoin('c.Marcas m')
        ->groupBy('c.corporativo_id')
        ->where('ISNULL(c.deleted_at)')
        ->orwhere('c.nombre LIKE :nombre', array(':nombre'=>'%'.$srch))
        ->orWhere('c.nombre LIKE :nombre', array(':nombre'=>'%'.$srch.'%'))
        ->orWhere('c.nombre LIKE :nombre', array(':nombre'=>$srch.'%'))
        ->orderBy('c.nombre ASC')
        ->limit(0,20);
Run Code Online (Sandbox Code Playgroud)

现在这会生成以下MySQL查询:

SELECT c.corporativo_id AS c__corporativo_id, c.nombre AS c__nombre,
c.webpage AS c__webpage, COUNT(m.marca_id) AS m__0 FROM corporativos c
LEFT JOIN marcas m ON c.corporativo_id = m.corporativo_id WHERE
(ISNULL(c.deleted_at) OR c.nombre LIKE :nombre OR c.nombre
LIKE :nombre OR c.nombre LIKE :nombre) GROUP BY c.corporativo_id ORDER
BY c.nombre ASC
Run Code Online (Sandbox Code Playgroud)

但是我得到一组结果,其中deleted_at为null或其他条件已完成,我想使isnull(deleted_at)必须,如果我们在SQL方面讨论查询将如下所示:

SELECT c.corporativo_id …
Run Code Online (Sandbox Code Playgroud)

php doctrine dql

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

创建自定义CALayer实现

我正在尝试学习核心动画以开发某个应用程序,但我需要继承CALayer类,但是我很难让图层自己绘制.

我需要自定义CALayer有一些额外的属性和处理自定义事件(触摸等)但从一开始我实现的基本CALayer不是绘制自己,谁能告诉我我做错了什么?

我有一个MagicSquare

#import "MagicSquare.h"

@implementation MagicSquare


-(id) initWithLayer:(id)layer {
    self = [super initWithLayer:layer];


    self.bounds = CGRectMake(0, 0, 200, 200);
    self.position = CGPointMake(10,10);
    self.cornerRadius = 100;
    self.borderColor = [UIColor redColor].CGColor;
    self.borderWidth = 1.5;

    return self;
}

- (void)drawInContext:(CGContextRef)theContext
{

    NSLog(@"Drawing");
    CGMutablePathRef thePath = CGPathCreateMutable();

    CGPathMoveToPoint(thePath,NULL,15.0f,15.f);
    CGPathAddCurveToPoint(thePath,
                          NULL,
                          15.f,250.0f,
                          295.0f,250.0f,
                          295.0f,15.0f);

    CGContextBeginPath(theContext);
    CGContextAddPath(theContext, thePath );

    CGContextSetLineWidth(theContext,
                          1.0);
    CGContextSetStrokeColorWithColor(theContext,
                                     [UIColor redColor].CGColor);
    CGContextStrokePath(theContext);
    CFRelease(thePath);
}
Run Code Online (Sandbox Code Playgroud)

这就是我试图让它在主控制器上绘制的方式

@implementation BIDViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically …
Run Code Online (Sandbox Code Playgroud)

core-animation ios

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