Objective-C / Cocoa dev position in Chicago area

2010-05-14 Thread Hai Nguyen
My company is hiring a full time, permanent Senior Software Engineer... info 
follows.  If you're interested, contact me.  Also feel free to pass along the 
opportunity to a colleague.  Salary is $85K and up.
 
Westell Inc. (NASDAQ: WSTL) is a designer of carrier-class equipment that 
delivers high-speed communication services for telecommunications operators and 
internet service providers throughout North America.  We provide innovative, 
highly engineered solutions that make it easy for carriers and service 
providers to give their customers more – more content, more services and more 
capabilities.
 
We are designing and developing an innovative home networking solution that 
will change the home user experience.  We have a team in place and looking to 
add a few more software engineers to the group, including one that will focus 
on User Interface and packaging of Mac applications.
 
Primary responsibilities include design and implementation of user-interfaces 
for both desktop and web applications, constructing system and integration test 
plans, unit testing all coding changes, and performing peer reviews of software 
design and implementation.  We’re seeking the following skill set: Objective 
C/C++, COCOA/COCOA touch, object-oriented analysis and design.
 
Apply at www.westell.com/careers.html or email me your resume.
 
Best,
 
Hai
hai_nguy...@yahoo.com
 



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTreeController and remove:

2010-05-14 Thread Tony Romano
Thanks Quincey.

removeObjectAtArrangedObjectIndexPath works but remove: still does not.  It 
should remove the object, if there is a bug then I will file a bug report.  
anyone have ideas as to why remove: may not be working.  I hate to find another 
way and drop a possible issue/bug.  Thanks.

-Tony


On May 14, 2010, at 4:55 PM, Quincey Morris wrote:

> On May 14, 2010, at 15:39, Tony Romano wrote:
> 
>> I have a NSOutlineView bound to a NSTreeController in class mode(i.e. each 
>> NSTreeNode represents my Node object).  Everything up to now is working 
>> fine.  I am trying to remove a single node in the outline view by calling 
>> [outlineView remove:self] as a test.  The documents are pretty simple and 
>> they state that the remove: method removes the selected item, simple enough. 
>>  I've put some test code around the remove.  The test code is looking at the 
>> selected node Before the remove then looking at the selected node 
>> again(assuming the controller picked a new selection).  The before and after 
>> are the same which is also reflected in the UI.  I verified this in the 
>> debugger.  Here's the snippet.
>> 
>>  ...
>>  NSArray * selectedObjects = [outlineController selectedObjects];
>> 
>>  // Only selecting one node for the test, it should be at index 0.
>>  Node * node = [selectedObjects objectAtIndex:0];
>>  NSIndexPath * paths = [outlineController selectionIndexPath];
>> 
>>  [outlineController remove:self];
>>  selectedObjects = [outlineController selectedObjects];
>> 
>>  node = [selectedObjects objectAtIndex:0];
>> 
>>  paths = [outlineController selectionIndexPath];
>> 
>> 
>> The canRemove binding which is hooked up to the menu item, is working(Menu 
>> Item is enabled).  Is there some setting I am completely overlooking. 
>> Searching has come up empty handed.
> 
> You read the documentation for 'remove:' but apparently not all of it:
> 
>> Special Considerations
>> Beginning with Mac OS X v10.4 the result of this method is deferred until 
>> the next iteration of the runloop so that the error presentation mechanism 
>> can provide feedback as a sheet.
> 
> So of course it hasn't been done when you check immediately after invoking 
> the 'remove:' action. If you want it to happen immediately, you would need to 
> use 'removeObjectAtArrangedObjectIndexPath:' instead.
> 
> But ...
> 
> Depending on where this code is, it may be a lousy idea to do the removal via 
> the tree controller anyway. You're always better off changing the data model 
> directly (the thing that is providing the tree controller with content).
> 
> If I say this often enough, one day someone might listen.
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/tonyrom%40hotmail.com
> 
> This email sent to tony...@hotmail.com
> 

-Tony

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDrawThreePartImage - Strange scaling behavior, is it supposed to do that?

2010-05-14 Thread aaron smith
AH. I can't believe I missed that. Thanks!



On Fri, May 14, 2010 at 4:39 PM, Ken Ferry  wrote:
> Yes, this is the intended behavior.  See the header for details.
> You seem to be looking for the nine part draw.
>
> /* Draw an image from two end caps and a fill.  The end caps are scaled
> proportionally to match the thickness of the destination frame.  In the
> horizontal case, the startCap is drawn into the left part of the
> destination, the endCap is drawn into the right part of the destination, and
> the fill is tiled over the remaining area.  The caps and the fill should all
> be the same height.  The vertical case is similar.
>
>
>
>  This is an appropriate way to draw the bezel of a button that can be
> resized in one dimension.
>
>  */
>
> APPKIT_EXTERN void NSDrawThreePartImage(NSRect frame, NSImage *startCap,
> NSImage *centerFill, NSImage *endCap, BOOL vertical, NSCompositingOperation
> op, CGFloat alphaFraction, BOOL flipped) NS_AVAILABLE_MAC(10_5);
>
> /* Draw an image from nine pieces.  When drawn, the destination rect is
> partitioned into nine rectangular regions: the corner pieces are the natural
> size of the corner images, the edge pieces are the natural size of the edge
> fill images in the direction perpendicular to the edge and flush with the
> corners.  The center rect fills the remaining space.  The supplied images
> and fills are drawn into the corresponding regions, with fill images tiled
> at their natural dimensions.  Images that share a border should have the
> same thickness in that dimension.
>
>
>
>  This method is appropriate for the bezel of a control, like a box, that can
> be resized in both dimensions.
>
>  */
>
> APPKIT_EXTERN void NSDrawNinePartImage(NSRect frame, NSImage *topLeftCorner,
> NSImage *topEdgeFill, NSImage *topRightCorner, NSImage *leftEdgeFill,
> NSImage *centerFill, NSImage *rightEdgeFill, NSImage *bottomLeftCorner,
> NSImage *bottomEdgeFill, NSImage *bottomRightCorner, NSCompositingOperation
> op, CGFloat alphaFraction, BOOL flipped) NS_AVAILABLE_MAC(10_5);
>
> Like Graham says, consider something like a standard aqua button.  Scaling
> should always respect the aspect ratio of the caps - they'd look totally
> wrong otherwise.
> -Ken
> On Fri, May 14, 2010 at 3:58 PM, Graham Cox  wrote:
>>
>> I haven't used this function but its behaviour seems logical to me. If the
>> height changes it has to scale the ends to fill that height and if they were
>> the end caps of a button (I guess its main intended use) then it would be
>> necessary to preserve the aspect ratio in order that, e.g. round end caps
>> remain round. The same is not true of a width change, where the round end
>> caps are the same regardless and do not have to be scaled.
>>
>> --Graham
>>
>>
>> On 15/05/2010, at 6:53 AM, aaron smith wrote:
>>
>> > http://i.imgur.com/cikiL.png - as soon as the height is changed, it's
>> > scaling everything. This can't be right?
>> >
>> > When the view draws, it's using [self bounds] as the frame for
>> > NSDrawThreePartImage.
>> >
>> > Here's my code that slices up the image for scale three:
>> > http://pastebin.com/HgVGyLEp
>> >
>> > I've put a bunch of logging in this method, and all of the rects are
>> > always the same size, which is correct. So i'm not sure where the
>> > scaling of the image is being introduced.
>>
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>>
>> This email sent to kenfe...@gmail.com
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTreeController and remove:

2010-05-14 Thread Quincey Morris
On May 14, 2010, at 15:39, Tony Romano wrote:

> I have a NSOutlineView bound to a NSTreeController in class mode(i.e. each 
> NSTreeNode represents my Node object).  Everything up to now is working fine. 
>  I am trying to remove a single node in the outline view by calling 
> [outlineView remove:self] as a test.  The documents are pretty simple and 
> they state that the remove: method removes the selected item, simple enough.  
> I've put some test code around the remove.  The test code is looking at the 
> selected node Before the remove then looking at the selected node 
> again(assuming the controller picked a new selection).  The before and after 
> are the same which is also reflected in the UI.  I verified this in the 
> debugger.  Here's the snippet.
> 
>   ...
>   NSArray * selectedObjects = [outlineController selectedObjects];
> 
>   // Only selecting one node for the test, it should be at index 0.
>   Node * node = [selectedObjects objectAtIndex:0];
>   NSIndexPath * paths = [outlineController selectionIndexPath];
> 
>   [outlineController remove:self];
>   selectedObjects = [outlineController selectedObjects];
> 
>   node = [selectedObjects objectAtIndex:0];
> 
>   paths = [outlineController selectionIndexPath];
> 
> 
> The canRemove binding which is hooked up to the menu item, is working(Menu 
> Item is enabled).  Is there some setting I am completely overlooking. 
> Searching has come up empty handed.

You read the documentation for 'remove:' but apparently not all of it:

> Special Considerations
> Beginning with Mac OS X v10.4 the result of this method is deferred until the 
> next iteration of the runloop so that the error presentation mechanism can 
> provide feedback as a sheet.

So of course it hasn't been done when you check immediately after invoking the 
'remove:' action. If you want it to happen immediately, you would need to use 
'removeObjectAtArrangedObjectIndexPath:' instead.

But ...

Depending on where this code is, it may be a lousy idea to do the removal via 
the tree controller anyway. You're always better off changing the data model 
directly (the thing that is providing the tree controller with content).

