RETRIEVING AN ARRAY ENTRY FROM AN ARRAY
-
From test plist file
_______________________________________________
<key>DeviceList</key>
<array>
<string>XSKey1</string>
<string>XSKey2</string>
<string>XSKey3</string>
</array>
_______________________________________________
Code
_______________________________________________
[objectPopUp removeAllItems];
NSArray *deviceArray;
deviceArray = [[NSUserDefaults standardUserDefaults]objectForKey:
@"DeviceList"];
[objectPopUp addItemsWithTitles:deviceArray];
_______________________________________________
While this code does work with the array "DeviceList" if it has strings
stored in it as listed.
The problem is that each entry in this array is an array with 3 entries and I
only wish to retrieve the first (0) entry from each array.
Here is the actual plist file content
_______________________________________________
From plist file
_______________________________________________
<key>DeviceList</key>
<array>
<array>
<array>
<string>XSKey1</string>
<string>LPlat.dat</string>
<string>gvggz55l-a4l94772-uoc9sbg </string>
</array>
<array>
<string>XSKey2</string>
<string>LPro.dat</string>
<string>gvffz66l-a4l84662-uoc8sbg </string>
</array>
<array>
<string>XSKey3</string>
<string>LGold.dat</string>
<string>hkjjm44l-c2319491-ukg6van</string>
</array>
</array>
</array>
_______________________________________________
I've tried "arrayForKey" but it doesn't populate the menu and
"stringArrayForKey" doesn't seem to work either so I'm assuming that I should be using
arrayForKey and then extracting the data I require from it, any ideas for a
solution???
Dale
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Had an error, corrected and resubmitted.
From test plist file
_______________________________________________
<key>DeviceList</key>
<array>
<string>XSKey1</string>
<string>XSKey2</string>
<string>XSKey3</string>
</array>
_______________________________________________
Code
_______________________________________________
[objectPopUp removeAllItems];
NSArray *deviceArray;
deviceArray = [[NSUserDefaults standardUserDefaults]objectForKey:
@"DeviceList"];
[objectPopUp addItemsWithTitles:deviceArray];
_______________________________________________
While this code does work with the array "DeviceList" if it has strings
stored in it as listed.
The problem is that each entry in this array is an array with 3 entries and I
only wish to retrieve the first (0) entry from each array.
Here is the actual plist file content
_______________________________________________
From plist file (corrected due to error in pasting)
_______________________________________________
<key>DeviceList</key>
<array>
<array>
<string>XSKey1</string>
<string>XSKey1.dat</string>
<string>gvggz55l-a4l94772-uoc9sbg</string>
</array>
<array>
<string>XSKey2</string>
<string>XSKey2.dat</string>
<string>gvffz66l-a4l84662-uoc8sbg</string>
</array>
<array>
<string>XSKey3</string>
<string>XSKey3.dat</string>
<string>hkjjm44l-c2319491-ukg6van</string>
</array>
</array>
_______________________________________________
I've tried "arrayForKey" but it doesn't populate the menu and
"stringArrayForKey" doesn't seem to work either so I'm assuming that I should be doing
something else but not sure what, any ideas for a solution???
Dale
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Please avoid re-post and uppercase titles.
You have to use a NSEnumerator to scan your array. For example, and As
I remeber without testing :
-------------------
NSArray *deviceArray = [[NSUserDefaults standardUserDefaults]
objectForKey:@"DeviceList"];
NSEnumerator *e = [ deviceArray objectEnumerator ];
NSString *currentDevice;
[objectPopUp removeAllItems];
while (currentDevice = [ e nextObject ]) {
[objectPopUp addItemWithTitle:currentDevice];
}
-------------------
Le 4 fivr. 04, ` 13:36, <GTFSTBK...> a icrit :
> Had an error, corrected and resubmitted.--
>
> From test plist file
> _______________________________________________
>
> <key>DeviceList</key>
> <array>
> <string>XSKey1</string>
> <string>XSKey2</string>
> <string>XSKey3</string>
> </array>
> _______________________________________________
>
> Code
> _______________________________________________
>
> [objectPopUp removeAllItems];
> NSArray *deviceArray;
> deviceArray = [[NSUserDefaults standardUserDefaults]objectForKey:
> @"DeviceList"];
> [objectPopUp addItemsWithTitles:deviceArray];
> _______________________________________________
>
> While this code does work with the array "DeviceList" if it has strings
> stored in it as listed.
>
> The problem is that each entry in this array is an array with 3
> entries and I
> only wish to retrieve the first (0) entry from each array.
>
> Here is the actual plist file content
> _______________________________________________
>
> From plist file (corrected due to error in pasting)
> _______________________________________________
>
> <key>DeviceList</key>
> <array>
> <array>
> <string>XSKey1</string>
> <string>XSKey1.dat</string>
> <string>gvggz55l-a4l94772-uoc9sbg</string>
> </array>
> <array>
> <string>XSKey2</string>
> <string>XSKey2.dat</string>
> <string>gvffz66l-a4l84662-uoc8sbg</string>
> </array>
> <array>
> <string>XSKey3</string>
> <string>XSKey3.dat</string>
> <string>hkjjm44l-c2319491-ukg6van</string>
> </array>
> </array>
> _______________________________________________
>
>
> I've tried "arrayForKey" but it doesn't populate the menu and
> "stringArrayForKey" doesn't seem to work either so I'm assuming that I
> should be doing
> something else but not sure what, any ideas for a solution???
>
> Dale
> _______________________________________________
> cocoa-dev mailing list | <cocoa-dev...>
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
>
>
Yann Bizeul - yann at tynsoe.org
http://projects.tynsoe.org/
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
On 2/5/04 9:37 AM, "Yann Bizeul" <ml...> wrote:
> Please avoid re-post and uppercase titles.What is wrong with uppercase titles?
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
David Blanton wrote:
> On 2/5/04 9:37 AM, "Yann Bizeul" <ml...> wrote:
>
>
>> Please avoid re-post and uppercase titles.
>>
>>
> What is wrong with uppercase titles?
>
For those that don't know, all caps have traditionally been used to
signify SHOUTING, within electronic communication, at least from the
early days of the Internet (long before the Web). It's just not polite
to SHOUT, unless there is a awfully good reason. Additionally, for some
of us (I happen to be in this group), for one reason or another, we have
a difficult time reading and/or stomaching all caps. (Personally, I
think one of the main sources for my aversion to all caps stems from my
old FORTRAN days working with IBM punch cards.)
Just a friendly note of netiquette.
David Halliday
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Hi David and list,
On Thursday, Feb 5, 2004, at 19:29 Europe/Copenhagen, David Blanton
wrote:
> On 2/5/04 9:37 AM, "Yann Bizeul" <ml...> wrote:
>
>> Please avoid re-post and uppercase titles.
> What is wrong with uppercase titles?
Most people get the impression that you are shouting, when writing in
uppercase.
Another thing is that if the reader is using a flexible font, uppercase
letters are usually wider than lowercase letters, and the reader can
only see a part of the subject line.
Some time ago, someone posted a good "list etiquette" link.
Unfortunately I forgot the address, but found 2 that are quite short,
and mentions the basics...
http://www.lepak.com/emailet.html
http://www.gweep.ca/~edmonds/usenet/ml-etiquette.html
If you want further reading, try Google "list etiquette". =)
Happy list-emailing!
Love,
Jens
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
I guess I have been under a rock too long. Southern New Mexico mountains are
somewhat remote.
Thanks for the info.
db
On 2/5/04 12:35 PM, "Jens Bauer" <fs.dev...> wrote:
> Hi David and list,_______________________________________________
>
>
> On Thursday, Feb 5, 2004, at 19:29 Europe/Copenhagen, David Blanton
> wrote:
>
>> On 2/5/04 9:37 AM, "Yann Bizeul" <ml...> wrote:
>>
>>> Please avoid re-post and uppercase titles.
>> What is wrong with uppercase titles?
>
> Most people get the impression that you are shouting, when writing in
> uppercase.
> Another thing is that if the reader is using a flexible font, uppercase
> letters are usually wider than lowercase letters, and the reader can
> only see a part of the subject line.
>
> Some time ago, someone posted a good "list etiquette" link.
> Unfortunately I forgot the address, but found 2 that are quite short,
> and mentions the basics...
>
> http://www.lepak.com/emailet.html
>
> http://www.gweep.ca/~edmonds/usenet/ml-etiquette.html
>
> If you want further reading, try Google "list etiquette". =)
>
> Happy list-emailing!
>
>
> Love,
> Jens
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
On Feb 5, 2004, at 11:35 AM, Jens Bauer wrote:
> Some time ago, someone posted a good "list etiquette" link.Oh, OK, this gives me an opportunity to recommend another article:
> Unfortunately I forgot the address, but found 2 that are quite short,
> and mentions the basics...
>
"How To Ask Questions The Smart Way"
<http://www.catb.org/~esr/faqs/smart-questions.html>
mmalc
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Ouch!!! I wonder how many of those *I* am guilty of! They're all good
points, though. The biggest problem that bugs me, though, are those who
immediately reply with "RTFM".
When someone asks a question that can be answered just by looking at
the method signature, that's one thing. But if someone actually posts a
request for clarification and has obviously read (but misunderstood)
the "$@#$#*@ manual", nobody benefits from a trite remark. Especially
if the remark is followed by "look at the archives." If nobody asks
those obvious questions and nobody answers them, they'll never end up
in the archives to begin with, right? ;-)
It's all about building a knowledge base. From the mundane to the
so-advanced-it-should-be-in-an-assembly-forum, it's all the same: If
you don't ask, you'll never know. Additionally, some concepts can be
understood when explained once. Others, however, require a few
explanations from a few different angles before they finally click in
some peoples' heads. I know that because I'm one of those people. ;-)
So, while I agree we should all follow etiquette AND NOT FRIGGIN
SHOUT AT ONE-ANOTHER, nor ask brain-dead questions, we should also add
as many good descriptions from as many angles as possible to the
archives. Or post a link to the best description so that when someone
searches for info under a particular keyword (right or wrong) they'll
always find a link to the appropriate information. That alone would cut
down on repetitive posts, no?
Just my 0.00794723 Euros. ;-)
- J
On Feb 5, 2004, at 3:35 PM, mmalcolm crawford wrote:
> "How To Ask Questions The Smart Way"_______________________________________________
> <http://www.catb.org/~esr/faqs/smart-questions.html>
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Hi mmalcom,
On Thursday, Feb 5, 2004, at 21:35 Europe/Copenhagen, mmalcolm crawford
wrote:
> On Feb 5, 2004, at 11:35 AM, Jens Bauer wrote:
>
>> Some time ago, someone posted a good "list etiquette" link.
>> Unfortunately I forgot the address, but found 2 that are quite short,
>> and mentions the basics...
>>
> Oh, OK, this gives me an opportunity to recommend another article:
>
> "How To Ask Questions The Smart Way"
> <http://www.catb.org/~esr/faqs/smart-questions.html>
**THAT** was the article I was looking for. =)
Thanks!
Love,
Jens
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
Am 05.02.2004 um 22:39 schrieb J Nozzi:
> If nobody asks those obvious questions and nobody answers them,
> they'll never end up in the archives to begin with, right? ;-)
Sure. But if they *are* already in the archives, there is no gain by
asking and answering the same questions over and over again.
So the point ist: Search the archives *first * and if that did not help
(because you either didn't find an answer or the solution didn't work
for you) *then* ask the list.
There's nothing wrong with asking if you couldn't work out something
despite looking at the archives and the documentation (even if the
answer is there). There *is* something wrong if you didn't even try ...
That's how I think about it anyway.
bye. Andreas.
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
On Feb 5, 2004, at 12:35 PM, mmalcolm crawford wrote:
> On Feb 5, 2004, at 11:35 AM, Jens Bauer wrote:
>
>> Some time ago, someone posted a good "list etiquette" link.
>> Unfortunately I forgot the address, but found 2 that are quite short,
>> and mentions the basics...
>>
> Oh, OK, this gives me an opportunity to recommend another article:
>
> "How To Ask Questions The Smart Way"
> <http://www.catb.org/~esr/faqs/smart-questions.html>
Incidentally, the best bit of advice in that essay (in my opinion, of
course) is:
> Describe the goal, not the step
>
> If you are trying to find out how to do something (as opposed to
> reporting a bug), begin by describing the goal. Only then describe the
> particular step towards it that you are blocked on.
>
> Often, people who need technical help have a high-level goal in mind
> and get stuck on what they think is one particular path towards the
> goal. They come for help with the step, but don't realize that the
> path is wrong. It can take a lot of effort to get past this.
>
> Stupid:
>
> How do I get the color-picker on the FooDraw program to take a
> hexadecimal RGB value?
>
> Smart:
>
> I'm trying to replace the color table on an image with values of my
> choosing. Right now the only way I can see to do this is by editing
> each table slot, but I can't get FooDraw's color picker to take a
> hexadecimal RGB value.
>
> The second version of the question is smart. It allows an answer that
> suggests a tool better suited to the task.
This kind of thing comes up over and over again, on every developer
mailing list I've ever frequented. It's also very good advice for bug
reports, DTS incidents, and developer feedback messages.
-jcr
John C. Randolph <jcr...> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored. -
At 0:00 Uhr +0100 06.02.2004, Andreas Mayer wrote:
> So the point ist: Search the archives *first * and if that did not
> help (because you either didn't find an answer or the solution
> didn't work for you) *then* ask the list.
>
> There's nothing wrong with asking if you couldn't work out something
> despite looking at the archives and the documentation (even if the
> answer is there). There *is* something wrong if you didn't even try
> ...
A good idea is also to tell people that you tried, and, more
importantly, what you got. Mentioning the search terms you used could
also be useful, because while the pros may think of the right search
term naturally, it may just be that you picked an unlucky word to
google for.
> That's how I think about it anyway.
"Anyway, I'm sorry, but that just happens to be how I feel about it.
What do you think?" ;-)
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | <cocoa-dev...>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


