Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 06:28, Graham Cox a écrit : On 27 Jan 2009, at 4:17 pm, Adam Venturella wrote: Thanks! I knew I was doing to many steps! uint key = *(uint*)&buffer; You will also need to consider byte-ordering if your app or the data could be used on different architectures. If for

Re: How to catch and log EXC_BAD_ACCESS?

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 06:03, Slava Pestov a écrit : On Mon, Jan 26, 2009 at 10:43 PM, Michael Ash wrote: Actually it's pretty easy to avoid exiting due to EXC_BAD_ACCESS, just install a signal handler for SIGSEGV. In my experience, setting a handler for SIGSEGV is problematic because the cras

Re: How to catch and log EXC_BAD_ACCESS?

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 06:48, Bill Bumgarner a écrit : On Jan 26, 2009, at 8:43 PM, Michael Ash wrote: Actually it's pretty easy to avoid exiting due to EXC_BAD_ACCESS, just install a signal handler for SIGSEGV. Of course, doing something rational in such a signal handler is ever so slightly non-

Running CATransition in Different Thread ?

2009-01-27 Thread Anshul jain
I have developed a demo Application which plays slideShow and the movie simultaneously. When ever image changes i uses ActionForkey method of CALayer to animate the images.When the transition occurs the movie tends to stop and start after the transition. Is there any other way to do transit

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread William Jon Shipley
[inputStream open]; [inputStream read: buffer maxLength:sizeof(buffer)]; ... Note that although your call to -read:maxLength: will work as you expect most of the time, it's not guaranteed to work and is bad practice. The docs for NSInputStream say this method will "Return the actual numb

Re: Not Resolving Aliases

2009-01-27 Thread Gregory Weston
Scott Ribe wrote: I have given up on NSWorkspace, LaunchServices and now send the path via Distributed Objects. Hey, that surprises me ;-) Give what you said, my next attempt would have been constructing an open Apple Event... (Don't know if it would work, because I don't know when the norm

Re: Not Resolving Aliases

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 12:03, Gregory Weston a écrit : Scott Ribe wrote: I have given up on NSWorkspace, LaunchServices and now send the path via Distributed Objects. Hey, that surprises me ;-) Give what you said, my next attempt would have been constructing an open Apple Event... (Don't know i

Re: Not Resolving Aliases

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 12:25, Jean-Daniel Dupas a écrit : Le 27 janv. 09 à 12:03, Gregory Weston a écrit : Scott Ribe wrote: I have given up on NSWorkspace, LaunchServices and now send the path via Distributed Objects. Hey, that surprises me ;-) Give what you said, my next attempt would ha

Quick question on Current Active application Notification

