Re: "byte orders" question

2011-11-25 Thread Koen van der Drift
On Nov 25, 2011, at 7:07 PM, Glenn L. Austin wrote: > On Nov 25, 2011, at 2:56 PM, Koen van der Drift wrote: > >> On Nov 25, 2011, at 5:44 PM, Scott Ribe wrote: >> >>> As another response suggested, what's wrong with ntohl??? >> >> I implemented that function based on some code I found online,

NSView mouseDown truncated coordinates

2011-11-25 Thread Steven Spencer
Hi, I'm using a NSTrackingArea in a view to receive mouseMoved events. The cursor location in the mouseMoved and mouseDragged events have non-integer coordinates (as expected). e.g. x:140.601562 y:128.082031 However, the mouseDown and mouseUp events always produce truncated coordinates. e.g. x:1

Re: NSTableView Binding NSSortDescriptor

2011-11-25 Thread Ben
Ah yes thank you Quincey, that makes total sense now. I have been on honeymoon for the last 8 months and I'm a little bit rusty. I am just trying to get my head around bindings xcode 4 & ARC. On 25 Nov 2011, at 21:51, Quincey Morris wrote: > On Nov 25, 2011, at 13:21 , Ben wrote: > >> @proper

Re: "byte orders" question

2011-11-25 Thread Glenn L. Austin
On Nov 25, 2011, at 2:56 PM, Koen van der Drift wrote: > On Nov 25, 2011, at 5:44 PM, Scott Ribe wrote: > >> As another response suggested, what's wrong with ntohl??? > > I implemented that function based on some code I found online, but got very > weird results, which is why I asked here. My

Re: "byte orders" question

2011-11-25 Thread Koen van der Drift
On Nov 25, 2011, at 5:44 PM, Scott Ribe wrote: > As another response suggested, what's wrong with ntohl??? I implemented that function based on some code I found online, but got very weird results, which is why I asked here. My knowledge on these esoteric functions apparently isn't up to par

Re: "byte orders" question

2011-11-25 Thread Scott Ribe
On Nov 25, 2011, at 3:20 PM, Koen van der Drift wrote: > Basically what I am trying to do is to convert and NSData object which I know > contains an array of pairs of values to a Cocoa usable object, eg an NSArray > of NSDictionaries. As another response suggested, what's wrong with ntohl??? -

Re: "byte orders" question

2011-11-25 Thread Koen van der Drift
And to clarify it a bit more, in Perl it is done as follows: use MIME::Base64; $base64decoded = decode_base64($inputstring); @hostOrder32 = unpack("N*", $base64decoded); The hostOrder32 array contains a list of host ordered 32 bits entities which need to be converted to floats. - Koen. On

Re: "byte orders" question

2011-11-25 Thread Koen van der Drift
On Nov 25, 2011, at 4:30 PM, Ben Kennedy wrote: > On 25 Nov 2011, at 12:58 pm, Koen van der Drift wrote: > >> How do I obtain the "network byte order data" and "byte order of the host >> machine" so I get the correct results? > > Check out NSHostByteOrder(), as well as CFSwapInt32HostToBig() a

Re: NSTableView Binding NSSortDescriptor

2011-11-25 Thread Quincey Morris
On Nov 25, 2011, at 13:51 , Quincey Morris wrote: > or: > > [self willChangeValueForKey: @"sortDescriptorArray"]; > self.sortDescriptorArray = [NSArray arrayWithObject:sd]; > [self didChangeValueForKey: @"sortDescriptorArray"]; > > if you didn't. Oops, I went cut/paste crazy.

Re: NSTableView Binding NSSortDescriptor