If I say this often enough, one day someone might listen.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDrawThreePartImage - Strange scaling behavior, is it supposed to do that?

2010-05-14 Thread Ken Ferry
Yes, this is the intended behavior.  See the header for details.

You seem to be looking for the nine part draw.


/* Draw an image from two end caps and a fill.  The end caps are scaled
proportionally to match the thickness of the destination frame.  In the
horizontal case, the startCap is drawn into the left part of the
destination, the endCap is drawn into the right part of the destination, and
the fill is tiled over the remaining area.  The caps and the fill should all
be the same height.  The vertical case is similar.



 This is an appropriate way to draw the bezel of a button that can be
resized in *one dimension*.

 */

APPKIT_EXTERN void NSDrawThreePartImage(NSRect frame, NSImage *startCap,
NSImage *centerFill, NSImage *endCap, BOOL vertical, NSCompositingOperationop,
CGFloat alphaFraction, BOOL flipped) NS_AVAILABLE_MAC(10_5);


/* Draw an image from nine pieces.  When drawn, the destination rect is
partitioned into nine rectangular regions: the corner pieces are the natural
size of the corner images, the edge pieces are the natural size of the edge
fill images in the direction perpendicular to the edge and flush with the
corners.  The center rect fills the remaining space.  The supplied images
and fills are drawn into the corresponding regions, with fill images tiled
at their natural dimensions.  Images that share a border should have the
same thickness in that dimension.



 This method is appropriate for the bezel of a control, like a box, that can
be resized in *both dimensions*.

 */

APPKIT_EXTERN void NSDrawNinePartImage(NSRect frame, NSImage *topLeftCorner,
NSImage *topEdgeFill, NSImage *topRightCorner, NSImage *leftEdgeFill,
NSImage *centerFill, NSImage *rightEdgeFill, NSImage *bottomLeftCorner,
NSImage *bottomEdgeFill, NSImage *bottomRightCorner, NSCompositingOperationop,
CGFloat alphaFraction, BOOL flipped) NS_AVAILABLE_MAC(10_5);


Like Graham says, consider something like a standard aqua button.  Scaling
should always respect the aspect ratio of the caps - they'd look totally
wrong otherwise.

-Ken

On Fri, May 14, 2010 at 3:58 PM, Graham Cox  wrote:

> I haven't used this function but its behaviour seems logical to me. If the
> height changes it has to scale the ends to fill that height and if they were
> the end caps of a button (I guess its main intended use) then it would be
> necessary to preserve the aspect ratio in order that, e.g. round end caps
> remain round. The same is not true of a width change, where the round end
> caps are the same regardless and do not have to be scaled.
>
> --Graham
>
>
> On 15/05/2010, at 6:53 AM, aaron smith wrote:
>
> > http://i.imgur.com/cikiL.png - as soon as the height is changed, it's
> > scaling everything. This can't be right?
> >
> > When the view draws, it's using [self bounds] as the frame for
> > NSDrawThreePartImage.
> >
> > Here's my code that slices up the image for scale three:
> > http://pastebin.com/HgVGyLEp
> >
> > I've put a bunch of logging in this method, and all of the rects are
> > always the same size, which is correct. So i'm not sure where the
> > scaling of the image is being introduced.
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


add small (control size) column to table view

2010-05-14 Thread Scott Ribe
I'm dynamically setting up columns in a table view, and I cannot get them set 
up to display as NSSmallControlsSize. I try:

[[col dataCell] setControlSize: NSSmallControlSize];

Immediately before and immediately after [resultsTbl addTableColumn:...], but 
it doesn't affect the text size. The table cells draw as regular size.

So what attributes is IB manipulating when you set a table view to small? If 
you've ever tried it, that immediately changes the "Text cell" text in all the 
columns to small. And if there are no columns in the table view, the setting 
does not stick, instead the size popup immediately redisplays "Regular". This 
implies that there's no size setting for the table view (I certainly don't see 
one in the docs), but that IB is setting (and getting) attributes of the 
table's children for size. The columns' cells seem like an obvious candidate, 
but I'm having no luck.

