On 29.08.2008, at 02:12, Graham Cox wrote:
Well, that was me. But I do see the error of my ways... I guess it
was Michael Ash's comment that NSArray *could* change its storage
half way through enumeration (if the collection were mutated) that
woke me up. I suspect it would only do this if
On Thu, Aug 28, 2008 at 9:50 PM, Gerriet M. Denkmann
[EMAIL PROTECTED] wrote:
While if fully agree with you about valid assumptions and so, I am still
wondering what is the disadvantage of forgetting about NSEnumerator, Fast
Enumeration and the like and simply doing:
unsigned count = [ array
On Fri, 29 Aug 2008 12:13:34 -0400, Michael Ash
[EMAIL PROTECTED] wrote:
On Thu, Aug 28, 2008 at 9:50 PM, Gerriet M. Denkmann
[EMAIL PROTECTED] wrote:
While if fully agree with you about valid assumptions and so, I am
still
wondering what is the disadvantage of forgetting about
Gerriet Denkmann wrote:
While if fully agree with you about valid assumptions and so, I am
still wondering what is the disadvantage of forgetting about
NSEnumerator, Fast Enumeration and the like and simply doing:
unsigned count = [ array count ];
if ( count == 0 ) return;
for( unsigned i =
Adil,
I use NSWorkspace and UTI types to do this, as in the code below. Look
at the UTI hierarchy and replace public.movie in the code with
whichever type covers the files you're interested in.
-(NSArray *)mediaFilesInFolder:(NSString *)folderPath
{
NSMutableArray * files =
On Wed, Aug 27, 2008 at 6:59 PM, R.L. Grigg
[EMAIL PROTECTED] wrote:
Hmm, I guess the wrinkle in this particular case is if the contract doesnt
specify something that the programmer assumes to be safe to do (like
enumerating backwards), how can you know how to implement your end? I guess
there
On Aug 27, 2008, at 5:59 PM, R.L. Grigg wrote:
Hmm, I guess the wrinkle in this particular case is if the
contract doesnt specify something that the programmer assumes to
be safe to do (like enumerating backwards), how can you know how to
implement your end?
Enumerating NSArrays
On 29 Aug 2008, at 4:28 am, Ken Thomases wrote:
On Aug 27, 2008, at 5:59 PM, R.L. Grigg wrote:
Hmm, I guess the wrinkle in this particular case is if the
contract doesnt specify something that the programmer assumes to
be safe to do (like enumerating backwards), how can you know how to
On 28 Aug 2008 11:52:46 -0400, Michael Ash [EMAIL PROTECTED]
wrote:
On Wed, Aug 27, 2008 at 6:59 PM, R.L. Grigg
[EMAIL PROTECTED] wrote:
Hmm, I guess the wrinkle in this particular case is if the
contract doesnt
specify something that the programmer assumes to be safe to do (like
On Aug 22, 2008, at 4:24 PM, Thomas Engelmeier wrote:
Am 22.08.2008 um 17:23 schrieb Michael Ash:
On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox
[EMAIL PROTECTED] wrote:
safe to delete items in the array at or higher than the current
index. By
the definition of an array, removing an item only
On Aug 27, 2008, at 1:50 PM, R.L. Grigg wrote:
This is interesting. Correct me if I'm wrong but as a newb what I'm
getting from all this is if I design my code around implementation
specifics of frameworks or even the language I'm using, that equates
to a unrobust design, cuz if the
On Aug 27, 2008, at 1:50 PM, R.L. Grigg wrote:
On Aug 22, 2008, at 4:24 PM, Thomas Engelmeier wrote:
Am 22.08.2008 um 17:23 schrieb Michael Ash:
On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox
[EMAIL PROTECTED] wrote:
safe to delete items in the array at or higher than the current
index. By
On Aug 27, 2008, at 12:19 PM, Ken Thomases wrote:
On Aug 27, 2008, at 1:50 PM, R.L. Grigg wrote:
This is interesting. Correct me if I'm wrong but as a newb what I'm
getting from all this is if I design my code around implementation
specifics of frameworks or even the language I'm using,
On Thu, Aug 28, 2008 at 10:59 AM, R.L. Grigg
[EMAIL PROTECTED] wrote:
Hmm, I guess the wrinkle in this particular case is if the contract doesnt
specify something that the programmer assumes to be safe to do (like
enumerating backwards), how can you know how to implement your end? I guess
On Aug 21, 2008, at 11:29 PM, Adil Saleem wrote:
Hi,
I want to display in a tableview, list of all media files (audio,
video files) present in a certain directory.
Currently what i am doing is that i am getting the file names in an
NSMutableArray using NSFileManager function
Hi,
I want to display in a tableview, list of all media files (audio, video files)
present in a certain directory.
Currently what i am doing is that i am getting the file names in an
NSMutableArray using NSFileManager function directoryContentsAtPath
I get the list, but the problem is that
On Aug 22, 2008, at 2:29 AM, Adil Saleem wrote:
Hi,
I want to display in a tableview, list of all media files (audio,
video files) present in a certain directory.
Currently what i am doing is that i am getting the file names in an
NSMutableArray using NSFileManager function
On Aug 22, 2008, at 12:10 AM, Michael Dautermann wrote:
On Aug 22, 2008, at 2:29 AM, Adil Saleem wrote:
Hi,
I want to display in a tableview, list of all media files (audio,
video files) present in a certain directory.
Currently what i am doing is that i am getting the file names in an
On 22 Aug 2008, at 5:22 pm, Andrew Merenbach wrote:
Hi! It appears that you're removing an object from a mutable array
while enumerating, so that will unfortunately not work. To modify
your concept:
NSMutableArray *myMutableArray = [myOriginalArray copy];
Or just use
On Fri, Aug 22, 2008 at 7:28 PM, Graham Cox [EMAIL PROTECTED] wrote:
Or just use reverseObjectEnumerator. Removing the current iteration item
from the array while iterating backwards is OK.
Even going backwards, it's still not ok...
From the -reverseObjectEnumerator 'special considerations'
On Fri, Aug 22, 2008 at 6:29 PM, Adil Saleem [EMAIL PROTECTED] wrote:
Currently what i am doing is that i am getting the file names in an
NSMutableArray using NSFileManager function directoryContentsAtPath
I get the list, but the problem is that it get all the files. I want only
those files
On 22 Aug 2008, at 7:10 pm, Phil wrote:
From the -reverseObjectEnumerator 'special considerations' section of
the documentation:
When you use this method with mutable subclasses of NSArray, you must
not modify the array during enumeration.
You shouldn't go modifying the array in general,
On Fri, Aug 22, 2008 at 10:23 PM, Graham Cox [EMAIL PROTECTED] wrote:
You shouldn't go modifying the array in general, for sure. But the special
case of modification by deleting the last item in the array is safe, and
always will be. In fact deleting any item with a higher index than current
On Aug 22, 2008, at 2:27 AM, Phil wrote:
On Fri, Aug 22, 2008 at 6:29 PM, Adil Saleem
[EMAIL PROTECTED] wrote:
Currently what i am doing is that i am getting the file names in an
NSMutableArray using NSFileManager function directoryContentsAtPath
I get the list, but the problem is that it
On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED] wrote:
-reverseObjectEnumerator is no different, because it lets you access each
object in the receiver, in order, from the element at the highest index down
to the element at index 0. This statement will hold true for any future
On Aug 22, 2008, at 8:23 AM, Michael Ash wrote:
On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED]
wrote:
-reverseObjectEnumerator is no different, because it lets you
access each
object in the receiver, in order, from the element at the highest
index down
to the element at
On Fri, Aug 22, 2008 at 11:39 AM, Andrew Merenbach
[EMAIL PROTECTED] wrote:
To build on this, doesn't fast enumeration (Leopard-only, of course) raise
an exception if a value is modified while the enumeration is running? (Not
tested personally by me, but building upon an earlier thread from a
On Aug 22, 2008, at 10:39 AM, Andrew Merenbach wrote:
To build on this, doesn't fast enumeration (Leopard-only, of course)
raise an exception if a value is modified while the enumeration is
running? (Not tested personally by me, but building upon an earlier
thread from a little while
Am 22.08.2008 um 17:23 schrieb Michael Ash:
On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED]
wrote:
safe to delete items in the array at or higher than the current
index. By
the definition of an array, removing an item only affects the
indexes of
objects with equal or
29 matches
Mail list logo