mutableCopyWithZone,复制NSMutableArray?(mutableCopyWithZone, copy NSMutableArray?)

我试图做一个包含5个实例变量的行星对象的mutableCopy(其中之一是一个字符串文字的NSMutableArray。我的问题是,我不确定如何将newPlanet>数据设置为self> data的副本,有道理?

-(id) mutableCopyWithZone: (NSZone *) zone {
    Planet *newPlanet = [[Planet allocWithZone:zone] init];
    NSLog(@"_mutableCopy: %@", [newPlanet self]);
    [newPlanet setName:name];
    [newPlanet setType:type];
    [newPlanet setMass:mass];
    [newPlanet setIndex:index];

    // NSMutableArray *data; HOW TO: newPlanet>data = self>data? 

    return(newPlanet);
}

EDIT_001:

基于Chuck&bbum的评论,我更新了我的方法并添加了以下内容......

@property(retain) NSMutableArray *data;
@synthesize data;

-(id) mutableCopyWithZone: (NSZone *) zone {
    Planet *newPlanet = [[Planet allocWithZone:zone] init];
    NSLog(@"_mutableCopy: %@", [newPlanet self]);
    [newPlanet setName:name];
    [newPlanet setType:type];
    [newPlanet setMass:mass];
    [newPlanet setIndex:index];

    NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone];
    [newPlanet setData: copiedArray];
    [copiedArray release];

    return(newPlanet);
}

非常感激

加里


I a trying to make a mutableCopy of a planet object that contains 5 instance variables (one of them being an NSMutableArray of string literals. My problem is that I am unsure how to set the newPlanet>data to a copy of self>data, does that make sense?

-(id) mutableCopyWithZone: (NSZone *) zone {
    Planet *newPlanet = [[Planet allocWithZone:zone] init];
    NSLog(@"_mutableCopy: %@", [newPlanet self]);
    [newPlanet setName:name];
    [newPlanet setType:type];
    [newPlanet setMass:mass];
    [newPlanet setIndex:index];

    // NSMutableArray *data; HOW TO: newPlanet>data = self>data? 

    return(newPlanet);
}

EDIT_001:

Based on the comments by Chuck & bbum I updated my method and added the following ...

@property(retain) NSMutableArray *data;
@synthesize data;

.

-(id) mutableCopyWithZone: (NSZone *) zone {
    Planet *newPlanet = [[Planet allocWithZone:zone] init];
    NSLog(@"_mutableCopy: %@", [newPlanet self]);
    [newPlanet setName:name];
    [newPlanet setType:type];
    [newPlanet setMass:mass];
    [newPlanet setIndex:index];

    NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone];
    [newPlanet setData: copiedArray];
    [copiedArray release];

    return(newPlanet);
}

much appreciated

gary


原文:https://stackoverflow.com/questions/2015943
2022-05-15 10:05

满意答案

该消息意味着,在管道内的复制活动中,使用typeProperties(源和接收器的对等体)中的executionLocation属性来指定区域,如“executionLocation”:“East US”。 请参阅此处的文档: https//docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement


The message means, in the copy activity within the pipeline, use the executionLocation property within typeProperties (peer of source and sink) to specify the region, like "executionLocation": "East US". See docs here: https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement

相关问答

更多