(BTW, I'm also setting the size of the header cell...)

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Looking for Cocoa Drawing Strategy Advice

2010-05-14 Thread Graham Cox

On 15/05/2010, at 7:14 AM, Quincey Morris wrote:

> In terms of placing these drawing objects within a larger canvas (with 
> layering, z-ordering, all the other stuff drawing has), you might want to 
> look into Graham Cox's DrawKit, which designed for this sort of thing. 
> DrawKit may even have a good solution to the custom rulers thing.


Thanks for the plug, but actually I just use the standard rulers in DK scroll 
views, and leave it to you if you want to seriously customise them beyond what 
NSRulerView gives you. In general DK tries not to impose a UI on you.

If you want to place an arbitrary ruler somewhere on the canvas, I agree with 
you that steering clear of NSRulerView is probably a good idea.

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDrawThreePartImage - Strange scaling behavior, is it supposed to do that?

2010-05-14 Thread Graham Cox
I haven't used this function but its behaviour seems logical to me. If the 
height changes it has to scale the ends to fill that height and if they were 
the end caps of a button (I guess its main intended use) then it would be 
necessary to preserve the aspect ratio in order that, e.g. round end caps 
remain round. The same is not true of a width change, where the round end caps 
are the same regardless and do not have to be scaled.

--Graham


On 15/05/2010, at 6:53 AM, aaron smith wrote:

> http://i.imgur.com/cikiL.png - as soon as the height is changed, it's
> scaling everything. This can't be right?
> 
> When the view draws, it's using [self bounds] as the frame for
> NSDrawThreePartImage.
> 
> Here's my code that slices up the image for scale three:
> http://pastebin.com/HgVGyLEp
> 
> I've put a bunch of logging in this method, and all of the rects are
> always the same size, which is correct. So i'm not sure where the
> scaling of the image is being introduced.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTreeController and remove:

2010-05-14 Thread Tony Romano
I have a NSOutlineView bound to a NSTreeController in class mode(i.e. each 
NSTreeNode represents my Node object).  Everything up to now is working fine.  
I am trying to remove a single node in the outline view by calling [outlineView 
remove:self] as a test.  The documents are pretty simple and they state that 
the remove: method removes the selected item, simple enough.  I've put some 
test code around the remove.  The test code is looking at the selected node 
Before the remove then looking at the selected node again(assuming the 
controller picked a new selection).  The before and after are the same which is 
also reflected in the UI.  I verified this in the debugger.  Here's the snippet.

...
NSArray * selectedObjects = [outlineController selectedObjects];

// Only selecting one node for the test, it should be at index 0.
Node * node = [selectedObjects objectAtIndex:0];
NSIndexPath * paths = [outlineController selectionIndexPath];

[outlineController remove:self];
selectedObjects = [outlineController selectedObjects];

node = [selectedObjects objectAtIndex:0];

paths = [outlineController selectionIndexPath];

 
The canRemove binding which is hooked up to the menu item, is working(Menu Item 
is enabled).  Is there some setting I am completely overlooking.  Searching has 
come up empty handed.


TIA,
-Tony

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Looking for Cocoa Drawing Strategy Advice

2010-05-14 Thread Quincey Morris
On May 14, 2010, at 10:41, Philip Regan wrote:

> The feature that I'm stuck on sorting on how best to implement is custom 
> rulers—multiple types of horizontal rulers that can be shown and hidden by 
> the user together or alone (or none at all), each with their own editable 
> objects and types of hash marks (if any at all), and a vertical ruler that 
> requires actual art and interaction as opposed to just hash marks. From what 
> I can surmise from the documentation and reading other questions on various 
> forums, there are two ways to handle this...
> 
> The first strategy I'm looking at is to use the already supplied NSRulerViews 
> to create my own view hierarchy to manage and draw as I see fit. I'm leaning 
> towards this method because it seems to be more of what Cocoa would expect, 
> but it also seems as though the NSRulerView has a very pre-determined use 
> that really can't be modified too much without a whole lot of trouble.

My advice: forget it. NSRulerViews are tightly integrated with scroll views, 
and they're kind of quirky.

> The second strategy is to draw the rulers in the main NSView nested in the 
> NSScrollView and use NSClipView to maintain their position on the left and 
> top of the NSScrollView. But that seems kludgey to me somehow.

If you're literally drawing them inside the "main" view, then the clip view 
won't help you keep them in place.

If you draw them in separate views, then they're outside the scrolling that the 
clip view does, so they'll stay in place. Of course, you'll have to synchronize 
them with the clip view in the one direction they each do scroll (not very 
hard). In this case, you'd want to subclass NSScrollView to override its 'tile' 
method, to keep your rulers correctly sized and positioned when the size of the 
scroll view itself changes.

> Also, I'm looking to incorporate certain simple 2D drawing techniques like 
> rounded corners, transparency, and possibly drop shadows. In a GUI interface 
> is there a graphics library I should stick with or ones that I should stay 
> away from (I know OpenGL is overkill here, but would CoreAnimation be a bad 
> thing in a drag-and-drop editing scenario).

These effects are not hard to do yourself -- you can create a display 
representation of each drawing object that's as simple as a NSBezierPath, or as 
complex as a PDF document, I guess.

In terms of placing these drawing objects within a larger canvas (with 
layering, z-ordering, all the other stuff drawing has), you might want to look 
into Graham Cox's DrawKit, which designed for this sort of thing. DrawKit may 
even have a good solution to the custom rulers thing.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [[NSFileManager alloc] init] considered thread-safe

2010-05-14 Thread Michael Ash
On Fri, May 14, 2010 at 4:46 PM, Ken Ferry  wrote:
>> Regarding that 10.5 singleton safety bug, is this documented anywhere?
>> It seems like there are a lot of minor bugs which get fixed in later
>> OS revisions but persist in earlier ones that we often have to support
>> for a while. There are often easy workarounds like this, but we don't
>> find out they're necessary until we happen, by chance, to say the
>> right thing to the right Apple engineer on a mailing list.
>>
>> I know Apple documentation concentrates heavily on the latest release,
>> and with good cause, but it would be great if little stuff like this
>> could make it in somewhere. I don't know if you're the right person to
>> say this to, but I figured I'd mention it just in case.
>
> There's the release notes, but they're already long enough to put people
> off, and we do actually want everyone to read those.  I don't think this one
> made the notes, which was probably a fair decision - I'm not sure anyone has
> ever hit it in practice.  It was noticed in code inspection.

It does seem like a bug that would be pretty hard to hit. I'd say that
something like this ought to be in the docs for +defaultManager, as a
brief note. Maybe Xcode could get fancy and let you configure the docs
to only show what's relevant to your target OS, so people who target
10.6 don't have to see notes that only apply to 10.5. Now we're
*really* getting out of your area

> Anyway, noted, though yes, I'm not a terribly helpful person to tell about
> it. :-)
> (I didn't do any of this work, by the way, just relaying it.)

I appreciate the relay. As for not being helpful, I figured I could at
least inject something into the collective Apple subconscious.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSDrawThreePartImage - Strange scaling behavior, is it supposed to do that?

2010-05-14 Thread aaron smith
Hello. Quick question.

I'm using NSDrawThreePartImage and for the most part it works. But
when the height of the views changes it's scaling the left and right
edges. I'm just not sure if it's supposed to be doing that?

Here are some images to see what's happening:
http://i.imgur.com/LviD0.png - normal, the component size is the same
size as the source image.
http://i.imgur.com/Wzvc3.png - this is normal looking when just the
width is changed.
http://i.imgur.com/cikiL.png - as soon as the height is changed, it's
scaling everything. This can't be right?

When the view draws, it's using [self bounds] as the frame for
NSDrawThreePartImage.

Here's my code that slices up the image for scale three:
http://pastebin.com/HgVGyLEp

I've put a bunch of logging in this method, and all of the rects are
always the same size, which is correct. So i'm not sure where the
scaling of the image is being introduced.

Any ideas?
Thanks!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Paul Sanders
> I tried a page on, but it didn't do the color highlighting

You could try pastebin. It seems to be popular with the folks 
round here.

Pau Sanders. 



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [[NSFileManager alloc] init] considered thread-safe

2010-05-14 Thread Ken Ferry
On Fri, May 14, 2010 at 1:34 PM, Michael Ash  wrote:

> On Fri, May 14, 2010 at 1:12 PM, Ken Ferry  wrote:
> > On Wed, May 5, 2010 at 11:33 AM, Michael Ash 
> wrote:
> >>
> >> On Wed, May 5, 2010 at 2:29 PM, Jens Alfke  wrote:
> >> >
> >> > On May 5, 2010, at 8:50 AM, Michael Ash wrote:
> >> >
> >> >>> Delegates are the only reason the doc says anything other than "go
> >> >>> nuts".
> >> >>>  This is what both Jens and I were trying to say.
> >> >>
> >> >> Is this true for all OS X versions, for 10.6+, or some other
> >> >> combination?
> >> >
> >> > For all, I think, although the issue doesn’t apply prior to 10.5
> because
> >> > there wasn’t a delegate. Aside from the delegate, NSFileManager is
> really
> >> > just a stateless procedural API wrapped up in an object instance, so
> it has
> >> > the same thread safety as the underlying filesystem calls, i.e. “go
> nuts”.
> >>
> >> That's what I would have thought, but it was explicitly listed as not
> >> being thread safe before 10.5, and is still listed as "v10.5 and
> >> later" next to the entry that marks it as thread safe in the Cocoa
> >> thread safety summary.
> >>
> >> Just because the API is stateless doesn't mean the object itself
> >> doesn't have any state underneath. It *shouldn't*, but I'd tend to
> >> trust the API docs.
> >>
> >> However, I'm only targeting 10.5 these days, and that doc answers my
> >> question, so I'm in good shape! I should have looked there first.
> >
> > There did used to be thread-safety problems..  the class was redone when
> the
> > NSError returning methods were added in 10.5.
> > There was one lesser thread safety fix in 10.6.  +defaultManager was
> > previously using the simple version of a singleton method Mike discusses
> at
> > <
> http://www.mikeash.com/pyblog/friday-qa-2009-10-02-care-and-feeding-of-singletons.html
> >.
> >  This could potentially cause a crash if you managed to use the
> > defaultManager in the midst of its setup.
> > The workaround for 10.5 would be to call +defaultManager once from the
> main
> > thread before[1] it might happen on a background thread. This is pretty
> > likely to happen as a normal part of app initialization.
>
> Thanks for the detailed reply!
>
> Regarding that 10.5 singleton safety bug, is this documented anywhere?
> It seems like there are a lot of minor bugs which get fixed in later
> OS revisions but persist in earlier ones that we often have to support
> for a while. There are often easy workarounds like this, but we don't
> find out they're necessary until we happen, by chance, to say the
> right thing to the right Apple engineer on a mailing list.
>
> I know Apple documentation concentrates heavily on the latest release,
> and with good cause, but it would be great if little stuff like this
> could make it in somewhere. I don't know if you're the right person to
> say this to, but I figured I'd mention it just in case.


There's the release notes, but they're already long enough to put people
off, and we do actually want everyone to read those.  I don't think this one
made the notes, which was probably a fair decision - I'm not sure anyone has
ever hit it in practice.  It was noticed in code inspection.

Anyway, noted, though yes, I'm not a terribly helpful person to tell about
it. :-)

(I didn't do any of this work, by the way, just relaying it.)

-Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Bill Hernandez

On May 14, 2010, at 2:14 PM, Jens Alfke wrote:

> You don't have to use any particular version control system to use gists. 
> It's just a service provided by GitHub. All it does is let you paste in some 
> source code to create a web page from it, with syntax highlighting and line 
> numbers and everything. Then you can link to it or even inline it into your 
> page.


I tried a page on, but it didn't do the color highlighting, I need to see if 
there are some options that I need to set, etc.

https://gist.github.com/53cc09788370d2acd21b

https://gist.github.com/2c096e1576c128e12800

I dont have a problem generating any kind of html, or php, I prefer colored 
syntax similar to my screen captures. I really like the way Cocoa does the 
Midnight Color Theme.

>> I got a really nasty note from some guy that hated the font I used. Go 
>> figure ?
> 
> I wasn't going to say anything, but since you're already complaining about 
> people not taking your site seriously: 

I wasn't complaining. When I started learning Cocoa I decided I would try to 
document what I learned from a beginner's perspective, in the hopes that it 
would help somebody else. 

After I had posted a few tutorials I began to notice that several hundred 
people had at least looked at the messages I posted on the different forums 
that kept counters, and the AwStats on my hosting service showed that I was 
getting 30,000 hits a month on my website, I was floored, I had no clue that 
anybody would even look at my stuff. It made me very happy that maybe some of 
this stuff was helping others.

Anytime I posted the messages I always asked if possible for some feedback in 
order to help me make the tutorials more useful, but nobody ever said anything. 
I understand it takes effort to sit down and give feedback. Since I started 
doing this I have been more conscious to give others feedback on their efforts. 
 I got three or four nice notes and one ugly one, but no real feedback

As for the font, I happen to like it better that arial, helvetica, lucida, 
etc., but I will try to find another font that might be an alternative.

> Comic Sans is a poor choice on several levels. It has poor legibility, its 
> silly appearance conflicts with the serious nature of your site, and a lot of 
> people (especially designers) hate it with a passion because it's both poorly 
> designed and incredibly overused by people trying to be cute. So it conveys 
> sort of the same effect as if you were using animated GIFs of sparkly 
> rainbows in the background of your site :)

Thanks for the feedback !

Bill Hernandez
Plano, Texas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Encode a 'Class' type using NSValue

2010-05-14 Thread Michael Ash
On Fri, May 14, 2010 at 5:45 AM, Billy Flatman  wrote:
> Hi Quincey,
>
> Thanks for you help. I am trying to pass the class reference around for drag 
> and drop, I think i'll try your idea of converting the pointer to a number,

The best way to pass arbitrary pointers around your app for drag and
drop is to add a method to retrieve that pointer to your dragging
source, then the destination can use [[draggingInfo draggingSource]
retrieveWhateverInfo] to get it. This avoids all of this scary
pasteboard manipulation, and ensures that inter-process drags don't
explode because the pointer went invalid.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [[NSFileManager alloc] init] considered thread-safe

