Re: Caching Streaming video

2011-06-28 Thread Eric Wing
>> I am trying to playback video in my iOS app while I am loading and caching >> it at the same time. I fetch the video using a NSURLConnection and then >> store it in a local file, I start video playback of the local video file >> after a certain number of bytes are received. I have it working gre

dispatch_async Performance Issues

2011-06-28 Thread Andreas Grosam
Hi All I've implemented a typical consumer/producer pattern, using a container holding a FIFO list of buffers. This buffer list has functions to store and retrieve these buffers concurrently. Consumer and Producer are running in the global concurrent dispatch queue. I'm experiencing huge diffe

sorting a pair of arrays

2011-06-28 Thread Rick C.
Hi, I have a pair of arrays (one of integers and one of strings) and I need to sort the one of integers from largest to smallest and then however it gets sorted I need to copy that sorting in my strings array since they are related. Any advice on what the best way to approach this is would be

Re: sorting a pair of arrays

2011-06-28 Thread Mike Abdullah
You want an object that holds both integer and string as properties. Put those objects in an array and sort that. On 28 Jun 2011, at 13:52, Rick C. wrote: > Hi, > > I have a pair of arrays (one of integers and one of strings) and I need to > sort the one of integers from largest to smallest an

Re: sorting a pair of arrays

2011-06-28 Thread Mikkel Islay
Hi Rick, It sounds to me like one way of looking at your data structures is as a NSDictionary with the first array as keys and the second as objects (values). If so, you could then sort the keys using - (NSArray *)keysSortedByValueUsingComparator:(NSComparator)cmptr , or one of the other sortin

Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Kevin Muldoon
Was writing a program to create thumbnails using SIPS, GhostScript, ImageMagick. During testing I found I needed to read the header file of Adobe Photoshop native documents directly because Duotone image color mode simply wasn't returning the proper color mode (in a variety of programs).

Re: dispatch_async Performance Issues

2011-06-28 Thread Jonathan Taylor
Hi Andreas, If I understand your post correctly, you are saying that you see a performance drop of 3x when using an iterator in your inner loop as opposed to using hand-written C code to do the iterating. Unfortunately you say you haven't actually posted the code relating to the iterator... but

Re: dispatch_async Performance Issues

2011-06-28 Thread Jonathan Taylor
... and more importantly I do not believe your code makes correct use of dispatch_group_async. Your first call adds a producer block to the global concurrent queue, which may start executing immediately. At some time soon afterwards you add a consumer block to the global concurrent queue, which

Re: Assigning to property with 'readonly' atribute not allowed