无法检测数据源位置。(Can't detect data source location. Please specify ExecutionLocation in CopyActivity)

该消息意味着,在管道内的复制活动中,使用typeProperties(源和接收器的对等体)中的executionLocation属性来指定区域,如“executionLocation”:“East US”。 请参阅此处的文档: https : //docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement...

摆脱“当前位置没有可用的源代码”。(Getting rid of “There is no source code available for the current location.”)

查看某些源文件是否被意外排除。 执行解决方案的属性,并查看“常见属性”下的“调试源文件”部分。 See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties.

SAP BusinessObjects Crystal Reports - 数据源来自哪里?(SAP BusinessObjects Crystal Reports — Where does the data source come from?)

不幸的是,这个答案比Crystal Reports&BIRT更适合我们的企业架构。 由于缺乏文档和对内存的普遍依赖,直到今天我才知道所有数据库服务器都在组织的LDAP中注册,并且以这种方式查找。 解释为什么我从来没有看到tnsnames.ora,为什么没有配置信息没有显示在任何地方,但似乎没有被缓存。 世界再次合理。 Unfortunately, this answer has more to do with our Enterprise architecture than Crystal Rep...

如何检查Crystal Reports中的数据源是否为空(How to check if data source is empty in Crystal Reports)

首先看一下你的问题似乎问题在于ToText函数,其中参数更多。 您的公式似乎是您在totext中使用dates ,因此请查看文档以更正语法。 http://pic.dhe.ibm.com/infocenter/rsawshlp/v7r5m0/index.jsp?topic=%2Fcom.businessobjects.integration.eclipse.designer.doc%2Fhtml%2Ftopic666.html 如果您正在尝试特定格式...更新您的问题并告诉我 Problem so...

如何使用相同的数据源发布多个Lightswitch HTML项目(How to publish multiple Lightswitch HTML projects using the same data source)

希望这会有所帮助,如果不让我知道: 在发布窗口期间检查以下详细信息: 发布设置 - 网站名称与原始名称不同 安全设置 - HTTPS - 确保将此设置为无HTTPS,除非您拥有有效的数字签名 数据连接 - 数据连接 - 选中此项设置为“更新到现有数据库”而不是“生成一个名为”的新数据库。 这很可能是原因,因为默认设置为后者。 数据连接 - 附加数据源 - 检查此不是空白 如果所有这些细节都是正确的让我知道并且生病了再试一次 What I did to get around this was put...

无法在SQL中创建外部数据源(Can't CREATE EXTERNAL DATA SOURCE in SQL)

在“ Azure Blob存储中批量访问数据的示例 ”中,我们可以找到: 从SQL Server批量访问Azure blob存储至少需要SQL Server 2017 CTP 1.1。 在“ 创建外部数据源(Transact-SQL) ”的参数部分中,我们可以找到类似的信息: 使用BULK INSERT或OPENROWSET与SQL Server 2017执行批量操作时使用BLOB_STORAGE 您正在使用SQL Server 2016,因此在为Azure Blob存储创建外部数据源时, Inc...

如何关闭Visual Studio的“当前位置没有可用的源代码。”?(How to shut up Visual Studio's “There is no source code available for the current location.”?)

至少在Visual Studio 2013中 ,这里给出的其他答案对我来说并不适用。 我找到了扩展名http://disablenosourcetab.codeplex.com/ 。 它完全禁用了我的选项卡。 At least on Visual Studio 2013 the other answer given here didn't work for me. I've found the extension http://disablenosourcetab.codeplex.com/. I...

如何本地化数据源的路径?(How to localize path to data source?)

一种方法是在Localizable.strings编写本地化CSV文件的文件名。 例如,该文件的英文版可以称为CSV_en.txt ,即法文版CSV_fr.txt 。 在英文版的strings文件中,写 "CSV" = "CSV_en"; 在法文版写 "CSV" = "CSV_fr"; 然后,您可以通过以下操作获取本地化的CSV文件: let location = Bundle.main.path(forResource: NSLocalizedString("CSV", comment: "...

dygraph 1.1.1似乎错误地检测到数据源的范围值(dygraph 1.1.1 appears to incorrectly detect range value for data source)

正如danvk 建议的那样 ,解决方案是将数字改为用引号括起来,使得它们被视为字符串,只是JSON输出中的裸号。 再次感谢danvk :) 原始文件包含以下部分: "c": [ { "v": "Date(2016, 10, 27, 00, 00, 00)" }, { "v": "548" }, { "v": "165" }, { "v": "57" }, { ...

如何在Spotfire中找到保存数据源的位置?(How to find the location where data source has been saved in Spotfire?)

我刚刚找到这个选项,这实际上是我的问题的答案。 I have just located this option which is infact an answer to my question.

相关文章

更多

rails怎么实现,图片在编辑器里复制就自动上传?

rails怎么实现,图片在编辑器里复制就自动上传? 问题补充: crane_may 写 ...

转:Solr 基于java的复制(Master-Slave配置)

Solr支持两种复制,一是java实现的复制,通过RequestHandler实现,Slave定期调用 ...

数据复制问题

有一个线上的数据库,知道线上某一个用户的user_id,要把跟他有关的的所有数据,复制到本地的测试数据 ...

我在福昕阅读器上面复制的东西粘贴到editplus中变成了乱码

RT!不知道是咋回事。应该不是编码的问题把? 问题补充: s929498110 写道 ...

Solr4:索引的复制

1. 需求 用一台创建索引的主服务器,不停的查询数据,解析数据,然后提交索引;这样导致主服务器的CP ...

[Hadoop]使用DistributedCache进行复制联结

使用DistributedCache有一个前提,就是进行联结的数据有一个足够小,可以装入内存中。注意我 ...

cmd进入后的doc窗口的内容如何复制????

cmd进入后的doc窗口的内容如何复制????

原创:用VBA实现将鼠标选择的单元格按照指定格式合并并复制到剪切板

原创:用VBA实现将鼠标选择的单元格按照指定格式合并并复制到剪切板 一、主要实现以下功能: 1、用鼠标 ...

Java-based 实现的索引复制

solr 包含一个基于 Java-based 实现的索引复制,通过http方式完成。 这 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本