2010-05-14 Thread Michael Ash
On Fri, May 14, 2010 at 1:12 PM, Ken Ferry  wrote:
> On Wed, May 5, 2010 at 11:33 AM, Michael Ash  wrote:
>>
>> On Wed, May 5, 2010 at 2:29 PM, Jens Alfke  wrote:
>> >
>> > On May 5, 2010, at 8:50 AM, Michael Ash wrote:
>> >
>> >>> Delegates are the only reason the doc says anything other than "go
>> >>> nuts".
>> >>>  This is what both Jens and I were trying to say.
>> >>
>> >> Is this true for all OS X versions, for 10.6+, or some other
>> >> combination?
>> >
>> > For all, I think, although the issue doesn’t apply prior to 10.5 because
>> > there wasn’t a delegate. Aside from the delegate, NSFileManager is really
>> > just a stateless procedural API wrapped up in an object instance, so it has
>> > the same thread safety as the underlying filesystem calls, i.e. “go nuts”.
>>
>> That's what I would have thought, but it was explicitly listed as not
>> being thread safe before 10.5, and is still listed as "v10.5 and
>> later" next to the entry that marks it as thread safe in the Cocoa
>> thread safety summary.
>>
>> Just because the API is stateless doesn't mean the object itself
>> doesn't have any state underneath. It *shouldn't*, but I'd tend to
>> trust the API docs.
>>
>> However, I'm only targeting 10.5 these days, and that doc answers my
>> question, so I'm in good shape! I should have looked there first.
>
> There did used to be thread-safety problems..  the class was redone when the
> NSError returning methods were added in 10.5.
> There was one lesser thread safety fix in 10.6.  +defaultManager was
> previously using the simple version of a singleton method Mike discusses at
> .
>  This could potentially cause a crash if you managed to use the
> defaultManager in the midst of its setup.
> The workaround for 10.5 would be to call +defaultManager once from the main
> thread before[1] it might happen on a background thread. This is pretty
> likely to happen as a normal part of app initialization.

Thanks for the detailed reply!

Regarding that 10.5 singleton safety bug, is this documented anywhere?
It seems like there are a lot of minor bugs which get fixed in later
OS revisions but persist in earlier ones that we often have to support
for a while. There are often easy workarounds like this, but we don't
find out they're necessary until we happen, by chance, to say the
right thing to the right Apple engineer on a mailing list.

I know Apple documentation concentrates heavily on the latest release,
and with good cause, but it would be great if little stuff like this
could make it in somewhere. I don't know if you're the right person to
say this to, but I figured I'd mention it just in case.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Jens Alfke


On May 14, 2010, at 12:11 PM, Bill Hernandez wrote:

It looks pretty nice, I will have to spend some time trying to see  
how I can use it.
I had been using SubVersion via Apache on my OS X Server, and  
finally gave up and I am using something I wrote temporarily. I have  
heard good things about GIT, and really need to see how that would  
work.


You don't have to use any particular version control system to use  
gists. It's just a service provided by GitHub. All it does is let you  
paste in some source code to create a web page from it, with syntax  
highlighting and line numbers and everything. Then you can link to it  
or even inline it into your page.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Bill Hernandez

On May 14, 2010, at 1:39 PM, Daniel Grace wrote:

> There's something called Gist. It's largely part of github, but you
> don't have to use github to use it. There are other choices, but I do
> use github, so Gist is the one that I'm aware of.
> 
> http://gist.github.com/
> 
> Not saying that you have to use it, but it's always good to be aware
> of all of your choices.
> 
> Daniel
> http://www.doomstick.com


Daniel,

It looks pretty nice, I will have to spend some time trying to see how I can 
use it.

I had been using SubVersion via Apache on my OS X Server, and finally gave up 
and I am using something I wrote temporarily. I have heard good things about 
GIT, and really need to see how that would work.

More importantly how might be a good way to setup my workflow to take advantage 
of GIT.

Thanks a lot for taking the time to help...

Bill Hernandez
Plano, Texas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crash Question

2010-05-14 Thread Dave Carrigan

On May 14, 2010, at 12:01 PM, k...@highrolls.net wrote:

> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x0845
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Application Specific Information:
> objc_msgSend() selector name: release
> 
> 
> Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
> 0   libobjc.A.dylib   0x94df2edb objc_msgSend + 27
> 
> 
> Is this telling me I crashed releasing some object?


Most likely over-releasing some object.

-- 
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crash Question

2010-05-14 Thread Kyle Sluder
On Fri, May 14, 2010 at 12:01 PM,   wrote:
> Is this telling me I crashed releasing some object?

See "So you crashed in objc_msgSend()":
http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Crash Question

2010-05-14 Thread koko

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0845
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: release


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib   0x94df2edb objc_msgSend  
+ 27



Is this telling me I crashed releasing some object?

-koko
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Looking for Cocoa Drawing Strategy Advice

2010-05-14 Thread Philip Regan
Howdy--

I am porting a GUI-based MIDI editor from REALbasic to Cocoa to take advantage 
of the framework for all sorts of reason (though it seems mainly in an effort 
to torture myself with programming ;-)). I have the model and controller 
aspects stragetized, and I have cooked up a core working project, but I'm 
looking for strategies and best practices on certain aspects about drawing with 
views and hierarchies. I've read the Cocoa Drawing Guide and related materials, 
but I have some questions that those materials either don't cover well (if at 
all)

The feature that I'm stuck on sorting on how best to implement is custom 
rulers—multiple types of horizontal rulers that can be shown and hidden by the 
user together or alone (or none at all), each with their own editable objects 
and types of hash marks (if any at all), and a vertical ruler that requires 
actual art and interaction as opposed to just hash marks. From what I can 
surmise from the documentation and reading other questions on various forums, 
there are two ways to handle this...

The first strategy I'm looking at is to use the already supplied NSRulerViews 
to create my own view hierarchy to manage and draw as I see fit. I'm leaning 
towards this method because it seems to be more of what Cocoa would expect, but 
it also seems as though the NSRulerView has a very pre-determined use that 
really can't be modified too much without a whole lot of trouble.

The second strategy is to draw the rulers in the main NSView nested in the 
NSScrollView and use NSClipView to maintain their position on the left and top 
of the NSScrollView. But that seems kludgey to me somehow.

Also, I'm looking to incorporate certain simple 2D drawing techniques like 
rounded corners, transparency, and possibly drop shadows. In a GUI interface is 
there a graphics library I should stick with or ones that I should stay away 
from (I know OpenGL is overkill here, but would CoreAnimation be a bad thing in 
a drag-and-drop editing scenario).

Just to be clear, I'm not looking for actual code or someone to do the work for 
me, but I would really appreciate any feedback anyone has based on their 
experience. I know either way I'm looking at a lot of work, so a point towards 
the "right" direction is really all I need here to ensure I'm not losing more 
time that I already am now.

Thanks

-- 
Philip Regan
http://www.oatmealandcoffee.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: new to cocoa

2010-05-14 Thread Alejandro Marcos Aragón
Thanks Kiel for answering so fast. I realized that this was the case a couple 
of days ago. It took some time for my message to appear in the mailing list. I 
was trying to associate buttons with objects so that when I press the button I 
can do certain action on the corresponding object. I solved the problem using 
just two regular NSMutableArrays. It's doing the same thing though, creating a 
map of buttons to objects, but using the index to these arrays. It doesn't seem 
to be very efficient though.

aa


On May 13, 2010, at 11:38 PM, Kiel Gillard wrote:

> On 12/05/2010, at 6:36 AM, Alejandro Marcos Aragón wrote:
> 
>> Hi all,
>> 
>> I'm new to Cocoa, and I couldn't find information about an error that I'm 
>> getting on the web. I'm trying to create an NSMutableDictionary where the 
>> keys are of type UIButton*:
>> 
>> 
>>  // create button for unit
>>  UIButton* unitButton = [[UIButton alloc] init];
>>  [sourceButtonMap setObject:[NSString 
>> stringWithString:@"no"] forKey:unitButton];
>> 
>> Of course, the sourceButtonMap is defined in the class and initialized in 
>> the init function as sourceButtonMap = [[NSMutableDictionary alloc] init];
>> 
>> The error I get when I try to add the key-value pair is:
>> 
>> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
>> reason: '*** -[UIButton copyWithZone:]: unrecognized selector sent to 
>> instance 0x3931e90'
>> 
>> Is this happening because I can't store UIButton* as keys?
> 
> Welcome to iPhone OS development!
> 
> This most certainly is happening because you cannot use UIButton objects as 
> keys in a dictionary because NSDictionary copies the objects used as keys. 
> Furthermore, UIButton does implement the NSCopying methods.
> 
>> Can anyone point me why I'm getting this error? Thank you all,
> 
> 
> 
> See the second paragraph of the section titled "Overview".
> 
> I suggest you revise your design. I don't know exactly what you're trying to 
> do. Perhaps @"no" should be the key for the UIButton?
> 
> Kiel
> 
> 
>> 
>> aa___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
>> 
>> This email sent to kiel.gill...@gmail.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Daniel Grace
> ( 3 ) In order to show the source code (exactly as the screen captures show) 
> using HTML would require so much more work for me, that I would just quit 
> doing these little tutorials altogether. I know that most people on these 
> forums know a whole lot more than me, and that's OK, but most most of them 
> don't have the time to create tutorials, so hopefully there will be some 
> people that can benefit from the incredible amount of time it takes to figure 
> out some of this stuff. This Cocoa stuff is geared for the beginner like 
> myself, obviously not for the experts on this forum.

There's something called Gist. It's largely part of github, but you
don't have to use github to use it. There are other choices, but I do
use github, so Gist is the one that I'm aware of.

http://gist.github.com/

Not saying that you have to use it, but it's always good to be aware
of all of your choices.

Daniel
http://www.doomstick.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Bill Hernandez
On May 14, 2010, at 12:05 PM, Jens Alfke wrote:

> Oh, also, a comment on the site design: why do you present source code in the 
> form of screenshots of Xcode windows? This makes it impossible for a user to 
> copy the text easily, for a blind user to read it at all, or for a search 
> engine to index it. It also consumes orders of more bandwidth (for you and 
> the viewer) than just the plain text would.
> 
> —Jens