2011-06-28 Thread Fritz Anderson
On 27 Jun 2011, at 9:52 PM, Fernando Aureliano wrote: > - (AQGridViewCell *) gridView: (AQGridView *)inGridView cellForItemAtIndex: > (NSUInteger) index; > { > MagazineCell *cell = (MagazineCell *)[inGridView > dequeueReusableCellWithIdentifier:@"cell"]; > if (!cell) { > cell = [MagazineCell cell]

Help with relationship objects

2011-06-28 Thread Brad Stone
I need a little guidance. Did I properly add a relationship object? I don't know what's normal in this scenario. I referred to here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html I have an entity called SRNoteEntity which has a to-man

Re: sorting a pair of arrays

2011-06-28 Thread Gregory Weston
Mikkel Islay wrote: > It sounds to me like one way of looking at your data structures is as a > NSDictionary with the first array as keys and the second as objects (values). Which fails the if there's any possibility that the items in the first array aren't unique. Better two have an array of d

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 6:23 AM, Kevin Muldoon wrote: > As you can see from the output, the 'version' & 'reserved' isn't being read > at all. Must I coerce/parse something here? Much thanks… I’m not familiar with the PSD format, but aren’t ‘version’ and ‘reserved’ binary? You’re printing them as C

Re: sorting a pair of arrays

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 5:52 AM, Rick C. wrote: > I have a pair of arrays (one of integers and one of strings) and I need to > sort the one of integers from largest to smallest and then however it gets > sorted I need to copy that sorting in my strings array since they are > related. Any advice o

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Kevin Muldoon
Hey Jens, I suppose the trouble here is that I'm familiar with Objective-C code and not so familiar with its parent, C. On Jun 28, 2011, at 1:00 PM, Jens Alfke wrote: On Jun 28, 2011, at 6:23 AM, Kevin Muldoon wrote: As you can see from the output, the 'version' & 'reserved' isn't being

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 10:11 AM, Kevin Muldoon wrote: > I suppose the trouble here is that I'm familiar with Objective-C code and not > so familiar with its parent, C. Yeah, unfortunately Objective-C does not absolve you of having to know C. With where you’re going, I’d suggest cracking open Ker

Re: dispatch_async Performance Issues

2011-06-28 Thread Andreas Grosam
On Jun 28, 2011, at 3:53 PM, Jonathan Taylor wrote: Hi Jonathan, Thank you very much for taking the time to look at it. > Hi Andreas, > > If I understand your post correctly, you are saying that you see a > performance drop of 3x when using an iterator in your inner loop as opposed > to us

Re: dispatch_async Performance Issues

2011-06-28 Thread Andreas Grosam
On Jun 28, 2011, at 4:07 PM, Jonathan Taylor wrote: > ... and more importantly I do not believe your code makes correct use of > dispatch_group_async. Your first call adds a producer block to the global > concurrent queue, which may start executing immediately. At some time soon > afterwards y

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Kevin Muldoon
No problem at all. I'll pick up Kernighan & Ritchie. Thanks for reply. On Jun 28, 2011, at 1:17 PM, Jens Alfke wrote: On Jun 28, 2011, at 10:11 AM, Kevin Muldoon wrote: I suppose the trouble here is that I'm familiar with Objective-C code and not so familiar with its parent, C. Yeah, unfo

Re: Help with relationship objects

2011-06-28 Thread Quincey Morris
On Jun 28, 2011, at 08:40, Brad Stone wrote: > I get the below. Notice the new SRTodoEntity is properly in the todos > relationship but there's also a reference to it outside of the SRNoteEntity. > Intuitively, I would think there should be only one reference to it inside > SRNoteEntity.T

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Stephen Hoffman
On 28 Jun 2011 10:00:51 -0700, Jens Alfke posited: > Assuming Œversion‚ is a 16-bit big-endian integer, you could read it like > this: The htons() and ntohs() C calls go from host-native integer (short) format to network format (big-endian), and from network format back to host-native short

Re: sorting a pair of arrays

2011-06-28 Thread Mikkel Islay
On 28 Jun 2011, at 18:40, Gregory Weston wrote: > Which fails the if there's any possibility that the items in the first array > aren't unique. Better two have an array of dictionaries where each dictionary > holds a respective pair from the current two arrays as their own objects] Granted, but

Re: dispatch_async Performance Issues

2011-06-28 Thread Jonathan Taylor
> In the meantime however, I found one (surprising) cause of the performance > issue. After making the versions *more* equivalent the issue become > apparent. I restructured the second version (using the C++ iterators) and > will discuss this in more detail. The culprit is in the consumer part

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Charles Srstka
On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: > Another way (that I often use) is to define a C struct that matches the > fields and layout of the header, then cast the bytes to a pointer to that > struct and read the fields. It makes your code look a lot cleaner, but you > have to be careful

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Thomas Engelmeier
On 28.06.2011, at 15:23, Kevin Muldoon wrote: > Was writing a program to create thumbnails using SIPS, GhostScript, > ImageMagick. During testing I found I needed to read the header file of Adobe > Photoshop native documents directly because Duotone image color mode simply > wasn't returning t

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Thomas Engelmeier
On 28.06.2011, at 21:37, Charles Srstka wrote: > On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: > >> Another way (that I often use) is to define a C struct that matches the >> fields and layout of the header, then cast the bytes to a pointer to that >> struct and read the fields. It makes you

Menu Title Icon in Cocoa

2011-06-28 Thread Bernard Desgraupes
Hi, I'd like to know if there is a way of inserting an icon instead of a menu title in the menu bar. I'm not speaking of the system status bar, but simply of my application's menus. In Carbon, I used to use SetMenuTitleIcon(): so the question is "is there an equivalent of SetMenuTitleIcon

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Thomas Engelmeier
On 28.06.2011, at 21:57, Thomas Engelmeier wrote: > > On 28.06.2011, at 21:37, Charles Srstka wrote: > >> On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: >> >>> Another way (that I often use) is to define a C struct that matches the >>> fields and layout of the header, then cast the bytes to

Re: Custom NSCell and Bindings

2011-06-28 Thread Sean McBride
On Fri, 24 Jun 2011 09:33:38 -0400, Carter R. Harrison said: >It's a pretty typical situation. I've got my model objects stored in an >NSSet. An NSArrayController that is bound to the NSSet. And then an >NSTableView with one NSTableColumn bound to the arrangedObjects.name >property of the NSArr

Re: Custom NSCell and Bindings

2011-06-28 Thread Gustavo Pizano
Hello Carter. Right now I can't remember the name of the example. Its a little tricky but its do-able. your MO subclass must do something like: -(NSDictionary *)userDictionary{ return [self dictionaryWithValuesForKeys:[NSArray arrayWithObjects:@"firstName",@"lastName",@

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Charles Srstka
On Jun 28, 2011, at 2:57 PM, Thomas Engelmeier wrote: > - the endian issue you'll have to deal with anyway Yes, that was the point. You already have to go through the struct member by member and fix the endians anyway, so reading the whole thing in as one block of data won’t actually make your

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Francis Devereux
On 28 Jun 2011, at 18:00, Jens Alfke wrote: > Another way (that I often use) is to define a C struct that matches the > fields and layout of the header, then cast the bytes to a pointer to that > struct and read the fields. It makes your code look a lot cleaner, but you > have to be careful to

Re: Menu Title Icon in Cocoa

2011-06-28 Thread Marcus Karlsson
On Jun 28, 2011, at 10:00 PM, Bernard Desgraupes wrote: > Hi, > > I'd like to know if there is a way of inserting an icon instead of a menu > title in the menu bar. I'm not speaking of the system status bar, but simply > of my application's menus. In Carbon, I used to use SetMenuTitleIcon(): s

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread James Merkel
Kevin, As others have suggested you probably want to step down to more basic C coding to handle this task. You can just use C library functions to read data from the file: fopen(), fseek(), fread(), fgetc(), fclose() etc. as discussed in Kernighan and Ritchie. As far as big endian, litt

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread John Joyce
On Jun 28, 2011, at 6:18 PM, James Merkel wrote: > Kevin, > > As others have suggested you probably want to step down to more basic C > coding to handle this task. > You can just use C library functions to read data from the file: fopen(), > fseek(), fread(), fgetc(), fclose() etc. as discus

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread James Merkel
On Jun 28, 2011, at 4:35 PM, John Joyce wrote: On Jun 28, 2011, at 6:18 PM, James Merkel wrote: Kevin, As others have suggested you probably want to step down to more basic C coding to handle this task. You can just use C library functions to read data from the file: fopen(), fseek(),

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread Jens Alfke
On Jun 28, 2011, at 4:53 PM, James Merkel wrote: >> Synalyzeit is a free hex editor that's fabulous. > > Thanks, I'll take a look at that. HexEdit is getting a little dated. Hex Fiend (open source) is nice too —Jens smime.p7s Description: S/MIME cryptogra

Re: Reading Adobe Photoshop header, Obj-C

2011-06-28 Thread John Joyce
On Jun 28, 2011, at 7:14 PM, Jens Alfke wrote: > > On Jun 28, 2011, at 4:53 PM, James Merkel wrote: > >>> Synalyzeit is a free hex editor that's fabulous. >> >> Thanks, I'll take a look at that. HexEdit is getting a little dated. > > Hex Fiend (open source) is nice too

Re: sorting a pair of arrays

2011-06-28 Thread Rick C.
Thanks for all of the insight! I'll be trying out these suggestions and if I have any further questions I'll post back... rc On Jun 29, 2011, at 2:06 AM, Mikkel Islay wrote: > On 28 Jun 2011, at 18:40, Gregory Weston wrote: > >> Which fails the if there's any possibility that the items in t

Re: Problem with setNeedsLayout and layoutSubviews in UIScrollView

2011-06-28 Thread Tales Pinheiro de Andrade
Em 27/06/2011, às 13:56, David Duncan escreveu: > > The problem is that a UIDeviceOrientaiton also includes Unknown, FaceUp and > FaceDown orientations. Thus !Landscape means Portrait or one of those (ditto > for !Portrait). A large portion of the time, your likely holding the device > in Face

how to get viewable text position after scroll a UITextView

2011-06-28 Thread hufey
I have a UITextView and a slide control. The text view has a long content to read. I need textview can interact with slide control. Now I can drag slide to move text view text to corresponding percentage by calculating position of slide control. I want to move slide indicator position to correspond