2009-01-27 Thread rajesh
Hi all, For my application to know whats the current active application ( for each time there's a switch between application ) do I have to "Enable access for assistive devices" ? and then proceed with AX. API's ? Any other solution or workaround apart from Accessibility usage ? Thanks

Re: Quick question on Current Active application Notification

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 12:37, rajesh a écrit : Hi all, For my application to know whats the current active application ( for each time there's a switch between application ) do I have to "Enable access for assistive devices" ? and then proceed with AX. API's ? Any other solution or worka

Re: Setting data cell type for a specific row

2009-01-27 Thread I. Savant
On Jan 27, 2009, at 1:49 AM, Ken Tozier wrote: I was confused about what to return from the method if I just wanted the data cell preserved as is. It turned out to be really simple, but the solution didn't hit me on the first few passes. Glad you've gotten it, but I'd be remiss if I didn'

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Adam Venturella
Will thanks for the heads up, for my purposes this time around, the input stream will be coming in off the file system, but I did not want to load the whole thing into an NSData object. Graham, thanks for the byte-ordering nod as well. The file I am reading is assured to be in little-endian, and

IntefaceBuilder IPhone TableView Size Question

2009-01-27 Thread James Cicenia
Hello - I am struggling a bit with learning Interface builder and am trying to design my view with the following structure: Top half, some pull down selectors. Bottom half the list of items matching the above selectors. I was now trying forever to resize the tableview when I drag it over to

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Jeremy Pereira
On 27 Jan 2009, at 14:23, Adam Venturella wrote: Leopard is little endian ( at least on the intel chips, but I have read there are other macs that are big-endian, so I am trying to catch and handle that accordingly) The endianness is dependent on the processor architecture, not the operat

Re: Context Menu in NSBrowser

2009-01-27 Thread Benjamin Stiglitz
> All NSViews show, when control-clicked, their context menu. > But not the NSView subclass NSBrowser. > > Is this a documented feature or a bug? This is a bug in the Leopard and earlier versions of AppKit. For now, you can loop through the matrices using -matrixForColumn: and set their menus ind

[Q] efficient or good model for send/receive with streams scheduled in runloop?

2009-01-27 Thread JongAm Park
Hello, I would like to write a network program which is scheduled in runloop. According to "Stream Programming Guide for Cocoa", there are two scheduling, one is polling, and the other is run-loop scheduling. Because I don't want it to block things, the run-loop scheduling would be a nice an c

Re: Not Resolving Aliases

2009-01-27 Thread Scott Ribe
> I would expect the > documentation to call out the fact that a routine *does* automatically > resolve leaf symlinks. That would be my preference, but it hasn't always been so... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice

Re: IntefaceBuilder IPhone TableView Size Question

2009-01-27 Thread Fritz Anderson
On 27 Jan 2009, at 8:37 AM, James Cicenia wrote: I was now trying forever to resize the tableview when I drag it over to my window. But no matter what I can't seem to just shrink it and move it to the bottom half of my window. And the x and y boxes are grayed out no matter what I seem to do. A

[pyobjc] Custom sheet and didEndSelector

2009-01-27 Thread Domenico Testa
I want to show a custom sheet asking user for a choice depending on the button clicked. That's my code: class SignOptionsController(NSWindowController): @IBAction def showModalSheet_(self, parentWindow): didEndSelector = objc.selector(self.didEndSheet_retunCode_contextIn

Re: IntefaceBuilder IPhone TableView Size Question

2009-01-27 Thread James Cicenia
I am actually using UITableView being an iPhone app. Even if I change it to UIScrollView, I just can't seem to make it do anything but resize around it center point and with no subsequent way to then move it down. Thanks - j- On Jan 27, 2009, at 12:51 PM, Fritz Anderson wrote: On 27 Jan 2009,

Re: IntefaceBuilder IPhone TableView Size Question

2009-01-27 Thread glenn andreas
On Jan 27, 2009, at 1:13 PM, James Cicenia wrote: I am actually using UITableView being an iPhone app. Even if I change it to UIScrollView, I just can't seem to make it do anything but resize around it center point and with no subsequent way to then move it down. Maybe try asking on the web-

[Q] disposing of a stream object when NSStreamEventEndEncounterered is received?

2009-01-27 Thread JongAm Park
Hello. According to "Stream Programming Guide for Cocoa : Writing to Output Streams", it says : "When an NSOutputStream object concludes writing data to an output stream, it sends the delegate a |NSStreamEventEndEncountered| event in a |stream:handleEvent:| message. At this point the delegat

Hillegass: Animation, NSProgressIndicator and Bindings

2009-01-27 Thread Benjamin Dobson
Hi, I'm in chapter 24 of Hillegass's book, which contains an NSProgressIndicator bound to AppController.count (AppController being an NSObject subclass). One thing is really bugging me: when AppController.count is updates, the progress bar immediately jumps to the new position, instead of

Re: How to catch and log EXC_BAD_ACCESS?

2009-01-27 Thread Greg Parker
On Jan 27, 2009, at 12:57 AM, Jean-Daniel Dupas wrote: If you want, I have a proof of concept that catch exception like EXC_BAD_ACCESS, and skip the faulting instruction (by incrementing the program counter registry) to continue programme execution. No need to say I did it only for educational

Re: [pyobjc] Custom sheet and didEndSelector

2009-01-27 Thread Gorazd Krosl
From: Domenico Testa Subject: [pyobjc] Custom sheet and didEndSelector To: Cocoa development mailing list Message-ID: Content-Type: text/plain; charset=UTF-8 > I want to show a custom sheet asking user for a choice depending on the > button clicked. > > That's my code: > snip > > @IBA

Re: Animation, NSProgressIndicator and Bindings

2009-01-27 Thread Matt Neuburg
On Tue, 27 Jan 2009 19:37:57 +, Benjamin Dobson said: >I'm in chapter 24 of Hillegass's book, which contains an >NSProgressIndicator bound to AppController.count (AppController being >an NSObject subclass). One thing is really bugging me: when >AppController.count is updates, the progress bar

Re: Cocoa-dev Digest, Vol 6, Issue 154

2009-01-27 Thread Andrew Farmer
On 26 Jan 09, at 15:08, Michael Robinson wrote: Greetings List, A month ago my main hard disk failed, and I lost some development files that were not backed up. Yes I know I am stupid. Unfortunately the disk is too damaged for any recovery. I have the latest version of the project I was wo

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Sean McBride
On 1/27/09 3:24 PM, Jeremy Pereira said: >> Leopard is little endian ( at least on >> the intel chips, but I have read there are other macs that are >> big-endian, so I am trying to catch and handle that accordingly) > >The endianness is dependent on the processor architecture, not the >operating

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread William Jon Shipley
Will thanks for the heads up, for my purposes this time around, the input stream will be coming in off the file system, but I did not want to load the whole thing into an NSData object. Ah! Well, your approach will work, but if your file is less than 4GB I highly recommend something like:

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Steve Christensen
On 27 Jan 2009, at 14:23, Adam Venturella wrote: The file I am reading is assured to be in little-endian, and I am checking what the host byte ordering is first. Leopard is little endian ( at least on the intel chips, but I have read there are other macs that are big-endian, so I am trying to c

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Kyle Sluder
On Tue, Jan 27, 2009 at 5:15 PM, William Jon Shipley wrote: > In my tests "NSUncachedRead" is very, VERY fast, great if you are only going > to use each byte once. "NSMappedRead" has a different set of constraints but > can also be very fast. Since he's apparently unwilling, I'll link to Wil's bl

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Michael Ash
On Tue, Jan 27, 2009 at 5:15 PM, William Jon Shipley wrote: >> Will thanks for the heads up, for my purposes this time around, the >> input stream will be coming in off the file system, but I did not want >> to load the whole thing into an NSData object. > > Ah! Well, your approach will work, but

Re: [Q] disposing of a stream object when NSStreamEventEndEncounterered is received?

2009-01-27 Thread Michael Ash
On Tue, Jan 27, 2009 at 2:25 PM, JongAm Park wrote: > Hello. > > According to "Stream Programming Guide for Cocoa : Writing to Output > Streams", it says : > > "When an NSOutputStream object concludes writing data to an output stream, > it sends the delegate a |NSStreamEventEndEncountered| event i

Re: CoreData silently failing to insert?

2009-01-27 Thread Ben Trumbull
Not much to go on here. Deletes cancel out inserts, so that could remove them from the inserted list. If you delete an owning object that has a cascade deletion relationship to those objects, they'll get nuked. If you call -refreshObject:mergeChanges:NO on an object with pending changes,

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Graham Cox
On 28 Jan 2009, at 2:24 am, Jeremy Pereira wrote: Yes. That is correct, but since buffer is already a pointer to the first byte of the array and then you are taking a reference to it, key will end up containing the address of the buffer. You really need: uint key = *(uint*)buffer;

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Chris Suter
Hi Graham, On Wed, Jan 28, 2009 at 10:07 AM, Graham Cox wrote: > It's a good habit IMO to always > take the address in these cases to make it clear in your code what your > intentions were when you wrote it. I'm afraid I have to disagree with this approach. In my opinion, it's more likely that

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Graham Cox
On 28 Jan 2009, at 10:23 am, Chris Suter wrote: In which case using & later is then going to cause it to break. Yes, you have a good point. But I did want to make clear that the statement: since buffer is already a pointer to the first byte of the array and then you are taking a refere

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 09 à 23:52, Michael Ash a écrit : On Tue, Jan 27, 2009 at 5:15 PM, William Jon Shipley wrote: Will thanks for the heads up, for my purposes this time around, the input stream will be coming in off the file system, but I did not want to load the whole thing into an NSData object

USB ReadPipe Interface Stall

2009-01-27 Thread Ian was here
I am sending data to a custom USB device and trying to read it's response. WritePipe() is successful, but when I go to ReadPipe(), the pipe stalls, causing my application to hang. I tried clearing both ends of the pipe, but still no luck. IOUSBInterfaceInterface245 **interface; Device is o

Modal Sheet without Spaghetti?

2009-01-27 Thread Jerry Krinock
I often find myself in the quandary where the innermost of some nested methods may run into a problem that requires a user decision before processing can continue. So I use a modal dialog in there, blocking the main thread, and everything works fine. Butt if the possible problem involves a

Showing a button's menu after a delay

2009-01-27 Thread Graham Cox
I have a matrix of buttons. One of the buttons has some options in a pop-up menu. I can right-click to show this menu, but I think it would be nicer if I could also show the menu after a short delay even on a left-click, as it would then be more obvious that the options are there. The delay

Re: Modal Sheet without Spaghetti?

2009-01-27 Thread Graham Cox
On 28 Jan 2009, at 12:10 pm, Jerry Krinock wrote: Does anyone have an idiom or way of appreciating this problem which does not produce such spaghetti and headaches? I think the best way is to accept that you need to handle many operations in two parts - one that starts it and another that

Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-27 Thread Michael Ash
On Tue, Jan 27, 2009 at 6:43 PM, Jean-Daniel Dupas wrote: > > Le 27 janv. 09 à 23:52, Michael Ash a écrit : > >> On Tue, Jan 27, 2009 at 5:15 PM, William Jon Shipley >> wrote: Will thanks for the heads up, for my purposes this time around, the input stream will be coming in off the

Re: Showing a button's menu after a delay

2009-01-27 Thread Graham Cox
On 28 Jan 2009, at 12:33 pm, Graham Cox wrote: I have a matrix of buttons. One of the buttons has some options in a pop-up menu. I can right-click to show this menu, but I think it would be nicer if I could also show the menu after a short delay even on a left-click, as it would then be mo

Re: Modal Sheet without Spaghetti?

2009-01-27 Thread Michael Ash
On Tue, Jan 27, 2009 at 8:10 PM, Jerry Krinock wrote: > I often find myself in the quandary where the innermost of some nested > methods may run into a problem that requires a user decision before > processing can continue. So I use a modal dialog in there, blocking the > main thread, and everyth

Re: Modal Sheet without Spaghetti?

2009-01-27 Thread Jerry Krinock
Thanks for your thoughts, Graham and Michael. My irritation is not so much with the "Do you really want to do this? How?" dialogs, but in presenting errors. Probably I should have given a more concrete example, as I now have [1]. This simplified code from my real app performs a "sync in"

Re: Configuring a Port-based Input Source -- Part 1

2009-01-27 Thread Ken Thomases
On Jan 26, 2009, at 7:55 AM, John Love wrote: Reference: "Configuring a Port-Based Input Source" of http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ /apple_ref/doc/uid/1057i-CH16-SW7 My challenge is to try to understand