> Oh, also, a comment on the site design: why do you present source code in the 
> form of screenshots of Xcode windows?

( 1 ) I frequently make circles, boxes, and arrows around some of the code 
images.
( 2 ) All the colors are accentuated, and the user sees exactly what I see.
( 3 ) In order to show the source code (exactly as the screen captures show) 
using HTML would require so much more work for me, that I would just quit doing 
these little tutorials altogether. I know that most people on these forums know 
a whole lot more than me, and that's OK, but most most of them don't have the 
time to create tutorials, so hopefully there will be some people that can 
benefit from the incredible amount of time it takes to figure out some of this 
stuff. This Cocoa stuff is geared for the beginner like myself, obviously not 
for the experts on this forum.

> This makes it impossible for a user to copy the text easily, for a blind user 
> to read it at all, or for a search engine to index it.

I agree with what you are saying, but I include the xcode projects for the user 
to download. This way they can make sure that the projects work as expected. I 
have spent so much time reading text tutorials, that after I copy and paste, 
etc. will not run at all, and when you try to write to the author, they do not 
respond.

> It also consumes orders of more bandwidth (for you and the viewer) than just 
> the plain text would.

Because I am not a good writer, I prefer to have more images with minimal text. 
That is my preferred style.

On my home page at http://www.journey-of-flight.com , I have the following at 
the top of the page :
--
NOTE : I got some feedback from someone with a low speed connection : "If you 
don't have a high speed connection, you may want to avoid my site. All the 
tutorials have a lot of images which might load slow otherwise. I tend to 
forget that I am extremely fortunate to have (20/5) MBit Business FIOS service 
at home, so for me they load lightning quick, but please be aware of the 
loading time if you do have a slow connection." If you have suggestions, or 
comments, that's fine, but try to keep them polite... 
--

We all have different styles, and it is tough to please everybody. A couple of 
times I thought I would close down the website, or at least remove the Cocoa 
stuff, because I would post the tutorials on some of the boards and ask for 
feedback, and I can count on one hand the few times anyone said anything, 
positive or negative. I got a really nasty note from some guy that hated the 
font I used. Go figure ?

Then yesterday out of the clear blue sky, I got the following, and I was 
floored that someone appreciated the work :
--
From:   scott.m.ba...@mchsi.com
Subject:Saw some of your work on your website... (and it rocks)
Date:   May 13, 2010 12:58:14 PM CDT
To: Bill Hernandez 

Hey Bill,

I just wanted to reach out and thank you for all of your absolutely fantastic 
Xcode tutorials with relation to Obj-C and Interface Builder.  I had been a 
long time AppleScript Studio user (then had to move over to Windows programming 
for a few years) and I recently had to come back over to the Mac to work on a 
project.  Of course upon arrival, I was shocked to see ASS had been replaced 
with AppleScriptObjC.  Thus began my (rather short) journey into learning it 
and after about 90 minutes of quite a few "why wouldn't I just use Obj-C but I 
don't know it" fears, I came across your site and all my doubts about being 
able to use it went right away.  I am a pretty experienced C# guy and I was 
actually pleasantly surprised to see how easy it was to make the connection 
between the two.  Your IB tutorials helped fill the gaps (amazed at how easy it 
really is) and I am on my way.  I'll also be picking up some of your 
recommended books but overall I have you to thank for really connecting the 
dots and pointing my in the right direction.

So thanks again Bill.  Truly, truly appreciate your site!!

Scott
--
 Anyway Jens, thanks for the feedback. I'll think about what you said...

Best Regards,

Bill Hernandez
Plano, Texas
http://www.journey-of-flight.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mai

Re: Image from WebView is sometimes blank

2010-05-14 Thread Adam R. Maxwell

On May 11, 2010, at 2:33 PM, Duncan Oliver wrote:

> I have a WebView that I use to capture a thumbnail of a loaded webpage
> using cacheDisplayInRect:. The WebView object is created
> programmatically and not attached to a window. About half the time,
> the image it grabs is blank. I can't seem to figure out if I'm trying
> to grab it too soon or what. Would love to know how to get a completed
> image all the time. Thanks in advance.

This can be kind of tricky, especially when you need to make it work for 
arbitrary pages; just figuring out when the webview finishes loading is tricky, 
since -[WebView isLoading] doesn't account for redirection.