2011-11-25 Thread Quincey Morris
On Nov 25, 2011, at 13:21 , Ben wrote: > @property (readonly, strong, nonatomic) IBOutlet NSArray > *sortDescriptorArray; (plus @synthesize it in the implementation) > > > In my applicationDidFinishLaunching method I have... > > > NSSortDescriptor * sd = [[NSSortDescriptor alloc] initWithKey:

Re: "byte orders" question

2011-11-25 Thread Ben Kennedy
On 25 Nov 2011, at 12:58 pm, Koen van der Drift wrote: > How do I obtain the "network byte order data" and "byte order of the host > machine" so I get the correct results? Check out NSHostByteOrder(), as well as CFSwapInt32HostToBig() and brethren (with various values for "32" and "Big"). -b

Re: "byte orders" question

2011-11-25 Thread Nick Zitzmann
On Nov 25, 2011, at 1:58 PM, Koen van der Drift wrote: > I'm trying to implement the following code into my Cocoa project: > > for (n = 0 ; n < (2 * count) ; n++) > { > ((u_int32_t *) result)[n] = ntohl((u_int32_t) ((u_int32_t *) > decoded)[n]); > } > > with the following requirements: >

NSTableView Binding NSSortDescriptor

2011-11-25 Thread Ben
I have a simple NSTableView which uses binding and Core Data (via NSArrayController). It works fine except the order of table entries is random. So I need an NSSortDescriptor. I add a property to my App Delegate like so.. @property (readonly, strong, nonatomic) IBOutlet NSArray *sortDescriptor

Re: Lexical or Preprocessor Issue 'Cocoa/Cocoa.h file not found

2011-11-25 Thread Kyle Sluder
This is really a tools question, so you might get a better response on the xcode-users list. --Kyle Sluder On Fri, Nov 25, 2011 at 12:48 PM, Ayers, Joseph wrote: > When compiling a Cocoa Document based app with LLVM is get the following > errors: > > Roboplasm-Prefix.pch > Lexical or Preprocess

"byte orders" question

2011-11-25 Thread Koen van der Drift
I'm trying to implement the following code into my Cocoa project: for (n = 0 ; n < (2 * count) ; n++) { ((u_int32_t *) result)[n] = ntohl((u_int32_t) ((u_int32_t *) decoded)[n]); } with the following requirements: // byte order correction decoded has network byte order data // result h

Lexical or Preprocessor Issue 'Cocoa/Cocoa.h file not found

2011-11-25 Thread Ayers, Joseph
When compiling a Cocoa Document based app with LLVM is get the following errors: Roboplasm-Prefix.pch Lexical or Preprocessor Issue 'Cocoa/Cocoa.h file not found <--The text of this for some reason is red Lexical or Preprocessor issue '/Users/lobster/Library/Developer/Xcode/DerivedData/Robop

Re: Placing an Image next to a UI element

2011-11-25 Thread Fritz Anderson
On 25 Nov 2011, at 7:45 AM, David Mirabito wrote: > I am trying to place an InvalidData icon next to offending input elements > (popup menus, text fields, etc). I calculate the position of the new > NSImageVIew based on the frame of the UI element. Keep it's vertical > placement, and shift the

Re: Placing an Image next to a UI element

2011-11-25 Thread Fritz Anderson
On 25 Nov 2011, at 7:45 AM, David Mirabito wrote: >NSView *aview = theOffendingNSTextView; Is this in fact an NSTextView, or do you mean NSTextField? >NSView *superView = [aview superview]; > >NSRect oldframe = [aview frame]; > >NSRect newFrame = NSMakeRect( >oldfra

Re: Is there an easier way of changing NSButtonCell state in an NSOutlineView

2011-11-25 Thread Gilles Celli
[SOLVED] :-) I've succesfully figured out how to add and change the NSButtonCell state in the NSOutlineView. I just added a BOOL isChecked to my outlineview Item class so that I don't need an NSArray, which is much cleaner and I don't need the rowIndex: [outlineView rowForItem:item]. Here's my pa

Placing an Image next to a UI element

2011-11-25 Thread David Mirabito
Hello, I am trying to place an InvalidData icon next to offending input elements (popup menus, text fields, etc). I calculate the position of the new NSImageVIew based on the frame of the UI element. Keep it's vertical placement, and shift the icon to the left if it, plus a small constant spaci

Re: NSNumberFormatter Strangeness

2011-11-25 Thread Conrad Shultz
Sorry, I didn't mean irrational, I did in fact mean non-finite. But you are right about the hopelessness of actually displaying so many digits. As indicated, I don't in reality intend to do so. Anyhow, as far as I'm concerned this issue is settled. I'm just using 100 now, and will file a bug o

Re: NSNumberFormatter Strangeness

2011-11-25 Thread Jean-Daniel Dupas
Le 25 nov. 2011 à 04:26, Conrad Shultz a écrit : > On 11/24/11 3:20 PM, Jean-Daniel Dupas wrote: >> A formatter is used to convert an internal number representation >> (integer, floating point, fixed point) into a string. Is has nothing >> to do with the precision of the represented value. >> >>