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 =
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
NSEn
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 = [
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 th
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
e
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 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 backwar
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
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 = [NSMutabl
On Aug 27, 2008, at 6:44 PM, Phil wrote:
but, you want to make sure that your
design doesn't *depend* on an implementation detail that's not
specified in the contract.
A QuickTime programmer here saw this comment and had a chuckle... ;-)
Russ
___
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 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, th
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 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 underly
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 onl
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 directoryCont
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 great
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 back.
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 f
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 in
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 fu
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 i
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 curren
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, f
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
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 consideratio
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 reverseObjectEnum
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 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 directoryCont
29 matches
Mail list logo