> 
> Here's the code:
> 
> - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
> {
>   if ([frame isEqualTo:[sender mainFrame]])
>   {

My first guess is that pages aren't fully loaded when you get this callback, 
but that's generally only a problem with redirects.

>   if ([sender saveThumbnail] == YES)
>   {
>   NSView *mainFrameView = sender.mainFrame.frameView;
>   NSBitmapImageRep *thumbnailImageRep = [mainFrameView
> bitmapImageRepForCachingDisplayInRect:[mainFrameView frame]];
>   [sender cacheDisplayInRect:[mainFrameView frame]
> toBitmapImageRep:thumbnailImageRep];

Another potential problem is that you need to force layout in the 
WebDocumentView; this shouldn't be necessary, but I couldn't find any other 
workaround.  Try sending

[[mainFrameView documentView] layout];

before calling -cacheDisplayInRect:toBitmapImageRep:.  This fixed a bunch of 
random white page issues for me.  If you use -[WebFrameView 
setAllowsScrolling:NO] at some point, the problem is much worse (as of Safari 
4.0.3).

I have a BSD-licensed web thumbnail class here:

http://code.google.com/p/fileview/source/browse/trunk/fileview/FVWebViewIcon.m

It's complicated by threading issues, but shows one way to track redirected 
frames during loading, and also how to draw.

hth,
Adam




smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Jens Alfke


On May 14, 2010, at 10:30 AM, Thomas Wetmore wrote:

I must say that I am constantly amused by the nanniness of the Apple  
discussion lists, telling people what is safe and what is dangerous.


I'm trying to help people out, many of whom are newbies at Cocoa or at  
app programming in general. It's often helpful to go beyond the  
immediate question.


There is nothing dangerous about bit-twiddling code. You test it til  
it works and then it works forever. It doesn't develop bugs  
later. ... This is good, honest, easy to write, easy to debug  
software.


I didn't see any unit tests in the code you provided ;-) And I'd want  
to see tests for all input lengths modulo four, as well as every  
length up to 8, with different bit patterns to test the carries.


Speaking of 'developing bugs later', there was plenty of code (at  
Apple and outside) similar to this that worked just great for years  
and years … until the transition to x86. Because no one had ever  
tested it on little-endian CPUs. Have you tested your code on both,  
including encoding on one architecture and decoding on the other?


Seriously, if I tried to check this in here at Google, it wouldn't  
pass code review. The response would be to use an existing library  
routine instead of re-inventing the wheel.


I'm not at all accusing you of not being smart enough to implement  
this! The same thing happens to me — a few months ago I wrote a cut- 
and-dried binary-search routine that I managed to introduce enough  
subtle mistakes into that it wasted most of an afternoon of debugging.  
In retrospect I should have just used bsearch instead. There have been  
plenty of dormant mistakes in 'simple' algorithms (like the unit  
converter in a failed Mars probe, or the insecure random-number  
generator in Debian's OpenSSL library) that caused huge problems later  
on.


In my application databases can be very large, having millions if  
not billions of records. The goal is that every instance of the  
application, wherever it is being run, will generate record ids that  
are not only unique to itself, but to every other instance of the  
application.


That's reasonable; I think 128 bits is large enough that you're not  
going to have any trouble with birthday-paradox collisions. But why  
not use a blob column for the UUID instead of converting it to ASCII?


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSArrayController Undo

2010-05-14 Thread Quincey Morris
On May 14, 2010, at 10:44, Richard Somers wrote:

> I see what you are saying. The path I was following was a little different. 
> Each model object has a 'selected' attribute or property. When the array 
> controller selection is set, the model objects 'selected' property is also 
> set. What I was trying to do was figure out how to get each model object's 
> 'selected' property back into the array controller's selection.

Well, binding the array controller's selection indexes is the easy way. :)

> You are suggesting that I just use the array controller's selection, which is 
> an index set, and just put that into Core Data. That would work for a 
> transient property but not for an on disk persistent store. The index set of 
> the array controller is based on an in-memory arrangement of model objects 
> and could change and does change from one document opening to the next. But 
> if I do not need persistence this might be the way to go.

You can easily write your own reversible transformer to convert between index 
sets and whatever you want the persistent representation to be. Two points to 
note:

1. This is somewhat more convenient now that you no longer have to register 
transformers manually on application startup. (The documentation used to be a 
bit unclear on this.)

2. Warning! Core Data runs custom transformers in the *opposite* direction from 
the standard one. (The documentation used to be a bit unclear on this.)


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSArrayController Undo

2010-05-14 Thread Richard Somers

On May 14, 2010, at 10:25 AM, Quincey Morris wrote:

If I understand you correctly, you're on the right track -- you want  
to bind the array controller's selection indexes to your data  
model's selection property. However, Core Data properties don't  
support index sets as a standard data type, so you have more work to  
do. Since NSIndexSet supports NSCoding, your easiest choice is  
probably to make your selection a transformable attribute. That  
means Core Data automatically converts the value to and from an  
archive using a standard transformer.


I see what you are saying. The path I was following was a little  
different. Each model object has a 'selected' attribute or property.  
When the array controller selection is set, the model objects  
'selected' property is also set. What I was trying to do was figure  
out how to get each model object's 'selected' property back into the  
array controller's selection.


You are suggesting that I just use the array controller's selection,  
which is an index set, and just put that into Core Data. That would  
work for a transient property but not for an on disk persistent store.  
The index set of the array controller is based on an in-memory  
arrangement of model objects and could change and does change from one  
document opening to the next. But if I do not need persistence this  
might be the way to go.


--Richard

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Thomas Wetmore
I must say that I am constantly amused by the nanniness of the Apple discussion 
lists, telling people what is safe and what is dangerous. There is nothing 
dangerous about bit-twiddling code. You test it til it works and then it works 
forever. It doesn't develop bugs later. My goal was to use the 128 bits of a 
UUID and encode them for use in genealogical database applications using the 
smallest record id strings possible. My choice was to break the 128-bits into 
22 6-bit sequences and encode each 6-bit sequence as a simple character. This 
is good, honest, easy to write, easy to debug software.

In my application databases can be very large, having millions if not billions 
of records. The goal is that every instance of the application, wherever it is 
being run, will generate record ids that are not only unique to itself, but to 
every other instance of the application. In this way people can share 
information with one another knowing with assurance that any data imported from 
a database created by another instance of the program will never have id 
clashes. It is not intended that massive numbers of records be transferred over 
the network, though they could be, just that data can be shared between 
databases to any extent with no clashes. There are other benefits such a system 
has for genealogical data, but what I have described here is good enough.

Tom "danger is my middle name" Wetmore


On May 14, 2010, at 1:00 PM, Jens Alfke wrote:

> (2) If you do need to convert to string, it would be safer to use an existing 
> Base64 converter rather than writing your own as you've done. This kind of 
> bit-twiddling code is very prone to error. Probably the quickest way is to 
> use the Base64 support in the OpenSSL library; a bit of searching in the list 
> archives should turn up some sample code.
> 
> (3) I'm sort of confused by Thomas Wetmore's comment that "my application 
> generates billions of [unique ids]". That's way too many to be sending over 
> the network, so these must be used locally. But in that case, generating 
> unique IDs becomes much easier, and the IDs a lot smaller: just increment a 
> 32-bit counter.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Encode a 'Class' type using NSValue

2010-05-14 Thread Jens Alfke


On May 14, 2010, at 2:45 AM, Billy Flatman wrote:

Thanks for you help. I am trying to pass the class reference around  
for drag and drop, I think i'll try your idea of converting the  
pointer to a number,


Encoding pointer values in archives is a very bad idea, since if the  
archive gets decoded in a different process, the pointer will be  
garbage and very likely to cause a crash.


You may think this isn't a problem for D&D since the result will get  
used immediately, but it's fairly easily for drags to get persisted:  
just drag to the Finder and you'll get a clipping file that can be  
dragged back into your app at any future time. It's also possible that  
another app might want to make itself interoperable with your app's  
drag format, which would be impossible if you use pointers.


Why not just archive the class's name?

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [[NSFileManager alloc] init] considered thread-safe

2010-05-14 Thread Ken Ferry
On Wed, May 5, 2010 at 11:33 AM, Michael Ash  wrote:

> On Wed, May 5, 2010 at 2:29 PM, Jens Alfke  wrote:
> >
> > On May 5, 2010, at 8:50 AM, Michael Ash wrote:
> >
> >>> Delegates are the only reason the doc says anything other than "go
> nuts".
> >>>  This is what both Jens and I were trying to say.
> >>
> >> Is this true for all OS X versions, for 10.6+, or some other
> combination?
> >
> > For all, I think, although the issue doesn’t apply prior to 10.5 because
> there wasn’t a delegate. Aside from the delegate, NSFileManager is really
> just a stateless procedural API wrapped up in an object instance, so it has
> the same thread safety as the underlying filesystem calls, i.e. “go nuts”.
>
> That's what I would have thought, but it was explicitly listed as not
> being thread safe before 10.5, and is still listed as "v10.5 and
> later" next to the entry that marks it as thread safe in the Cocoa
> thread safety summary.
>
> Just because the API is stateless doesn't mean the object itself
> doesn't have any state underneath. It *shouldn't*, but I'd tend to
> trust the API docs.
>
> However, I'm only targeting 10.5 these days, and that doc answers my
> question, so I'm in good shape! I should have looked there first.
>

There did used to be thread-safety problems..  the class was redone when the
NSError returning methods were added in 10.5.

There was one lesser thread safety fix in 10.6.  +defaultManager was
previously using the simple version of a singleton method Mike discusses at
<
http://www.mikeash.com/pyblog/friday-qa-2009-10-02-care-and-feeding-of-singletons.html>.
 This could potentially cause a crash if you managed to use the
defaultManager in the midst of its setup.

The workaround for 10.5 would be to call +defaultManager once from the main
thread before[1] it might happen on a background thread. This is pretty
likely to happen as a normal part of app initialization.

-Ken

[1] "before" here means something
complicated if
you're trying to be exact about it, but if you do it before spawning threads
of your own, you're good.



>
> Mike
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AsyncUdpSocket: Receiving duplicate UDP Packet

2010-05-14 Thread Jens Alfke


On May 12, 2010, at 7:35 PM, Todd Burch wrote:

I'm early in development, and all I'm doing is receiving a UDP  
packet over a given port, and logging it to the console. However,  
for some reason my UDP packet (transmitted from other software)  
appears to be arriving twice!


The previous advice should solve the immediate problem. But be aware  
that your code needs to be able to handle duplicate packets, as well  
as dropped packets. Both are entirely possible due to the way IP  
routing works. That's why it's called the Unreliable Datagram  
Protocol :)


Both cases are fairly rare with modern networks, but they do happen,  
and if your protocol doesn't deal with them, the result will be  
intermittent and hard-to-reproduce failures.


The usual solution is to put a serial number in each packet. That way  
the recipient can detect if it receives the same serial number twice  
and ignore the second one. They're also useful for putting out-of- 
order packets back in order — that's a likely scenario if the packets  
are traveling a long distance since they might take different routes.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Jens Alfke
Oh, also, a comment on the site design: why do you present source code  
in the form of screenshots of Xcode windows? This makes it impossible  
for a user to copy the text easily, for a blind user to read it at  
all, or for a search engine to index it. It also consumes orders of  
more bandwidth (for you and the viewer) than just the plain text would.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Jens Alfke

A couple of points on the code:

(1) If you're concerned about size, store the IDs in NSData instead of  
NSString. That way you get the full 8 bits per byte instead of 6, and  
avoid the complication of translating to and from ASCII.


(2) If you do need to convert to string, it would be safer to use an  
existing Base64 converter rather than writing your own as you've done.  
This kind of bit-twiddling code is very prone to error. Probably the  
quickest way is to use the Base64 support in the OpenSSL library; a  
bit of searching in the list archives should turn up some sample code.


(3) I'm sort of confused by Thomas Wetmore's comment that "my  
application generates billions of [unique ids]". That's way too many  
to be sending over the network, so these must be used locally. But in  
that case, generating unique IDs becomes much easier, and the IDs a  
lot smaller: just increment a 32-bit counter.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: how to terminate first AlertPanel when second AlertPanel appears?

2010-05-14 Thread Jens Alfke


On May 14, 2010, at 12:13 AM, kirankumar wrote:

I am developing one application in that i want to add device  
request  feature ,for that i am sending a message like  
"DeviceRequest" .
if this message is send to other pc in that pc it shows one Alert  
message (NSRunAlertPanel(@"Request",@"Please Disconnect the  
device",@"ok",@"",nil);
But again i am sending a devicerequest ,at that time first message  
will display like that only untill i click on Ok button.
my question is i want to terminate the first message when second  
message appears.


Short answer: there's no way to cancel NSRunAlertPanel or NSAlert  
without user action.


In general you should ignore or queue up messages that arrive while  
the runloop is in the NSModalPanelRunLoopMode. (Ignoring is better,  
since if you queue up a ton of messages, the user gets one alert panel  
after another with no way to escape.)


If you absolutely have to have an alert panel that you can dismiss  
automatically, build your own using a nib. It's not hard; NSAlert is  
just a convenience. But this is IMHO a bad UI because it can confuse  
the user to have a window disappear right as s/he was about to click  
in it, possibly causing an accidental click in the window below.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AsyncUdpSocket: Receiving duplicate UDP Packet

2010-05-14 Thread Greg Guerin

Todd Burch wrote:

 [aSyncSocket receiveWithTimeout:-1 tag:1];  //Listen for the  
next UDP packet to arrive...which will call this method again in turn.


Don't start another receive.

Handle or ignore the packet, then always return NO from the delegate  
method.  The single outstanding receive will continue receiving  
packets and passing them to the delegate.  Don't return YES until you  
want it to stop receiving callbacks.  It seems wacky but it worked  
for me.


And I used a large timeout (1.0e9), not a negative one.

  -- GG
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: new to cocoa

2010-05-14 Thread Jens Alfke


On May 11, 2010, at 1:36 PM, Alejandro Marcos Aragón wrote:

I'm new to Cocoa, and I couldn't find information about an error  
that I'm getting on the web. I'm trying to create an  
NSMutableDictionary where the keys are of type UIButton*:


Sounds like you're trying to associate data values with buttons. The  
easiest way to do this is to use the control's existing 'tag'  
property, which lets you store an arbitrary integer value. [Actually  
I'm not certain that UIKit controls have tags; their corresponding  
AppKit classes in Mac OS do.]


If you need to store a non-integer value, or have to use a dictionary  
for some other reason, you can use [NSValue valueWithPointer: button]  
to create a value object wrapping a pointer to your button. Those  
values can be used as dictionary keys. To unwrap one, use (UIButton*) 
[value pointerValue]. Just make sure to remove the associated key  
object when a button is deleted, otherwise it's a dangling pointer to  
a deleted object and will cause a crash if you try to use that button  
pointer again.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSArrayController Undo

2010-05-14 Thread Quincey Morris
On May 14, 2010, at 06:43, Richard Somers wrote:

> Currently I track the selection using NSArrayController's selection methods. 
> I have a custom view that figures out what the selection should or should not 
> be and programatically sets the array controller's selection. It works very 
> well and is clean with not much code. Thus pushing the selection from the 
> view to the model is easy, just do it when the selection is pushed to the 
> array controller.
> 
> However, pulling selection changes from the model back into the array 
> controller appears to be challenging. It would seem like bindings could help 
> out here somehow. NSArrayController works with bindings and so does Core 
> Data. Why can't I simply bind the "selectionIndexes" of the array controller 
> to the "selected" model attribute. I have tried this but I can't get the 
> proper bound to object and key path to work. Perhaps NSArrayController is not 
> designed to work in this fashion.

"Does not work" doesn't give us much to go on.

If I understand you correctly, you're on the right track -- you want to bind 
the array controller's selection indexes to your data model's selection 
property. However, Core Data properties don't support index sets as a standard 
data type, so you have more work to do. Since NSIndexSet supports NSCoding, 
your easiest choice is probably to make your selection a transformable 
attribute. That means Core Data automatically converts the value to and from an 
archive using a standard transformer.

An alternative would be to try using the undefined attribute type (but it has 
to be transient). Another alternative is a full-blown custom accessor 
implementation, which is kind of a PITA to get right.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSArrayController Undo

2010-05-14 Thread Richard Somers

On May 13, 2010, at 10:59 PM, Quincey Morris wrote:

This is a little bit harder than it seems. You certainly want to  
have the document undo manager keep track of the selection changes,  
in order to stay in sync with the really undoable changes. So:


1. You need to add a transient property for the selection to your  
managed data model. (Or non-transient, if you want the selection to  
persist when the document is re-opened.)


Done. Works well.

2. You need to keep track of the changes to the selection by  
modifying your Core Data selection property whenever the selection  
changes. However, you don't want these to be recorded as undoable  
actions (most likely, although there are scenarios -- think of  
Photoshop -- where selection changes are undoable), so you have to  
disable the undo manager temporarily around such changes. (Don't  
forget to invoke processPendingChanges before disabling the undo  
manager, and again before enabling it.)


Currently I track the selection using NSArrayController's selection  
methods. I have a custom view that figures out what the selection  
should or should not be and programatically sets the array  
controller's selection. It works very well and is clean with not much  
code. Thus pushing the selection from the view to the model is easy,  
just do it when the selection is pushed to the array controller.


However, pulling selection changes from the model back into the array  
controller appears to be challenging. It would seem like bindings  
could help out here somehow. NSArrayController works with bindings and  
so does Core Data. Why can't I simply bind the "selectionIndexes" of  
the array controller to the "selected" model attribute. I have tried  
this but I can't get the proper bound to object and key path to work.  
Perhaps NSArrayController is not designed to work in this fashion.


--Richard

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding which window is causing the "NSWindow does not support utility styleMask 0x10" error

2010-05-14 Thread Gideon King
Found it - 

find . -name "*xib" -print -exec grep NSWindowStyleMask {} \;

was my friend.

Gideon


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding which window is causing the "NSWindow does not support utility styleMask 0x10" error

2010-05-14 Thread Andy Lee
Just a guess -- I'm looking at a xib file and I see this line:

15

Maybe you could grep your xib's for NSWindowStyleMask, look at the output, and 
AND the values with 0x10.

--Andy

On May 14, 2010, at 7:29 AM, Gideon King wrote:

> I obviously have the utility style mask set on a window somewhere in one of 
> my nibs, but I have 40 nibs in my project and it would take ages to go 
> through every one of the windows in every nib to find the culprit. Is there 
> some way I can search in my xib files, or set a breakpoint in my code so that 
> I can shortcut the process of identifying the window causing this?
> 
> Thanks
> 
> Gideon
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
> 
> This email sent to ag...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Finding which window is causing the "NSWindow does not support utility styleMask 0x10" error

2010-05-14 Thread Gideon King
I obviously have the utility style mask set on a window somewhere in one of my 
nibs, but I have 40 nibs in my project and it would take ages to go through 
every one of the windows in every nib to find the culprit. Is there some way I 
can search in my xib files, or set a breakpoint in my code so that I can 
shortcut the process of identifying the window causing this?

Thanks

Gideon





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Newbie: UITextView in Landscape

2010-05-14 Thread Arnold Nefkens
Hi List, 

Still new to Cocoa...

In placed a new ViewController following the example in UICatalog. I got it 
working but was wondering how to make the view also editable in landscape 
view...

Below is the code to display the keyboard and hide the keyboard, which I 
supplemented with the if... else if statements.

- (void)keyboardWillShow:(NSNotification *)aNotification 
{
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] 
statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait) {
// the keyboard is showing so resize the table's height
CGRect keyboardRect = [[[aNotification userInfo] 
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
NSTimeInterval animationDuration = [[[aNotification userInfo] 
objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
CGRect frame = self.view.frame;
frame.size.height -= keyboardRect.size.height;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
self.view.frame = frame;
[UIView commitAnimations];
} else if (orientation == UIInterfaceOrientationLandscapeLeft) {
NSLog(@"Left"); // Verijderen later
CGRect keyboardRect = [[[aNotification userInfo] 
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
NSTimeInterval animationDuration = [[[aNotification userInfo] 
objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
CGRect frame = self.view.frame;
frame.size.height -= keyboardRect.size.height;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
self.view.frame = frame;
[UIView commitAnimations];
} else if (orientation == UIInterfaceOrientationLandscapeRight){
NSLog(@"Right"); // verwijderen later.
CGRect keyboardRect = [[[aNotification userInfo] 
objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
NSTimeInterval animationDuration = [[[aNotification userInfo] 
objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
CGRect frame = self.view.frame;
frame.size.width -= keyboardRect.size.width;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
self.view.frame = frame;
[UIView commitAnimations];
}

}

I know that I have to change the line frame.size.hight -= 
keyboardRect.size.hight, but I cannot figure out into what

If I change the line in the landscape left mode to: frame.size.width -= 
keyboardRect.size.width. The view works, but the statusbar is huge, and the 
right button is gone 

Into what do I have to change this line

Kind regards in advance

Arnold Nefkens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Encode a 'Class' type using NSValue

2010-05-14 Thread Billy Flatman
Hi Quincey,

Thanks for you help. I am trying to pass the class reference around for drag 
and drop, I think i'll try your idea of converting the pointer to a number,

Cheers,

Billy.

On 14 May 2010, at 10:34, Quincey Morris wrote:

> On May 14, 2010, at 02:13, Billy Flatman wrote:
> 
>> I'm trying to encode a 'Class' type parameter in an class implementing the 
>> NSCoding interface, but I keep getting the error 'cannot encode (void *) 
>> value: '.
>> 
>> Here's an extract the class I'm encoding:
>> 
>> @interface IFNode : NSObject  {
>>  Class persistentObjectClass;
>> }
>> @property (nonatomic, retain) Class persistentObjectClass;
>> @end
>> 
>> @implementation IFNode
>> @synthesize persistentObjectClass;
>> - (void) encodeWithCoder: (NSCoder *) encoder {
>>  NSValue* value = [[NSValue valueWithPointer:persistentObjectClass] 
>> retain];
>>  [encoder encodeObject:value forKey:@"Class"];
>> }
> 
> NSValue doesn't support encoding for this sort of value:
> 
>   
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/codingctypes.html
> 
> What are you really trying to do?
> 
> If you're trying to have something persist across uses of your application, 
> it makes no sense to archive the class object pointer. Archive the class name 
> instead (via NSStringFromClass).
> 
> If you're just trying to pass the class pointer around within the application 
> (like for dragging or putting something on a private pasteboard), you could 
> probably do it by casting the pointer to a number for encoding, and cast it 
> back to a pointer on decoding, but you're likely still far better off 
> archiving the class name instead.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/b.flatman%40googlemail.com
> 
> This email sent to b.flat...@googlemail.com

Billy Flatman
b.flat...@googlemail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[Solved]: Noise in CALayer

2010-05-14 Thread Chaitanya Pandit
BINGO! that did the trick!

Thanks Bertrand!

Chaitanya Pandit

On May 14, 2010, at 11:28 AM, Bertrand Landry-Hetu wrote:

> By the looks of that screen shot I'd suggest you had a look at the
> bitmap used to fade out the reflection, there is probably a semi
> transparent gradient being drawn on top of a uninitialized image
> buffer. The easiest way to fix this is to fill it with [NSColor
> clearColor] before drawing the gradient.
> 
> 2010/5/14 Chaitanya Pandit :
>> I'm playing with cover flow in one of my apps with the "CovertFlow" sample 
>> code from apple (http://www.letscocoa.com/CovertFlow.zip)
>> However, sometimes i see a weird noise kinda thing in the shadows, here is a 
>> snapshot:
>> http://cl.ly/17ci
>> 
>> Any idea what might be going wrong?
>> 
>> Thanks,
>> 
>> Chaitanya Pandit
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/bertrandl%40gmail.com
>> 
>> This email sent to bertra...@gmail.com
>> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Encode a 'Class' type using NSValue

2010-05-14 Thread Quincey Morris
On May 14, 2010, at 02:13, Billy Flatman wrote:

> I'm trying to encode a 'Class' type parameter in an class implementing the 
> NSCoding interface, but I keep getting the error 'cannot encode (void *) 
> value: '.
> 
> Here's an extract the class I'm encoding:
> 
> @interface IFNode : NSObject  {
>   Class persistentObjectClass;
> }
> @property (nonatomic, retain) Class persistentObjectClass;
> @end
> 
> @implementation IFNode
> @synthesize persistentObjectClass;
> - (void) encodeWithCoder: (NSCoder *) encoder {
>   NSValue* value = [[NSValue valueWithPointer:persistentObjectClass] 
> retain];
>   [encoder encodeObject:value forKey:@"Class"];
> }

NSValue doesn't support encoding for this sort of value:


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/codingctypes.html

What are you really trying to do?

If you're trying to have something persist across uses of your application, it 
makes no sense to archive the class object pointer. Archive the class name 
instead (via NSStringFromClass).

If you're just trying to pass the class pointer around within the application 
(like for dragging or putting something on a private pasteboard), you could 
probably do it by casting the pointer to a number for encoding, and cast it 
back to a pointer on decoding, but you're likely still far better off archiving 
the class name instead.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iPhone: viewDidAppear called, Default.png still visible

2010-05-14 Thread Thomas Davie

On 12 May 2010, at 17:54, sebi wrote:

> Hello,
> 
> How can I find out if my first view is up and running? When viewDidAppear is 
> called on my fist UIViewController I'm still looking only at the Default.png.
> 
> What I do first in my app is:
> 1. wait for viewDidAppear to be called
> 2. show some wait-indicator
> 3. load some data from the net
> 4. hide the wait-indicator
> 5. display the loaded data
> 
> The problem is, that the Default.png doesn't go away until the data is fully 
> loaded, so the user only sees a passive screen for some time and doesn't know 
> what's going on.
> Where can I start the wait indicator and download process so that the user 
> actually sees it?
> I use some NavigationControllers within a TabBarController, could that be the 
> problem? 

It sounds like you're not handing control back to the run loop at any point in 
this process.  What you probably want to do is this instead:

Main Thread:
1. wait for viewDidAppear to be called
2. show the wait indicator
3. Start thread B
4. Hand control back by leaving your method's scope

Thread B:
1. Load some data from the net.
2. use performSelectorOnMainThread:... to fire off a message that the data has 
finished loading.

Main Thread:
1. On receiving said message, hide the wait indicator
2. display the loaded data.

Bob___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


TUTORIAL: Generating Unique ID Strings

2010-05-14 Thread Bill Hernandez
I ran into an interesting thread on the Cocoa Developers discussion group, and 
thought I 'd try to create a small demo, to see what I could learn, and sure 
enough I learned a lot. There were quite a few people that participated and 
provided a lot of great information, I tried to quote the email messages, and 
give credit to the people that provided some of the code, and the insights. I 
hope I didn't leave any one out, if I did, it was not intentional.

On my website the tutorial is listed under the following :

http://www.journey-of-flight.com/index.php

Cocoa - Generating Unique ID Strings  

or you can reach the page directly at :

http://www.journey-of-flight.com/bh_xcode/how-to/0086_Unique_ID/index.php

I also added a resources link at :

http://www.journey-of-flight.com/bh_xcode/common/cocoa_programming_resources.php

if you see any that I should add, please let me know.

Hope this is useful

Bill Hernandez
Plano, Texas ___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Encode a 'Class' type using NSValue

2010-05-14 Thread Billy Flatman
Hi all,

I'm trying to encode a 'Class' type parameter in an class implementing the 
NSCoding interface, but I keep getting the error 'cannot encode (void *) value: 
'.

Here's an extract the class I'm encoding:

@interface IFNode : NSObject  {
Class persistentObjectClass;
}
@property (nonatomic, retain) Class persistentObjectClass;
@end

@implementation IFNode
@synthesize persistentObjectClass;
- (void) encodeWithCoder: (NSCoder *) encoder {
NSValue* value = [[NSValue valueWithPointer:persistentObjectClass] 
retain];
[encoder encodeObject:value forKey:@"Class"];
}
- (id) initWithCoder: (NSCoder *) decoder {
[((NSValue*)[decoder decodeObjectForKey:@"Class"]) 
getValue:persistentObjectClass];
return self;
}
@end

Any help greatly appreciated.

Cheers,

Billy Flatman
b.flat...@googlemail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSDateFormatter for a web app UTC format

2010-05-14 Thread Keith Blount
Hello,

I'm trying to set up a date formatter to convert a date string I receive from a 
server when downloading and sync'ing notes from web app. The dates I receive 
look like this:

2008-12-18 04:04:20.554442

The API docs for this web app specify that this is in GMT time, technically 
apparently UTC according to their forums. I'm trying to convert this into an 
NSDate using NSDateFormatter, which is all fine except for the milliseconds at 
the end. Here's my formatter:

dateFormatter= [[NSDateFormatteralloc] init];
[dateFormattersetFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormattersetDateFormat:@"-MM-dd HH:mm:ss.SS"];
//[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[dateFormattersetTimeZone:[NSTimeZonetimeZoneWithAbbreviation:@"UTC"]];

The trouble is that whereas the milliseconds on the server are six digits long, 
I only ever get three digits, the last three always being zero.

For instance:

NSString*dateStr = @"2008-12-18 04:04:20.554442";
date = [dateFormatter dateFromString:dateStr];
[dateFormatter setTimeZone:[NSTimeZonesystemTimeZone]];
NSLog (@"%@", [dateFormatter stringFromDate:date]);

The output of this is:

2008-12-18 04:04:20.554000

It's not really a big deal, since any comparison I make will always be between 
rounded dates, so it shouldn't have any significant impact. However, I'm just 
wondering if I'm missing something here or doing something wrong - whether it 
is an error on my part that is causing the rounding (because an error on my 
part seems most likely :) ).

Thanks and all the best,
Keith


  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Simple bindings example

2010-05-14 Thread Quincey Morris
On May 14, 2010, at 00:49, Andrew White wrote:

> I have an NSMutableSet of strings.  I update the set internally.  I want to 
> display a single column NSTableView with all the current strings in the set.  
> These strings can (and do) change as the program runs.  From a user 
> perspective, this is read-only: the user can't edit it.
> 
> And I want to do it with bindings.
> 
> I cannot for the life of me figure how to plumb it.  And how to get KVO to 
> work.

It's not clear which part of this is giving you trouble. There are basically 3 
parts to it:

1. Make the set of strings be a property of an object that you can bind to in a 
XIB file. That means, usually, either File's Owner (which is typically a 
NSDocument or NSWindowController subclass) or your application delegate, 
depending on where the strings are.

Arrange to always update this set KVO-compliantly. That is, don't change the 
set directly (except when creating it), but change the proxy returned by 
[object mutableSetValueForKey:].

2. Put a NSArrayController in your XIB file. Bind its contentSet binding to the 
set property from #1. (I always thought contentSet only worked for Core Data 
relationships, but I can't find any requirement for this in the NSArray 
controller documentation. If it throws an exception saying the array controller 
needs to be in entity mode, then you'll have to use an array instead of a set 
for the array controller content.)

You might want to bind the array controller to sort descriptors, too, if there 
is some ordering of the strings that you want. (Or, just work with an array 
that you maintain in the correct order, instead of a set.)

3. Bind the table column to the array controller's arrangedObjects. Leave the 
model key blank, or specify "self" if it complains. (This is a funky way to get 
to the strings, but it works so long as you don't try to edit them.)

That should be all you need.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AsyncUdpSocket: Receiving duplicate UDP Packet

2010-05-14 Thread jonat...@mugginsoft.com

On 13 May 2010, at 03:35, Todd Burch wrote:

> Hi all,
> 
> 
> Can anyone who's used AsyncUdpSocket before help out a beginner? Frustrated...

Looking at the source for AsyncUdpSocket I would put a break point on - 
maybeCompleteCurrentReceive
and see if this method is called multiple times.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Simple bindings example

2010-05-14 Thread Andrew White
I've searched around and I can find sample code for this simple Bindings 
problem:


I have an NSMutableSet of strings.  I update the set internally.  I want to 
display a single column NSTableView with all the current strings in the 
set.  These strings can (and do) change as the program runs.  From a user 
perspective, this is read-only: the user can't edit it.


And I want to do it with bindings.

I cannot for the life of me figure how to plumb it.  And how to get KVO to 
work.


Does anyone have a minimal example of this?

(XCode 3.2, 10.6)


Thanks

--
Andrew White
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


how to terminate first AlertPanel when second AlertPanel appears?

2010-05-14 Thread kirankumar

Hi All,

I am developing one application in that i want to add device request  feature ,for that i 
am sending a message like "DeviceRequest" .
if this message is send to other pc in that pc it shows one Alert message 
(NSRunAlertPanel(@"Request",@"Please Disconnect the device",@"ok",@"",nil);
But again i am sending a devicerequest ,at that time first message will display 
like that only untill i click on Ok button.
my question is i want to terminate the first message when second message 
appears.
Is there any special window or any function is there.
please can anyone reply for my question?



Regards,
kiran



The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com