Re: Syntax Coloring?

2009-08-26 Thread Uli Kusterer

On Aug 25, 2009, at 5:13 AM, Rob Keniger wrote:

On 25/08/2009, at 11:36 AM, Keitaroh Kobayashi wrote:

Anyways, I was thinking I could keep the basic flex part, and apply  
it only
to the changed portions of the text. The problem with that is that  
I would
have to check for quotes and record what's inside the quote from  
where the
person started typing... But then that runs into the problem of  
somebody

just putting their text cursor randomly in a string, etc etc.



You could always look at Uli Kusterer's UKSyntaxColoredTextDocument  
class:


http://zathras.de/angelweb/sourcecode.htm#UKSyntaxColoredTextDocument

It's pretty comprehensive and performance is good. It's free for non- 
commercial projects.


 And very cheap for commercial projects.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

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 3.0] How do I make a UITextField the first responder?

2009-08-26 Thread Thomas Mueller
That's where I'm doing it and it works fine for me.

Thomas


2009/8/25 Andy Lee :
>
> On Aug 25, 2009, at 9:34 AM, Luke the Hiesterman wrote:
>
>>
>> On Aug 25, 2009, at 6:33 AM, Andy Lee wrote:
>>
>>> You seem to be right about this part -- becomeFirstResponder doesn't
>>> bring up the keyboard for me, or I'm doing something wrong.
>>
>> Are you sure the text field isn't nil when you're calling this? Maybe it's
>> loaded from a nib and you forgot to wire up the outlet?
>
> First thing I checked. :)
>
> A quick look on StackOverflow suggests the code should go into
> viewDidAppear:animated:.  Itching to try this but I have to run to work...
>
> --Andy
>
>
> ___
>
> 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/thomasmueller76%40googlemail.com
>
> This email sent to thomasmuelle...@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


Re: Normalize an NSAttributedString

2009-08-26 Thread Alastair Houghton

On 26 Aug 2009, at 00:56, Martin Wierschin wrote:

Note that there is an issue with this approach, which is that  
attribute runs that start in the middle of a grapheme cluster might  
result in odd behaviour wrt normalisation.  However, it generally  
doesn't make sense to have such an attribute run (it's the  
equivalent of asking for e.g. a bold "o" with an italic umlaut,  
which makes no sense), it's just something that you might want to  
be aware of.


Sometimes it's desirable to have such attribute runs. One example is  
to highlight combining marks using a different foreground color than  
that of the base character.


That's a good point, and if you needed to support that then you'd have  
to be very careful dealing with this issue.  I guess it's more common  
to do that kind of thing for display only?


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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: Binding exception on Tiger

2009-08-26 Thread Ken Thomases

On Aug 25, 2009, at 2:02 PM, James Walker wrote:

When my app ran on Tiger, there was an NSInvalidArgumentException  
with the reason:


"-observeValueForKeyPath:ofObject:change:context: only defined for  
abstract class.  Define -[NSCFString  
observeValueForKeyPath:ofObject:change:context:]!"


That seemed to happen when I had 2 enabled bindings on the same  
checkbox.  Is that a known limitation?


I don't think this has anything to do with having 2 bindings.

Notice the mention of NSCFString in the exception reason.  It appears  
that you have signed up some string object to receive KVO change  
notifications for some object's property.  Since NSCFString isn't  
equipped to handle receiving those notifications, you get an  
exception.  The reason string is saying, "An object of class  
NSCFString has had -observeValueForKeyPath:ofObject:change:context:  
invoked on it.  This class didn't override that method, and so the  
base-class method implementation was invoked, and that implementation  
throws an exception telling you about the problem."


Of course, although it's advising you to implement an override of - 
observeValueForKeyPath:ofObject:change:context: on NSCFString, that's  
not what you really need to do.  You need to figure out why you  
subscribed a string object to receive such KVO change notifications in  
the first place.  It's almost certainly not what you meant to do.


One likely candidate is a memory management problem.  You may not have  
actually signed up a string object to receive such notifications.   
Instead, you may have signed up some other object but allowed that  
object to deallocate itself by failing to retain it.  So, that object  
disappeared.  Later, a string object was allocated at the same memory  
location.  Now, it is receiving KVO change notifications it was never  
supposed to.  You can use NSZombie to diagnose this particular issue  
and learn which class of object was originally observing property  
changes.  You can also use the Object Alloc instrument or  
malloc_history to learn where in your code that object was originally  
allocated.


Regards,
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: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases

On Aug 25, 2009, at 7:21 PM, Ross Carter wrote:


I haven't tried it, but this should work:

NSAttributedString* original = whatever;
	NSMutableAttributedString* normalized = [[original mutableCopy]  
autorelease];
	CFMutableStringRef str = (CFMutableStringRef)[original  
mutableString];

CFStringNormalize(str, kCFStringNormalizationFormD);

This works because -[NSMutableAttributedString mutableString] is a  
proxy that automatically fixes up the attribute runs held by its  
owner.


~Martin



Brilliant! Works just like you said. Thanks, Martin.


Hmm, this seems dangerous in the sense that the conversion may be  
lossy.  As far as I can see, there's no guarantee that  
CFStringNormalize will perform minimal replacements.  If it does not,  
then whole ranges of characters may have their attributes reset to  
that of the first replaced character.


Even if testing reveals it to be non-lossy under one testing  
environment, without a guarantee that might differ under any other  
testing environment.


Also, it should be self-evident that normalizing to a precomposed form  
will obliterate attribute differences between a base character and any  
combining characters, as discussed elsewhere in this thread.


All that said, I'm still unclear why the string is being normalized to  
begin with.  Why does the archive require (if it does) that the string  
be in normalized form?  It doesn't seem necessary for the unarchival  
process.  If you're anticipating some other tool working with the data  
in the meantime, then how will that tool work with the attributes?  If  
the other tool will modify the string data, then your attributes won't  
reapply properly on unarchival.


Regards,
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


Using shortcuts and FirstResponder

2009-08-26 Thread Reinhard Segeler
Hallo,

I have a serious problem with using Apple's default shortcuts, that are
assigned in IB - standard and individual menuItems. None of the standard
items is called, if I don't integrate them in my performKeyEquivalent method
and tell what has to be done with them. The app crashes because the
FirstResponder stopps the responder chain with a call performKeyEquivalent
with the MenuItemDelegate, then finally __forwarding__ and then
__forwarding_0__ is shown, that's it. The app crashes with that.
I am using a subclassed NSTableView, which is firstResponder of the window
and returns NO for the standard ( Command q, c, x, etc. ) and undesired
shortcuts. The next Responder is another NSTableView which sets the first
tableView the nextResponder if itself is firstResponder and does not want to
handle the pressed shortcut or key. I have subclassed, because I want to use
some special shortcuts/keys, when working with the tableView, added to
the standard keys ( arrow keys, tab) of the tableView.

Using keyboard: The individual items don't call their assigned
action-methods. My desired shortcuts are integrated in performKeyEquivalent
and handed if neccessary to the keyDown: method of one of two
NSTableViews. Everything works fine for this, but I have to the same for the
Apple-Standard shortcuts: e. g. cannot terminate the app with Command
q, if have not integrated a method for that command. The terminate:
-method in the AppController is not called, so for now I am sending an
individual notification
from keyDown: and that works.

The menus are stored in MainMenu in MainMenu.xib. The MainMenu
is "standalone", the menuItems are connected to FirstResponder or the
desired classes.

When using the mouse, everything works the desired way.

I have studied all my Cocoa-books, browsed the Apple help, where I found,
that my apps' responder key chain behaves correct.

Maybe I am confused with the bindings of the menuItems. I have read,
that I have to add the desired action to the FirstResponder,
but it appears there before adding them, so I haven't added it, and bound it
to the shown actions.

Any suggestions are welcome, because I have no idea, what I could do more.

Thanks in advance
Reinhard Segeler
___

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 is "Open Recent >" identified and populated?

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 12:18 AM, Jerry Krinock wrote:



On 2009 Aug 25, at 16:43, Jeff Johnson wrote:


http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu/


So, maybe Interface Builder sends  
_setMenuName:@"NSRecentDocumentsMenu" to the submenu of its "Open  
Recent" menu item.




  Very interesting. Completely undocumented and interesting ...


Or maybe their vacuum-tube-based hardware was limited to 16 outlets  
per object and adding one for the "recents" menu would have been  
17 :))


  Ouch. :-)

--
I.S.




___

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: Selection highlight in NSTextFieldCell

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 1:30 AM, bryscomat wrote:

So if there's no way to do that, on to my next question. Is there a  
way to change the color the highlighted portion of text, i.e. the  
text is normally white, but the highlighted portion of the text will  
be black.



  Have you tried the documentation? NSTextFieldCell is an NSCell,  
right?


-[NSCell highlightColorWithFrame:inView:]

  One thing you could try (to still use the user's preferred color)  
is to invert the selection color like a film negative.


  Another thing is playing with Quartz compositing types (when you - 
highlight:withFrame:inView: ) and maybe even a filter or two. The goal  
would be to modulate the color.


  These would be preferable to gray, which indicates selected text in  
a control that does not have focus (can I edit? does copy/paste work?  
what's going on here?).


--
I.S.




___

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 3.0] How do I make a UITextField the first responder?

2009-08-26 Thread Brian Bruinewoud

Ok, apologies to Georg.
That does work.
My fingers still type 'NS' by default sometimes, it seems :(

Thanks all.

On 25/08/2009, at 23:02 , Andy Lee wrote:


On Aug 25, 2009, at 8:28 AM, Brian Bruinewoud wrote:

On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:


On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton.  
The user will most often want to type text and ignore the button.  
Is there some way I can make the keyboard appear immediately that  
view is shown? I can't find anything in IB and reading about  
UITextField, UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
[super viewDidLoad];
[_myTextFieldOutlet becomeFirstResponder];
}

Actually, that's not correct, but while I was checking that I  
noticed that its documentation said


	"Use the NSWindow makeFirstResponder: method, not this method, to  
make an object the first responder. Never invoke this method  
directly."


You're reading the Cocoa docs, not the iPhone docs.  There's no  
NSWindow on the iPhone.


The *iPhone* doc for becomeFirstResponder says:

"You may call this method to make a responder object such as a view  
the first responder. However, you should only call it on that view  
if it is part of a view hierarchy. If the view’s window property  
holds a UIWindow object, it has been installed in a view hierarchy;  
if it returns nil, the view is detached from any hierarchy."


--Andy




___

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


Performance Issue with Drawing PDFPages on NSView

2009-08-26 Thread Naresh Kongara

Hi ,

I'm drawing the pages from the pdf document onto an NSVIew. The  
fallowing method draws all the pages from the document in a View, this  
method will be  called from the view's drawrect.  Its taking much time  
when there are more than 40 pages as all the pages needs to be  
displayed at a time .



Is there any other way of doing it ?  or How can increase the  
performance..?



- (void)drawPDFPages
{
PDFDocument *doc = [self document];
// draw paper "page"
[[NSColor whiteColor] set];

float offset = 1.0;
int matrix = MAX(pagesWide, pagesHigh);
NSRect frameRect = [self frame];
for (int i = 0; i < [doc pageCount]; i++) {
PDFPage *pdfPage = [doc pageAtIndex:i];
int x = i % pagesWide;
int y = i / pagesWide;
// Let PDFView do most of the hard work.

float scale = 0.98;
NSPrintingOrientation orientation = NSPortraitOrientation;

	NSPDFImageRep *pdfImage = [NSPDFImageRep imageRepWithData:[pdfPage  
dataRepresentation]];

if( [pdfImage size].width > [pdfImage size].height ) {
orientation = NSLandscapeOrientation;
scale = scale * [pdfImage size].height / [pdfImage 
size].width;
}

scale = scale / matrix;

if( orientation == NSPortraitOrientation )
{
			NSRect portraitPageView = NSMakeRect( offset + x * ((offset +  
(frameRect.size.width) * scale)),
 (frameRect.size.height) - (offset + ((y + 1) * ((offset +  
(frameRect.size.height) * scale,


 frameRect.size.width * scale,

 frameRect.size.height * scale);

NSRectFill(portraitPageView);
[pdfImage drawInRect:portraitPageView];
}
else
{
			NSRect landscapePageView = NSMakeRect( offset + x * ((offset +  
(frameRect.size.height) * scale)),
  (frameRect.size.height) - (offset + ((y + 1) * ((offset  
+ (frameRect.size.width) * scale,


  frameRect.size.height * scale,

  frameRect.size.width * scale);
NSRectFill(landscapePageView);
[pdfImage drawInRect:landscapePageView];
}
}
}





Regards,
Naresh Kongara




___

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 create GPS enabled Iphone application?

2009-08-26 Thread rethish
Hi

I need to create GPS enabled Iphone application which is to display
the nearby hotels and other facilities.

How can I do it?
I am using iphone sdk 2.2

Thank you in advance
___

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 create GPS enabled Iphone application?

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 8:34 AM, rethish wrote:


I need to create GPS enabled Iphone application which is to display
the nearby hotels and other facilities.

How can I do it?



  Broad question? Broad answer:

1 - Familiarize yourself with the platform and its capabilities via  
its documentation.

2 - Design the application using technologies available on the platform.
3 - Build the application.

  This is a lazy question that is far too broad to possibly answer  
without writing a book as a response.


  Read this:

http://www.catb.org/~esr/faqs/smart-questions.html

--
I.S.




___

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 create GPS enabled Iphone application?

2009-08-26 Thread Jeffrey Oleander
> On Wed, 2009/08/26, rethish  wrote:
> From: rethish 
> Subject: How to create GPS enabled Iphone application?
> To: "Cocoa Dev" 
> Date: Wednesday, 2009 August 26, 07:34

> I need to create GPS enabled Iphone application
> which is to display the nearby hotels and other
> facilities.
> 
> How can I do it?
> I am using iphone sdk 2.2

And, by the same token, how can one positively shut
off GPS on an iPhone for customers who value their
privacy?


  
___

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 create GPS enabled Iphone application?

2009-08-26 Thread Luke the Hiesterman

Read: 
http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CoreLocation_Framework/index.html

Luke

On Aug 26, 2009, at 6:27 AM, Jeffrey Oleander wrote:


On Wed, 2009/08/26, rethish  wrote:
From: rethish 
Subject: How to create GPS enabled Iphone application?
To: "Cocoa Dev" 
Date: Wednesday, 2009 August 26, 07:34



I need to create GPS enabled Iphone application
which is to display the nearby hotels and other
facilities.

How can I do it?
I am using iphone sdk 2.2


And, by the same token, how can one positively shut
off GPS on an iPhone for customers who value their
privacy?



___

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/luketheh%40apple.com

This email sent to luket...@apple.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: Selection highlight in NSTextFieldCell

2009-08-26 Thread bryscomat


 Have you tried the documentation? NSTextFieldCell is an NSCell,  
right?


-[NSCell highlightColorWithFrame:inView:]


Yes, I came across this in the documentaion. After playing with it for  
a little bit (and a couple other methods like it) I thought it was  
just not honored in an NSTextFieldCell. That method never gets called  
when I override it. I have overridden drawWithFrame:inView: without  
calling super. Is that why?

___

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: Selection highlight in NSTextFieldCell

2009-08-26 Thread Kyle Sluder

On Aug 26, 2009, at 6:34 AM, bryscomat  wrote:

Yes, I came across this in the documentaion. After playing with it  
for a little bit (and a couple other methods like it) I thought it  
was just not honored in an NSTextFieldCell. That method never gets  
called when I override it. I have overridden drawWithFrame:inView:  
without calling super. Is that why?


No, it's because -highlight… could never do the job. Some NSText  
object is going to be used to draw the text field's contents. And in  
the most important case, editing, the field editor is doing all the  
drawing anyway.


--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


Re: How to create GPS enabled Iphone application?

2009-08-26 Thread Jeffrey Oleander
> On Wed, 2009/08/26, Luke the Hiesterman  wrote:
> From: Luke the Hiesterman 
> Subject: Re: How to create GPS enabled Iphone application?
> To: "Jeffrey Oleander" 
> Cc: "Cocoa Dev" , "rethish" 
> Date: Wednesday, 2009 August 26, 08:30
>> On 2009 Aug 26, at 06:27, Jeffrey Oleander wrote:
>>> On Wed, 2009/08/26, rethish  wrote:
>>> From: rethish 
>>> Subject: How to create GPS enabled Iphone application?
>>> To: "Cocoa Dev" 
>>> Date: Wednesday, 2009 August 26, 07:34
>>
>>> I need to create GPS enabled Iphone application
>>> which is to display the nearby hotels and other
>>> facilities.
>>>
>>> How can I do it?
>>> I am using iphone sdk 2.2
>>
>> And, by the same token, how can one positively shut
>> off GPS on an iPhone for customers who value their
>> privacy?

> Read: 
> http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CoreLocation_Framework/index.html
> 
> Luke

Thanks.  I filed feed-back against the docs, because 
the info on how to positively stop the iPhone from 
transmitting GPS location data to the cell is not
there.


  
___

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 create GPS enabled Iphone application?

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 10:19 AM, Jeffrey Oleander wrote:


Thanks.  I filed feed-back against the docs, because
the info on how to positively stop the iPhone from
transmitting GPS location data to the cell is not
there.


  Huh? That's because it's a user setting. And a sensitive one, too.

  I would not expect (or want) an application to turn off GPS for the  
device on its own. I wouldn't want an app to be able to turn any  
device-wide features off (or on) without asking.


  If it has to ask, why not just let the user manage it in the  
settings? Instead, the OS prompts to allow the app access to the  
sensitive feature / service if it's available. This is by design.


--
I.S.


___

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


Cocoaheads Bonn meeting tomorrow CANCELED

2009-08-26 Thread Stefan Wolfrum

Hi all,

just a short notice: our 10th meeting (CocoaHeads chapter Bonn,  
Germany) that was planned for tomorrow (2009-08-27, 1900 GMT+2) was  
canceled!


The next meeting will be on 2009-09-24 (the usual last Thursday each  
month).


See http://cocoaheads-bonn.de for details.

Happy coding,
Stefan.

___

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 create GPS enabled Iphone application?

2009-08-26 Thread Luke the Hiesterman
As stated, the application doesn't get to decide whether location  
services are on or off. It can only request them or not request them.  
Also, the user can override an application's request for location info.


Luke

On Aug 26, 2009, at 7:23 AM, I. Savant wrote:


On Aug 26, 2009, at 10:19 AM, Jeffrey Oleander wrote:


Thanks.  I filed feed-back against the docs, because
the info on how to positively stop the iPhone from
transmitting GPS location data to the cell is not
there.


 Huh? That's because it's a user setting. And a sensitive one, too.

 I would not expect (or want) an application to turn off GPS for the  
device on its own. I wouldn't want an app to be able to turn any  
device-wide features off (or on) without asking.


 If it has to ask, why not just let the user manage it in the  
settings? Instead, the OS prompts to allow the app access to the  
sensitive feature / service if it's available. This is by design.


--
I.S.




___

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 create GPS enabled Iphone application?

2009-08-26 Thread Jeffrey Oleander
> On Wed, 2009/08/26, Luke the Hiesterman  wrote:
> From: Luke the Hiesterman 
> Subject: Re: How to create GPS enabled Iphone application?
> To: "I. Savant" 
> Cc: "Jeffrey Oleander" , "Cocoa Dev" 
> 
> Date: Wednesday, 2009 August 26, 10:10
> As stated, the application doesn't get to decide
> whether location services are on or off.

That's not my question.

Can a USER shut off broadcasting of his location 
to the cell(s), either directly via a nice big 
hardware switch with an indicator light (and,
preferably, a switch that makes a nice audio and 
tactile clunk like a power plant circuit breaker) 
or with the help of my handy-dandy application?

If not, it's a design flaw, and will have to 
be corrected.


  
___

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 create GPS enabled Iphone application?

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 11:33 AM, Jeffrey Oleander wrote:


That's not my question.

Can a USER shut off broadcasting of his location
to the cell(s), either directly via a nice big
hardware switch with an indicator light (and,
preferably, a switch that makes a nice audio and
tactile clunk like a power plant circuit breaker)
or with the help of my handy-dandy application?



  Your question has already been answered. Here it is again:

  The user cannot do this from an application because applications do  
not have the ability to do this. Only the system settings app (part of  
the OS) is authorized to make this change.




If not, it's a design flaw, and will have to
be corrected.


  Good luck on the "will have to be" part, but do file a bug report  
requesting API access. For now, it's not possible.


  Such a feature should definitely require the OS to prompt the user  
so apps don't have the ability to turn this off or (more importantly)  
on silently / without permission. Otherwise it's a security risk on  
several levels.


--
I.S.




___

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 create GPS enabled Iphone application?

2009-08-26 Thread Pat Homelvig
System wide user setting:

Settings App->General->Location Services.  Toggle switch turns it off.

Also as stated, you should not be able to turn on / off location
services system wide via API.  It can be requested if it is needed,
and the user is notified of this, so they can decide if they want to
allow it or not.

On Wed, Aug 26, 2009 at 9:33 AM, Jeffrey Oleander wrote:
>> On Wed, 2009/08/26, Luke the Hiesterman  wrote:
>> From: Luke the Hiesterman 
>> Subject: Re: How to create GPS enabled Iphone application?
>> To: "I. Savant" 
>> Cc: "Jeffrey Oleander" , "Cocoa Dev" 
>> 
>> Date: Wednesday, 2009 August 26, 10:10
>> As stated, the application doesn't get to decide
>> whether location services are on or off.
>
> That's not my question.
>
> Can a USER shut off broadcasting of his location
> to the cell(s), either directly via a nice big
> hardware switch with an indicator light (and,
> preferably, a switch that makes a nice audio and
> tactile clunk like a power plant circuit breaker)
> or with the help of my handy-dandy application?
>
> If not, it's a design flaw, and will have to
> be corrected.
>
>
>
> ___
>
> 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/pat%40whitewolf.com
>
> This email sent to p...@whitewolf.com
>



-- 
Pat Homelvig
p...@whitewolf.com
303-906-6104
___

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: Normalize an NSAttributedString

2009-08-26 Thread Michael Ash
On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote:
> On Aug 25, 2009, at 7:21 PM, Ross Carter wrote:
>
>>> I haven't tried it, but this should work:
>>>
>>>        NSAttributedString* original = whatever;
>>>        NSMutableAttributedString* normalized = [[original mutableCopy]
>>> autorelease];
>>>        CFMutableStringRef str = (CFMutableStringRef)[original
>>> mutableString];
>>>        CFStringNormalize(str, kCFStringNormalizationFormD);
>>>
>>> This works because -[NSMutableAttributedString mutableString] is a proxy
>>> that automatically fixes up the attribute runs held by its owner.
>>>
>>> ~Martin
>>>
>>
>> Brilliant! Works just like you said. Thanks, Martin.
>
> Hmm, this seems dangerous in the sense that the conversion may be lossy.  As
> far as I can see, there's no guarantee that CFStringNormalize will perform
> minimal replacements.  If it does not, then whole ranges of characters may
> have their attributes reset to that of the first replaced character.
>
> Even if testing reveals it to be non-lossy under one testing environment,
> without a guarantee that might differ under any other testing environment.

http://en.wikipedia.org/wiki/Unicode_equivalence

"Unicode provides standard normalization algorithms that produce a
unique (normal) code point sequence for all sequences that are
equivalent Both the composed and decomposed forms impose a
canonical ordering on the code point sequence, which is necessary for
the normal forms to be unique."

"All these forms impose the canonical order on the resulting sequence
to guarantee uniqueness of the result over the corresponding
equivalence class."

"NFD Normalization Form Canonical Decomposition Characters are
decomposed by canonical equivalence."

> Also, it should be self-evident that normalizing to a precomposed form will
> obliterate attribute differences between a base character and any combining
> characters, as discussed elsewhere in this thread.

Good thing he went and normalized to a *de*composed form then, isn't it?

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


NSSplitView resizing

2009-08-26 Thread Oftenwrong Soong
Hi all,

I have a window containing a NSSplitView. When the window is resized, both 
panes of the split view resize proportionally. I would like one pane to remain 
fixed while the other resizes. Xcode does this, as well as iCal and other apps.

Is there a delegate method that does this or must I subclass NSSplitView?

Thanks,
Soong



  
___

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: NSSplitView resizing

2009-08-26 Thread Benjamin Stiglitz
> I have a window containing a NSSplitView. When the window is resized, both 
> panes of the split view resize proportionally. I would like one pane to 
> remain fixed while the other resizes. Xcode does this, as well as iCal and 
> other apps.
> 
> Is there a delegate method that does this or must I subclass NSSplitView?

You can achieve this with the -splitView:resizeSubviewsWithOldSize:
delegate method.

-Ben
___

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: Normalize an NSAttributedString

2009-08-26 Thread Douglas Davidson


On Aug 26, 2009, at 1:30 AM, Alastair Houghton wrote:


On 26 Aug 2009, at 00:56, Martin Wierschin wrote:

Note that there is an issue with this approach, which is that  
attribute runs that start in the middle of a grapheme cluster  
might result in odd behaviour wrt normalisation. However, it  
generally doesn't make sense to have such an attribute run (it's  
the equivalent of asking for e.g. a bold "o" with an italic  
umlaut, which makes no sense), it's just something that you might  
want to be aware of.


Sometimes it's desirable to have such attribute runs. One example  
is to highlight combining marks using a different foreground color  
than that of the base character.


That's a good point, and if you needed to support that then you'd  
have to be very careful dealing with this issue.  I guess it's more  
common to do that kind of thing for display only?


Unfortunately, there's no guarantee that something like this will  
work.  Depending on the font, something like an o+umlaut may be  
represented with a single glyph, in which case there's currently no  
mechanism for coloring the umlaut differently from the o.


Douglas Davidson

___

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: NSSplitView resizing

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 11:48 AM, Oftenwrong Soong wrote:

I have a window containing a NSSplitView. When the window is  
resized, both panes of the split view resize proportionally. I would  
like one pane to remain fixed while the other resizes. Xcode does  
this, as well as iCal and other apps.


Is there a delegate method that does this or must I subclass  
NSSplitView?


  Have you looked at the documentation to see if there's a delegate  
method for this?


  This topic comes up on this list periodically (check the archives)  
and is covered on the cocoadev.com wiki (with example code) as well.  
All of this can be found via google and archive search using some  
terms from your e-mail.


--
I.S.


___

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: NSSplitView resizing

2009-08-26 Thread jonat...@mugginsoft.com


On 26 Aug 2009, at 16:48, Oftenwrong Soong wrote:


Hi all,

I have a window containing a NSSplitView. When the window is  
resized, both panes of the split view resize proportionally. I would  
like one pane to remain fixed while the other resizes. Xcode does  
this, as well as iCal and other apps.


Is there a delegate method that does this or must I subclass  
NSSplitView?


My approach has been to define a category on NSSplitView and call this  
from the delegate.
The category implements a behaviour based implementation of  
resizeSubviewsWithOldSize: that supports min view sizes and fixed view  
identification.
Works with two and three view NSSplitViews. Might not quite cover all  
orientations.


Delegate:
/*

 size splitview subviews as required

 */
- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:  
(NSSize)oldSize

{   
MGSSplitviewBehaviour behaviour;

// note that a view does not provide a -setTag method only -tag
// so views cannot be easily tagged without subclassing.
// NSControl implements -setTag;
//
switch ([[sender subviews] count]) {
case 2:
behaviour = MGSSplitviewBehaviourOf2ViewsFirstFixed;
break;

case 3:
behaviour = 
MGSSplitviewBehaviourOf3ViewsFirstAndSecondFixed;
break;

default:
NSAssert(NO, @"invalid number of views in splitview");
break;
}

// see the NSSplitView_Mugginsoft category
[sender resizeSubviewsWithOldSize:oldSize withBehaviour:behaviour];
}

Category:

//
//  NSSplitView_Mugginsoft.h
//

#import 


typedef enum _MGSSplitviewBehaviour {
MGSSplitviewBehaviourNone = -1,
	MGSSplitviewBehaviourOf2ViewsFirstFixed = 0,			// 2 views - first  
fixed width
	MGSSplitviewBehaviourOf2ViewsSecondFixed,			// 2 views - second fixed  
width
	MGSSplitviewBehaviourOf3ViewsFirstAndSecondFixed,		//  3 views -  
first and second fixed width	
	MGSSplitviewBehaviourOf3ViewsFirstAndThirdFixed,		//  3 views - first  
and third fixed width

} MGSSplitviewBehaviour;

@interface NSSplitView(Mugginsoft)
- (void)resizeSubviewsWithOldSize: (NSSize)oldSize withBehaviour: 
(MGSSplitviewBehaviour)behaviour;
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize withBehaviour: 
(MGSSplitviewBehaviour)behaviour minSizes:(NSArray *)minSizes;

- (void)logSubviewFrames;
//- (void)replaceSubview:(NSView *)oldView withViewSizedAsOld:(NSView  
*)newView;

@end

//
//  NSSplitView_Mugginsoft.m
//

#import "NSSplitView_Mugginsoft.h"

@implementation NSSplitView(Mugginsoft)

/*

 resize subviews with old size, with behaviour

 */
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize withBehaviour: 
(MGSSplitviewBehaviour)behaviour

{
	[self resizeSubviewsWithOldSize:oldSize withBehaviour:behaviour  
minSizes:nil];

}

/*
 resize subviews with old size, with behaviour and min sizes

 apply splitview behaviour

 note that NSSplitView uses flipped coordinates.

 subview at index 0 is leftmost or topmost
 x,y 0,0, is top left

 */
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize withBehaviour: 
(MGSSplitviewBehaviour)behaviour minSizes:(NSArray *)minSizes

{
if (behaviour == MGSSplitviewBehaviourNone) {
return;
}

NSRect newFrame = [self frame];
NSSize newSize = newFrame.size;
CGFloat heightDelta = newSize.height - oldSize.height;
CGFloat dividerThickness = [self dividerThickness];

int subviewCount = [[self subviews] count];

NSRect rect0 = [[[self subviews] objectAtIndex:0] frame];
NSRect rect1 = [[[self subviews] objectAtIndex:1] frame];
NSRect rect2;
NSString *assertMsg = @"invalid splitview behaviour";
CGFloat minSize0 = -1, minSize1 = -1, minSize2 = -1;
CGFloat height0 = 0, height1= 0, height2 = 0, height1Delta = 0;
CGFloat width0 = 0, width1= 0;

// if minsizes defined
if (minSizes) {
// min sizes are widths or heights depending on context
		if ([minSizes count] >= 1) minSize0 = [[minSizes objectAtIndex:0]  
doubleValue];
		if ([minSizes count] >= 2) minSize1 = [[minSizes objectAtIndex:1]  
doubleValue];
		if ([minSizes count] >= 3) minSize2 = [[minSizes objectAtIndex:2]  
doubleValue];

}

switch (subviewCount) {

case 2:
if ([self isVertical]) {// views are side by 
side
rect0.origin = NSMakePoint(0, 0);
rect0.size.height = newFrame.size.height;
rect1.size.height = newFrame.size.height;

if (behaviour == 
MGSSplitviewBehaviourOf2ViewsFirstFixed) {
 

Re: How to create GPS enabled Iphone application?

2009-08-26 Thread Clark Cox
On Wed, Aug 26, 2009 at 8:33 AM, Jeffrey Oleander wrote:
>> On Wed, 2009/08/26, Luke the Hiesterman  wrote:
>> From: Luke the Hiesterman 
>> Subject: Re: How to create GPS enabled Iphone application?
>> To: "I. Savant" 
>> Cc: "Jeffrey Oleander" , "Cocoa Dev" 
>> 
>> Date: Wednesday, 2009 August 26, 10:10
>> As stated, the application doesn't get to decide
>> whether location services are on or off.
>
> That's not my question.
>
> Can a USER shut off broadcasting of his location

Of course they can. The user is the ONLY person who can turn location
services off. It's completely under their control. Your app can't, my
app can't, only the user can.

-- 
Clark S. Cox III
clarkc...@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: How to create GPS enabled Iphone application?

2009-08-26 Thread Luke the Hiesterman


On Aug 26, 2009, at 8:33 AM, Jeffrey Oleander wrote:


On Wed, 2009/08/26, Luke the Hiesterman  wrote:
From: Luke the Hiesterman 
Subject: Re: How to create GPS enabled Iphone application?
To: "I. Savant" 
Cc: "Jeffrey Oleander" , "Cocoa Dev" >

Date: Wednesday, 2009 August 26, 10:10
As stated, the application doesn't get to decide
whether location services are on or off.


That's not my question.

Can a USER shut off broadcasting of his location
to the cell(s), either directly via a nice big
hardware switch with an indicator light (and,
preferably, a switch that makes a nice audio and
tactile clunk like a power plant circuit breaker)
or with the help of my handy-dandy application?

If not, it's a design flaw, and will have to
be corrected.


Let's revisit your question:

"And, by the same token, how can one positively shut
off GPS on an iPhone for customers who value their
privacy?"

Well, you can't shut off location services for your customers except  
to the extent that you can not request them from the system. Customers  
have to do it for themselves.


Luke
___

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


Beep

2009-08-26 Thread DKJ
Once upon a time, there was a computer language called BASIC. It was  
installed in just about every computer; usually with a soldering iron.  
And a favourite beginner programmer project was getting the computer  
to emit sounds when keys were pressed. As I recall, there was  
something like a "BEEP" command that let you do this quite easily, and  
also let you set parameters like duration and frequency.


I've been searching though the iPhone audio API looking for something  
similar: i.e. a method that will let me generate a sound ex nihilo,  
with a given duration and frequency. But as far as I can tell, any  
sound that I want to produce has to use an audio file of some sort.


Have I missed something simple? If so, please point me to the right  
place in the docs.


dkj
___

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: Beep

2009-08-26 Thread Sumanth Peddamatham

NSBeep().

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Miscellaneous/AppKit_Functions/Reference/reference.html#/ 
/apple_ref/c/func/NSBeep



Best,

Sumanth P.


On Aug 26, 2009, at 12:47 PM, DKJ wrote:

Once upon a time, there was a computer language called BASIC. It was  
installed in just about every computer; usually with a soldering  
iron. And a favourite beginner programmer project was getting the  
computer to emit sounds when keys were pressed. As I recall, there  
was something like a "BEEP" command that let you do this quite  
easily, and also let you set parameters like duration and frequency.


I've been searching though the iPhone audio API looking for  
something similar: i.e. a method that will let me generate a sound  
ex nihilo, with a given duration and frequency. But as far as I can  
tell, any sound that I want to produce has to use an audio file of  
some sort.


Have I missed something simple? If so, please point me to the right  
place in the docs.


dkj
___

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/peddamat%40gmail.com

This email sent to pedda...@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: Beep

2009-08-26 Thread Kyle Sluder
On Wed, Aug 26, 2009 at 9:47 AM, DKJ wrote:
> Have I missed something simple? If so, please point me to the right place in
> the docs.

No you haven't missed anything.

You're going to need to generate and feed PCM samples to the audio
hardware.  You'll want to ask the coreaudio-api list for more info.

--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


Re: Beep

2009-08-26 Thread I. Savant

On Aug 26, 2009, at 12:47 PM, Sumanth Peddamatham wrote:


NSBeep().

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Miscellaneous/AppKit_Functions/Reference/reference.html#//apple_ref/c/func/NSBeep


  That doesn't let you control frequency or duration. It merely  
triggers the user's chosen default sound. Further, the link you  
provided is for ApplicationKit, which isn't part of the iPhone API.


  In short, I don't think this addresses the OP's question.

http://developer.apple.com/iphone/search/search.php?Search=beep

  ... turns up nothing promising. I think the OP will have to either  
settle for pre-recorded sound files or generate the sound with Core  
Audio in this case.


--
I.S.


___

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: Beep

2009-08-26 Thread Randall Meadows

On Aug 26, 2009, at 10:47 AM, Sumanth Peddamatham wrote:


NSBeep().



I've been searching though the iPhone audio API

  ^^
Impedance mismatch.

___

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


Resize Text Field When Wraps

2009-08-26 Thread Mr. Gecko
Hello, I'm trying to resize a text field height when it wraps but I'm  
having a problem. I tried using [[self cell] cellSize] but it's only  
working when I push return and I need to get the height of it with the  
wraps. How might I do that?


Thanks for the help,
Mr. Gecko.
___

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: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases

On Aug 26, 2009, at 10:43 AM, Michael Ash wrote:

On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases  
wrote:

On Aug 25, 2009, at 7:21 PM, Ross Carter wrote:


I haven't tried it, but this should work:

   NSAttributedString* original = whatever;
   NSMutableAttributedString* normalized = [[original  
mutableCopy]

autorelease];
   CFMutableStringRef str = (CFMutableStringRef)[original
mutableString];
   CFStringNormalize(str, kCFStringNormalizationFormD);

This works because -[NSMutableAttributedString mutableString] is  
a proxy

that automatically fixes up the attribute runs held by its owner.


Hmm, this seems dangerous in the sense that the conversion may be  
lossy.  As
far as I can see, there's no guarantee that CFStringNormalize will  
perform
minimal replacements.  If it does not, then whole ranges of  
characters may

have their attributes reset to that of the first replaced character.

Even if testing reveals it to be non-lossy under one testing  
environment,
without a guarantee that might differ under any other testing  
environment.


http://en.wikipedia.org/wiki/Unicode_equivalence

[... quote snipped ...]


I'm well aware of what it means.  The question is, which exact  
operations on the mutable string proxy does CFStringNormalize  
perform.  If CFStringNormalize performs the minimal replace operations  
to get the result, then it will preserve the attributes closely.  It's  
conceivable, though, that CFStringNormalize uses a side buffer to  
compute the normalized form and then does one big replace of the whole  
mutable string's range.  Or, anywhere in between.  Like, it might  
replace a series of precomposed characters with their decompositions  
all with one replace operation.  In that case, the attributes of most  
of the characters will be lost (replaced with the attributes of the  
first character in the replace range).


So, it's clear that the _strings_ will always have a deterministic  
value as a result of normalization.  That's the point of  
normalization.  But the _attributed strings_ may not.



Also, it should be self-evident that normalizing to a precomposed  
form will
obliterate attribute differences between a base character and any  
combining

characters, as discussed elsewhere in this thread.


Good thing he went and normalized to a *de*composed form then, isn't  
it?


Martin's example used Form D, but Ross never quite said that's what he  
was normalizing to.  He might have been adapting Martin's example but  
using a different form.


Regards,
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


SUUpdater == nil, only on 64-bit, when created inside framework (crazy!)

2009-08-26 Thread Steven Degutis
Hello,
I've isolated a very strange issue that I'm having with Sparkle's SUUpdater,
though the issue is more to do with 64-bit and how frameworks work, I think.

My apps all use a common framework SDToolkit, which has an App Delegate
superclass that does a lot of work for me, called SDCommonAppDelegate.
Inside the -init method of this superclass, SUUpdater is created via updater= [[
SUUpdater sharedUpdater] retain]; which is supposed to return *something*,
and always has in the past.

Recently, I've updated all my apps and the frameworks they use, to 64-bit,
as a site-wide update for my company. Just this morning I discovered that
updater is now nil, inside my SDCommonAppDelegate class's -init method,
which is making it impossible for all of my current users to receive new
updates.

At this point I should probably mention that this bug ONLY happens when the
application itself is compiled as 32/64-bit, but under 32-bit it works fine.
That's the weird part!

I can't for the life of me figure out why it is returning nil. I think it
has to do with the fact that my framework SDToolkit is using a "weak" link
to Sparkle.framework (as set in its Target Info's General tab), and thus my
guess is that somehow this is making +alloc return nil under 64-bit mode.

I have verified that the Sparkle framework bundle is in fact 64-bit
(excepting ppc64) and my SDToolkit is as well.

Does anyone know why this would possibly be happening at all? I've looked
through Sparkle's source, and the only place where it could return nil
instead of a valid object is +alloc, from my understanding.

Thanks in advance for any help on this!!

-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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


[iphone] UIScrollView event handling

2009-08-26 Thread Dragos Ionel
Hi,
I have a UIVew that contains a UIScrollView.

UIScrollView is handling tap events, by moving the photos.

I would like to be able to handle swipe events in the UIView (the parent of
the scroll view).

Is it possible?

Thanks a lot,
Dragos
___

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: SUUpdater == nil, only on 64-bit, when created inside framework (crazy!)

2009-08-26 Thread Kyle Sluder
On Wed, Aug 26, 2009 at 10:42 AM, Steven
Degutis wrote:
> I have verified that the Sparkle framework bundle is in fact 64-bit
> (excepting ppc64) and my SDToolkit is as well.

How have you verified this?  Are you getting any console logs
(especially from dlopen_preflight)?  What happens if you force your
app to run 32-bit using arch(1)?

--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


QLGenerator PLUGIN_ID

2009-08-26 Thread David Blanton

My QLGenerator PLUGIN_ID is defined as:

#define PLUGIN_ID "5183C784-F224-4D1E-81A2-3DDB63C867D1"

(Generated by Xcode)

My Generator is not working.  When I run qlmanange -t filename.xxx I get

Cannot find function pointer QuickLookGeneratorPluginFactory for  
factory 011FBC8A-E945-457D-8252-98120F9C9D8C in CFBundle/CFPlugIn  
0x134fc0  (bundle, loaded)


Which implies to me the systems is looking for a PLUGIN_ID 011FBC8A- 
E945-457D-8252-98120F9C9D8C


Why would this be?


___

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: Binding exception on Tiger

2009-08-26 Thread James Walker

Ken Thomases wrote:

On Aug 25, 2009, at 2:02 PM, James Walker wrote:

When my app ran on Tiger, there was an NSInvalidArgumentException with 
the reason:


"-observeValueForKeyPath:ofObject:change:context: only defined for 
abstract class.  Define -[NSCFString 
observeValueForKeyPath:ofObject:change:context:]!"


That seemed to happen when I had 2 enabled bindings on the same 
checkbox.  Is that a known limitation?


I don't think this has anything to do with having 2 bindings.

Notice the mention of NSCFString in the exception reason.  It appears 
that you have signed up some string object to receive KVO change 
notifications for some object's property.  Since NSCFString isn't 
equipped to handle receiving those notifications, you get an exception.  
The reason string is saying, "An object of class NSCFString has had 
-observeValueForKeyPath:ofObject:change:context: invoked on it.  This 
class didn't override that method, and so the base-class method 
implementation was invoked, and that implementation throws an exception 
telling you about the problem."


Of course, although it's advising you to implement an override of 
-observeValueForKeyPath:ofObject:change:context: on NSCFString, that's 
not what you really need to do.  You need to figure out why you 
subscribed a string object to receive such KVO change notifications in 
the first place.  It's almost certainly not what you meant to do.


One likely candidate is a memory management problem.  You may not have 
actually signed up a string object to receive such notifications.  



Not only did my code not sign up a string object for notifications, my 
code did not sign up ANY object for notifications.  So it has to involve 
bindings, doesn't it?  And getting rid of the cases where I had 2 enable 
bindings on one control made the problem go away.  (I guess I should 
have given more detail in my original post.)



Instead, you may have signed up some other object but allowed that 
object to deallocate itself by failing to retain it.  So, that object 
disappeared.  Later, a string object was allocated at the same memory 
location.  Now, it is receiving KVO change notifications it was never 
supposed to.  You can use NSZombie to diagnose this particular issue and 
learn which class of object was originally observing property changes.  
You can also use the Object Alloc instrument or malloc_history to learn 
where in your code that object was originally allocated.



Thanks for the idea, I'll try to remember about NSZombie if this problem 
crops up again.


Part of the problem is that my project is built with Xcode 3.1, which 
does not run on Tiger.  I tried to set up remote debugging, but had all 
sorts of trouble.  And by the way, Instruments, which you mention, 
doesn't run on Tiger either.

--
  James W. Walker, Innoventive Software LLC
  
___

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: Normalize an NSAttributedString

2009-08-26 Thread Michael Ash
On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases wrote:
> On Aug 26, 2009, at 10:43 AM, Michael Ash wrote:
>
>> On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote:
>>>
>>> On Aug 25, 2009, at 7:21 PM, Ross Carter wrote:
>>>
> I haven't tried it, but this should work:
>
>       NSAttributedString* original = whatever;
>       NSMutableAttributedString* normalized = [[original mutableCopy]
> autorelease];
>       CFMutableStringRef str = (CFMutableStringRef)[original
> mutableString];
>       CFStringNormalize(str, kCFStringNormalizationFormD);
>
> This works because -[NSMutableAttributedString mutableString] is a
> proxy
> that automatically fixes up the attribute runs held by its owner.
>>>
>>> Hmm, this seems dangerous in the sense that the conversion may be lossy.
>>>  As
>>> far as I can see, there's no guarantee that CFStringNormalize will
>>> perform
>>> minimal replacements.  If it does not, then whole ranges of characters
>>> may
>>> have their attributes reset to that of the first replaced character.
>>>
>>> Even if testing reveals it to be non-lossy under one testing environment,
>>> without a guarantee that might differ under any other testing
>>> environment.
>>
>> http://en.wikipedia.org/wiki/Unicode_equivalence
>>
>> [... quote snipped ...]
>
> I'm well aware of what it means.  The question is, which exact operations on
> the mutable string proxy does CFStringNormalize perform.  If
> CFStringNormalize performs the minimal replace operations to get the result,
> then it will preserve the attributes closely.  It's conceivable, though,
> that CFStringNormalize uses a side buffer to compute the normalized form and
> then does one big replace of the whole mutable string's range.  Or, anywhere
> in between.  Like, it might replace a series of precomposed characters with
> their decompositions all with one replace operation.  In that case, the
> attributes of most of the characters will be lost (replaced with the
> attributes of the first character in the replace range).
>
> So, it's clear that the _strings_ will always have a deterministic value as
> a result of normalization.  That's the point of normalization.  But the
> _attributed strings_ may not.

Fair enough. However, as Douglas pointed out, you aren't guaranteed
consistent results if you have multiple attributes within a single
decomposed character range *anyway*, so you're going to have trouble
regardless. Better to avoid that situation altogether.

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: QLGenerator PLUGIN_ID

2009-08-26 Thread Nick Zitzmann


On Aug 26, 2009, at 12:20 PM, David Blanton wrote:

Which implies to me the systems is looking for a PLUGIN_ID 011FBC8A- 
E945-457D-8252-98120F9C9D8C


Why would this be?


IIRC, the plugin factory ID must also be written in the info.plist  
file. Are you sure it's written correctly in there?


Nick Zitzmann


___

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: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases

On Aug 26, 2009, at 1:45 PM, Michael Ash wrote:

On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases  
wrote:
I'm well aware of what it means.  The question is, which exact  
operations on

the mutable string proxy does CFStringNormalize perform.  If
CFStringNormalize performs the minimal replace operations to get  
the result,
then it will preserve the attributes closely.  It's conceivable,  
though,
that CFStringNormalize uses a side buffer to compute the normalized  
form and
then does one big replace of the whole mutable string's range.  Or,  
anywhere
in between.  Like, it might replace a series of precomposed  
characters with
their decompositions all with one replace operation.  In that case,  
the

attributes of most of the characters will be lost (replaced with the
attributes of the first character in the replace range).

So, it's clear that the _strings_ will always have a deterministic  
value as
a result of normalization.  That's the point of normalization.  But  
the

_attributed strings_ may not.


Fair enough. However, as Douglas pointed out, you aren't guaranteed
consistent results if you have multiple attributes within a single
decomposed character range *anyway*, so you're going to have trouble
regardless. Better to avoid that situation altogether.


My point about this lossiness has nothing to do with multiple  
attributes within a single grapheme.  The attributes for the entire  
string may get munged.


-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: F-Script 2.0 available

2009-08-26 Thread Philippe Mougin

Thanks André.
I know of several people using F-Script to learn Cocoa and I've got a  
few reports of children having used it as their first programming  
language.

Smalltalk + Cocoa... that's a rather yummy start!

Anyway, for those interested, I think these are the two tutorials that  
make the most sense to start using F-Script as a Cocoa learning/ 
exploration tool:


"Exploring Cocoa with F-Script"
http://www.fscript.org/documentation/ExploringCocoaWithFScript/index.htm

"Learn F-Script in 20 minutes and have fun with Core Image"
http://www.fscript.org/documentation/LearnFScriptIn20Minutes/index.htm

This one is also nice, as it combines networking, charting, core  
image, and interacting with the Finder through the Scripting Bridge:


"Google Chart API Fun with Cocoa and F-Script"
http://www.fscript.org/documentation/GoogleChartAPIFunWithCocoaAndFScript/index.htm

Best,

Philippe Mougin

Le 25 août 09 à 01:07, André Berg a écrit :


Congrats!

The work you are doing with F-Script is really cool. Through F- 
Script I learned as much about Cocoa than I did by picking up  
Hillegass' book.
And I also use it today to test short and middle sized concepts  
before building a whole test app. I always liked exploring Imaging  
stuff with it like explained in the wonderful intro tutorials.


Keep it up :)

Cheers!

André

Am 24.08.2009 um 21:53 schrieb Philippe Mougin:


Hi all,

F-Script 2.0 is has been released. It provides a set of open source  
tools for interactive introspection, manipulation and scripting of  
Cocoa objects.
New features include system-wide scripting, dynamic Cocoa class  
creation, 64-bit, garbage collection, and more.


More info: http://www.fscript.org/documentation/WelcomeToFScript2/index.htm
Download: http://www.fscript.org/download/F-Script20090809.zip

Philippe Mougin



___

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: Performance Issue with Drawing PDFPages on NSView

2009-08-26 Thread John Calhoun

On Aug 26, 2009, at 4:20 AM, Naresh Kongara wrote:
I'm drawing the pages from the pdf document onto an NSVIew. The  
fallowing method draws all the pages from the document in a View,  
this method will be  called from the view's drawrect.  Its taking  
much time when there are more than 40 pages as all the pages needs  
to be displayed at a time .


Is there any other way of doing it ?  or How can increase the  
performance..?


Don't go from PDFPage -> data -> NSImage.  PDFPage has -[PDFPage  
drawWithBox:] method.  Call that directly.  It always draws at 100%  
though so you will have to set up a transform within [NSView  
drawRect:] in order to scale/position the page correctly.


That should make a significant performance difference

John Calhoun—___

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: F-Script 2.0 available

2009-08-26 Thread André Berg


Am 26.08.2009 um 21:04 schrieb Philippe Mougin:

I've got a few reports of children having used it as their first  
programming language.

Smalltalk + Cocoa... that's a rather yummy start!



Hey what a coincidence! I was just watching the Allan Key documentary  
where he explains how children from age 12 to 15 at Xerox Park in Palo  
Alto where writing programs in a language they invented. Yep that  
language was called Smalltalk! Mind you this was in the mid 60's! It  
was really fascinating to watch this.


It's called "Doing with Images makes Symbols" and it is freely  
available at www.archive.org:


http://www.archive.org/search.php?query=doing%20with%20images%20makes%20symbols

But you probably all know that =)

Cheers!

André

___

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


Help viewer problem in Tiger Mac OS X

2009-08-26 Thread Arun
Hi All,

I am using .help files to provide help for my application. My application
help is localised.
In tiger when i switch the languages, always the help viewer launches the
help in english.
But in leopard as the language the help viewer displays the help pages.
Does anyone know or has an idea why this behavior in tiger is?

Thanks
Arun KA
___

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: Help viewer problem in Tiger Mac OS X

2009-08-26 Thread Ken Thomases

On Aug 26, 2009, at 3:25 PM, Arun wrote:

I am using .help files to provide help for my application. My  
application

help is localised.
In tiger when i switch the languages, always the help viewer  
launches the

help in english.
But in leopard as the language the help viewer displays the help  
pages.

Does anyone know or has an idea why this behavior in tiger is?


You should ask this question on the apple-help-authoring list .  They will be better able to help you.


Regards,
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


Autoscroll NSTableView

2009-08-26 Thread PCWiz
How do I make it so that an NSTableView automatically scrolls to the  
bottom as new rows are added to it?


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: Autoscroll NSTableView

2009-08-26 Thread Corbin Dunn


On Aug 26, 2009, at 2:17 PM, PCWiz wrote:

How do I make it so that an NSTableView automatically scrolls to the  
bottom as new rows are added to it?


There is no automatic way; you have to add code to do it. You should  
probably only do it if the prior row was scrolled to the bottom.


[tableView scrollRowToVisible:[tableView numberOfRows] - 1];

--corbin
___

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


Making failed NSAsserts crash an app

2009-08-26 Thread Squ Aire

I am planning on using one of the nice crash reporter code/frameworks that are 
available on the internet that allow me to do stuff that I have seen in many 
Mac apps. Namely, to allow the user to more easily send me a crash log (plus 
some user comments on what the user was doing when the app crashed) the next 
time he launched an app after the crash.

Since I absolutely want some information on whenever my NSAsserts fail (because 
they should NEVER fail and I want to know about it if they do! (at least during 
beta testing!)), my question is: How can I guarantee that a failed NSAssert 
will crash my application? I want it to happen in such a way that the next time 
the user loads the app, the info about the failed NSAssert (perhaps the 2nd 
description string argument I supply to it, or even the line of code and code 
file) will go along with the crash reports.


How can can I accomplish this? Actually, since I have never worried about this 
crash log stuff until now, and I'm getting a bit nervous about implementing 
this correctly for production, I'd just like to ask, is there anything I need 
to configure for this to work? Do the Cocoa frameworks or Mac OS X itself 
automatically take care of producing those crash logs and putting them into the 
~/Library/Logs folder (that the crash reporter framework can then go ahead and 
put into the UI)? Or is there anything I have to do myself to make the 
mechanism work?

A final, not 100% related but still related question: Will doing a simple NSLog 
show up in the crash log in that ~/Library/Logs folder? Or is it only shown in 
the Console utility? Just to avoid confusion, regard this as an unrelated 
question not connected to what I've written above.
_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx___

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


Cross-user and cross-process shared settings

2009-08-26 Thread Dave DeLong

Hi everyone,

I have two processes - a user process and a root-level LaunchDaemon.   
I'd like both processes to have shared settings.  I've tried getting  
this to work via a sqlite database, but have run into corruption  
issues.  I've thought about using NSUserDefaults, but the  
NSGlobalDomain seems to only be global for the user, and I need a  
cross-user persistent domain, which NSUserDefaults doesn't seem to  
provide.


I've tried reading and writing an XML file directly, and I can get  
this to work fine with multiple threads (via a simple NSLock), but  
when I attempt to apply an O_EXLOCK to the file to prevent one process  
from writing to the file while the other is, but it doesn't seem to be  
working.


CFPreferences seems to have most of the same issues as  
NSUserDefaults.  There is a "kCFPreferencesAnyUser" constant, but the  
documentation says that I can only use that if I have admin privileges  
(which the user process does not have).


So my question is this:

How can I effectively implement cross-process and cross-user shared  
settings?


Thanks,

Dave
___

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: QLGenerator PLUGIN_ID [SOLVED]

2009-08-26 Thread David Blanton
I had the generator stripped using project settings. I added a run  
script to do strip -u -r (which according to the strip docs should be  
OK).
It was this additional strip that caused the problem. Removing the run  
script strip and leaving the project settings strip and the generator  
ran fine.







On Aug 26, 2009, at 12:56 PM, Nick Zitzmann wrote:



On Aug 26, 2009, at 12:20 PM, David Blanton wrote:

Which implies to me the systems is looking for a PLUGIN_ID 011FBC8A- 
E945-457D-8252-98120F9C9D8C


Why would this be?


IIRC, the plugin factory ID must also be written in the info.plist  
file. Are you sure it's written correctly in there?


Nick Zitzmann






___

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: Autoscroll NSTableView

2009-08-26 Thread PCWiz

Thanks, that code worked perfectly.

On 2009-08-26, at 3:26 PM, Corbin Dunn wrote:



On Aug 26, 2009, at 2:17 PM, PCWiz wrote:

How do I make it so that an NSTableView automatically scrolls to  
the bottom as new rows are added to it?


There is no automatic way; you have to add code to do it. You should  
probably only do it if the prior row was scrolled to the bottom.


[tableView scrollRowToVisible:[tableView numberOfRows] - 1];

--corbin


___

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: QLGenerator PLUGIN_ID [SOLVED]

2009-08-26 Thread Nick Zitzmann


On Aug 26, 2009, at 3:58 PM, David Blanton wrote:

I had the generator stripped using project settings. I added a run  
script to do strip -u -r (which according to the strip docs should  
be OK).
It was this additional strip that caused the problem. Removing the  
run script strip and leaving the project settings strip and the  
generator ran fine.


Yeah, that would cause it. strip -u -r is for stripping symbols out of  
applications; you shouldn't use it on bundles or libraries or you'll  
destroy them unless you use the opt-in or opt-out commands, and that's  
usually not worth it.


Nick Zitzmann


___

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: Cross-user and cross-process shared settings

2009-08-26 Thread Dave Keck
> I've tried reading and writing an XML file directly, and I can get this to
> work fine with multiple threads (via a simple NSLock), but when I attempt to
> apply an O_EXLOCK to the file to prevent one process from writing to the
> file while the other is, but it doesn't seem to be working.

How doesn't it work?

The O_EXLOCK flag applies an advisory lock to the file. It's not
enforced by the OS - other processes are free to ignore the lock and
write to the file.

Anyway, I recently wrote some code along the lines of what you're
trying to do. (I plan on open-sourcing it before long - I'll announce
it on this list when the code's available.) Here's some notes on how I
went about it:

When changing a property in the preferences I used a simple
transaction mechanism that acquires a lock by creating a lock file,
blocking if another process already holds the lock. Once it acquires
the lock, it first reads the preferences file to update its caches to
prevent old settings from being written. Once updated, it changes the
property in the in-memory cache, and writes the cache to disk.
Finally, it releases the lock.

Reading the preferences is similar: acquire the lock, read preferences
from disk, release the lock. This forces the current process to delay
updating its cache until other processes have finished making their
changes to the preferences file.

This technique works great if one process is writing a file, and
another process is reading it. It also works well if two processes are
writing to the preferences file, if the two processes' changes don't
conflict - that is, process A changes the "AlarmTime" property and
process B changes the "AlarmActions" property. If both processes are
changing the "AlarmActions" property, then which one exists on-disk of
course depends on which process changed the property last.

Hope that helps.
___

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: Cross-user and cross-process shared settings

2009-08-26 Thread Ken Thomases

On Aug 26, 2009, at 4:51 PM, Dave DeLong wrote:

I have two processes - a user process and a root-level  
LaunchDaemon.  I'd like both processes to have shared settings. [...]


How can I effectively implement cross-process and cross-user shared  
settings?


Have you considered using a client-server architecture where the root  
daemon is the holder of the settings (and manages the file they're  
stored in) and the user processes communicate with the daemon to query  
and modify them?


Regards,
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


How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int

2009-08-26 Thread Peter Zegelin

Hi,

I have some xml where an rgb color value is specified via a "#XXYYZZ"  
type string. The xml is being read in via NSXMLParser. I can't seem to  
find an easy Cocoa way to convert this value to an unsigned int. I  
need an unsigned int rather than an NSColor as the value is used in C+ 
+ code.  Does anyone know of something I may be missing?


Thanks!

Peter
___

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: Making failed NSAsserts crash an app

2009-08-26 Thread Rob Keniger


On 27/08/2009, at 7:49 AM, Squ Aire wrote:

Since I absolutely want some information on whenever my NSAsserts  
fail (because they should NEVER fail and I want to know about it if  
they do! (at least during beta testing!)), my question is: How can I  
guarantee that a failed NSAssert will crash my application? I want  
it to happen in such a way that the next time the user loads the  
app, the info about the failed NSAssert (perhaps the 2nd description  
string argument I supply to it, or even the line of code and code  
file) will go along with the crash reports.



You could raise exceptions instead of generating assertion failures.  
Exceptions are caught by several of the crash reporting frameworks.  
You could probably map the NSAssert macros to exception-generation  
code for your beta builds.


--
Rob Keniger



___

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


NSOperation: Selector being called before process finished

2009-08-26 Thread PCWiz

Hi,

I have a class which is a subclass of NSOperation, that runs a shell  
script with AuthorizationExecuteWithPrivileges. Something like this:


// Alloc my auth class and authenticate
Authentication *auth = [[Authentication alloc] init];
[auth authenticate];
// Set permissions on script and run script with  
AuthorizationExecuteWithPrivileges
[auth executeShellCommand:@"chmod 755 /script.sh; chown $USER:admin / 
script.sh; sh /script.sh"];

// Then call selector on main thread to notify that its finished
[[AppDelegate shared] performSelectorOnMainThread:@selector(scriptDone)
   withObject:nil
waitUntilDone:YES];

( "shared" is just a method in my main delegat class that returns  
[[AppDelegate alloc] init]). The issue is that the selector is being  
called a few seconds after the script starts, not when its finished.


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


Leaks in NSDateComponenets object.

2009-08-26 Thread Agha Khan

Hi:
I have leaks in my application, and while I was googling I found
http://stackoverflow.com/questions/674724/using-instruments-leaks-object-alloc-are-autoreleased-objects-counted-as-leaks
where I have the same issue.

Is there work around or we just have to wait until it is fixed if it  
is a known bug.


Thanks
Agha
___

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 Convert "#FF00FF" String Specifying RGB Color to 32 bit int

2009-08-26 Thread Graham Cox


On 27/08/2009, at 9:50 AM, Peter Zegelin wrote:


Hi,

I have some xml where an rgb color value is specified via a  
"#XXYYZZ" type string. The xml is being read in via NSXMLParser. I  
can't seem to find an easy Cocoa way to convert this value to an  
unsigned int. I need an unsigned int rather than an NSColor as the  
value is used in C++ code.  Does anyone know of something I may be  
missing?


Thanks!


I think you need to give more information. How does the unsigned int  
represent RGB colour? Is it divided up into four 8-bit fields? How are  
they ordered? Is it big-endian or little-endian?


With this info, the conversion is easy. Without, it'd be a wild guess  
and almost certainly wrong.


--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: How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int

2009-08-26 Thread Rob Keniger


On 27/08/2009, at 9:50 AM, Peter Zegelin wrote:

I have some xml where an rgb color value is specified via a  
"#XXYYZZ" type string. The xml is being read in via NSXMLParser. I  
can't seem to find an easy Cocoa way to convert this value to an  
unsigned int. I need an unsigned int rather than an NSColor as the  
value is used in C++ code.  Does anyone know of something I may be  
missing?



Something like this?

//assume colorString is something like @"#AABBCC"

unsigned colorCode = 0;
unsigned char redByte, greenByte, blueByte;

if (nil != colorString)
{
NSScanner* scanner = [NSScanner scannerWithString:colorString];
(void) [scanner scanHexInt:&colorCode];
}
redByte   = (unsigned char)(colorCode >> 16);
greenByte = (unsigned char)(colorCode >> 8);
blueByte  = (unsigned char)(colorCode);

--
Rob Keniger



___

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: Making failed NSAsserts crash an app

2009-08-26 Thread Graham Cox


On 27/08/2009, at 10:00 AM, Rob Keniger wrote:

You could raise exceptions instead of generating assertion failures.  
Exceptions are caught by several of the crash reporting frameworks.  
You could probably map the NSAssert macros to exception-generation  
code for your beta builds.



The NSAssert macros raise exceptions by default in debug builds.

--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: How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int

2009-08-26 Thread Waqar Malik

Peter,
  I use NSScanner to parse the string to get individual values.

NSRange range = NSMakeRange(1, 2);
NSUInteger value = 0;

[[NSScanner scannerWithString:[string substringWithRange:range]]  
scanHexInt:&value]


// WARNING: code typed in email

--Waqar
On Aug 26, 2009, at 4:50 PM, Peter Zegelin wrote:


Hi,

I have some xml where an rgb color value is specified via a  
"#XXYYZZ" type string. The xml is being read in via NSXMLParser. I  
can't seem to find an easy Cocoa way to convert this value to an  
unsigned int. I need an unsigned int rather than an NSColor as the  
value is used in C++ code.  Does anyone know of something I may be  
missing?


Thanks!

Peter

___

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 Convert "#FF00FF" String Specifying RGB Color to 32 bit int

2009-08-26 Thread Gideon King
Here's what we use to convert from an ARGB hex value to an NSColor -  
you could perhaps use a similar method and just shift the bytes and or  
them together as required for your unsigned int.


+ (NSColor *)colorWithHexARGB:(NSString*)hexString {
unsigned int redByte, greenByte, blueByte, alphaByte;

if ([hexString length] != 9) {
return nil;
}
	NSScanner *scanner = [NSScanner scannerWithString:[hexString  
substringWithRange:NSMakeRange(1, 2)]];

[scanner scanHexInt:&alphaByte];
	scanner = [NSScanner scannerWithString:[hexString  
substringWithRange:NSMakeRange(3, 2)]];

[scanner scanHexInt:&redByte];
	scanner = [NSScanner scannerWithString:[hexString  
substringWithRange:NSMakeRange(5, 2)]];

[scanner scanHexInt:&greenByte];
	scanner = [NSScanner scannerWithString:[hexString  
substringWithRange:NSMakeRange(7, 2)]];

[scanner scanHexInt:&blueByte];

return [NSColor colorWithCalibratedRed:(float)redByte / 0xff
   green:(float)greenByte / 0xff

blue:(float)blueByte / 0xff
   
alpha:(float)alphaByte / 0xff];
}



HTH

Gideon

I have some xml where an rgb color value is specified via a  
"#XXYYZZ" type string. The xml is being read in via NSXMLParser. I  
can't seem to find an easy Cocoa way to convert this value to an  
unsigned int. I need an unsigned int rather than an NSColor as the  
value is used in C++ code.  Does anyone know of something I may be  
missing?


___

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: NSOperation: Selector being called before process finished

2009-08-26 Thread Kyle Sluder
On Wed, Aug 26, 2009 at 5:01 PM, PCWiz wrote:
> I have a class which is a subclass of NSOperation, that runs a shell script
> with AuthorizationExecuteWithPrivileges. Something like this:

You are not using AuthorizationExecuteWithPrivileges correctly.  For
security reasons, the privileged code must be factored out into a
helper tool that is setuid root.  This tool must use AEWP only to
repair its setuid status in case it loses it.

--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


Does touch input require rotaion also?

2009-08-26 Thread Erg Consultant
When i rotate my view 90 degrees, some of the touches I receive give weird 
coordinates that appear to be incorrect. Do I need to apply a transform to the 
touch input matrix as well as the view when I rotate it?

Thanks,

Erg



  
___

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: NSOperation: Selector being called before process finished

2009-08-26 Thread Kyle Sluder
No.  Take a look at BetterAuthorizationSample:
http://developer.apple.com/SampleCode/BetterAuthorizationSample/listing6.html

I should have just sent you there in the first place, because true to
form I have recommended something you shouldn't do.  BAS does *not*
use a setuid tool.

--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


Re: Leaks in NSDateComponenets object.

2009-08-26 Thread Agha Khan

Dear Erg Cosultant:
Are you suggesting I should write my own DateComponenets?
If your answer is yes then it makes some sense.

Best regards
Agha

On Aug 26, 2009, at 5:37 PM, Erg Consultant wrote:

There is no guarantee autorreleased objects will be free immediately  
- they may be freed at some later time. Hence they may show up as  
leaks when they are in fact not.


I am not a fan of autorelased objects except in very rare  
circumstances where it actually makes the code easier.


Other than that, I alloc/release all my objects manually so I know  
EXACTLY when they are going away.


From: Agha Khan 
To: Cocoa-dev@lists.apple.com
Sent: Wednesday, August 26, 2009 5:06:46 PM
Subject: Leaks in NSDateComponenets object.

Hi:
I have leaks in my application, and while I was googling I found
http://stackoverflow.com/questions/674724/using-instruments-leaks-object-alloc-are-autoreleased-objects-counted-as-leaks
where I have the same issue.

Is there work around or we just have to wait until it is fixed if it  
is a known bug.


Thanks
Agha
___

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/erg_consultant%40yahoo.com

This email sent to erg_consult...@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: Normalize an NSAttributedString

2009-08-26 Thread Michael Ash
On Wed, Aug 26, 2009 at 2:59 PM, Ken Thomases wrote:
> On Aug 26, 2009, at 1:45 PM, Michael Ash wrote:
>
>> On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases wrote:
>>>
>>> I'm well aware of what it means.  The question is, which exact operations
>>> on
>>> the mutable string proxy does CFStringNormalize perform.  If
>>> CFStringNormalize performs the minimal replace operations to get the
>>> result,
>>> then it will preserve the attributes closely.  It's conceivable, though,
>>> that CFStringNormalize uses a side buffer to compute the normalized form
>>> and
>>> then does one big replace of the whole mutable string's range.  Or,
>>> anywhere
>>> in between.  Like, it might replace a series of precomposed characters
>>> with
>>> their decompositions all with one replace operation.  In that case, the
>>> attributes of most of the characters will be lost (replaced with the
>>> attributes of the first character in the replace range).
>>>
>>> So, it's clear that the _strings_ will always have a deterministic value
>>> as
>>> a result of normalization.  That's the point of normalization.  But the
>>> _attributed strings_ may not.
>>
>> Fair enough. However, as Douglas pointed out, you aren't guaranteed
>> consistent results if you have multiple attributes within a single
>> decomposed character range *anyway*, so you're going to have trouble
>> regardless. Better to avoid that situation altogether.
>
> My point about this lossiness has nothing to do with multiple attributes
> within a single grapheme.  The attributes for the entire string may get
> munged.

Finally got it through my thick head. Sorry about that. You are
correct as far as I can see; nothing in the API contract says that it
couldn't just delete the whole string and start anew. This would be
inefficient, and it wouldn't make sense for this to be a
CFMutableString API if that's all it does, but it *could*. The
implementation in CFLite does not do this, but that implementation is
only for NSCFStrings. I don't think the implementation used for custom
NSMutableString subclasses is public, and of course even if it were
there's no guarantee it wouldn't change.

Perhaps the best bet would be to borrow the CFLite implementation,
fixed up to work on an external string, and then you know what the
implementation is and that it does what you need.

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


_subtreeDescription: What do the ampersands mean?

2009-08-26 Thread Michael A. Crawford
In the line of GDB output below, what do the ampersands following the  
h= and v= mean?


(gdb) po [self _subtreeDescription]
[ D A W#] h=--& v=&-- NDView 0x10012fca0 f=(0,113,480,473) b=(-)  
=>  TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay,  
F=flipped, G=gstate, H=hidden (h=by ancestor), O=opaque,  
P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer  
(w=ancestor wantsLayer), #=has surface


-Michael




___

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: Why I have to load nib file?

2009-08-26 Thread simone gabbriellini

Hi,
Try to look at the info.plist file, there should be a link to the nib  
file...


Simone

Sent from my iPhone

On 26/ago/2009, at 07.48, Agha Khan  wrote:


Dear Roland King:
I admit I am new to iPhone and did read that book. which I mentioned.
In future I will try not to ask before googling.
Best regards
Agha

On Aug 25, 2009, at 9:51 PM, Roland King wrote:

Do you ever try reading any documentation before you post your  
random questions to the list?


go read this

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIApplicationMain

and that

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7

Agha Khan wrote:

HI:
Reading iPhone Developer's Cookbook I realized we do not need a  
nib  file.

The author was developing all applications without nib files.
It worked fine with OS 2.2.
Toady I complied his first program  and got this error message.
2009-08-25 21:32:56.428 HelloWorld[2770:20b] Failed to load   
NSMainNibFile //MainWindow.
But why? We shouldn't get this message. How can we get rid of  
this  message.

int main(int argc, char *argv[]) {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  int retVal = UIApplicationMain(argc, argv, nil,   
@"SomeAppDelegate");

  [pool release];
  return retVal;
}
Best regards
Agha
___
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/rols%40rols.org
This email sent to r...@rols.org


___

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/simone.gabbriellini%40gmail.com

This email sent to simone.gabbriell...@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


NSTableView drag from Finder Problem

2009-08-26 Thread Support
I fear that I may be asking a daft question here - but I've been puzzling over 
this for a while now and it's confusing the hell out of me.  Probably only a 
quick fix too!  I'm trying to implement NSTableView so that files can be 
dragged in from Finder.  The NSTableView is within an NSSplitView (just in case 
that makes a difference) and it uses an NSMutableArray as the datasource. 

The NSTableView uses the same class as datasource and delegate, for sent 
actions and for the referencing outlet.  They all appear to be hooked up 
correctly. 

The code for that class is as follows: 


@implementation LibraryView 

//--- Initialize // 
- (id)init 
{ 
self = [super init]; 
if (self) 
{ 
[unseenLibraryView registerForDraggedTypes:[NSArray 
arrayWithObjects:NSFilenamesPboardType, nil]]; 
 
NSLog(@"Debug - Initializing"); 
} 
return self; 
} 

- (int)numberOfRowsInTableView:(NSTableView *)tableView 
{ 
return [unseenLibrary count]; 
} 

- (id)tableView:(NSTableView *)aTableView 
objectValueForTableColumn:(NSTableColumn *)aTableColumn 
row:(int)row 
{ 
id theRecord, theValue; 
theRecord = [unseenLibrary objectAtIndex:row]; 
 
theValue = [theRecord objectForKey:[aTableColumn identifier]]; 
if ([theValue length] == 0) theValue = @""; 
 
return theValue; 
} 

#pragma mark - 
#pragma mark Drag and Drop Handler 

//--- Drag and Drop Handler---// 
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes 
 :(NSIndexSet *)rowIndexes toPasteboard 
 :(NSPasteboard*)pboard 
{ 
unsigned indexBuffer[[rowIndexes count]]; 
unsigned limit = [rowIndexes getIndexes:indexBuffer maxCount:[rowIndexes 
count] 
   inIndexRange:NULL]; 
unsigned idx; 
 
NSMutableArray *fileNames = [[NSMutableArray alloc] init]; 
 
for (idx = 0; idx < limit; idx++) 
{ 
id record = [unseenLibrary objectAtIndex:indexBuffer[idx]]; 

[fileNames addObject:[record objectForKey:@"filepath"]]; 
} 
 
[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] 
owner:nil]; 
[pboard setPropertyList:fileNames forType:NSFilenamesPboardType]; 
[fileNames release]; 
return YES; 
} 

- (NSDragOperation)tableView:(NSTableView*)table validateDrop 
:(id )info proposedRow 
:(int)row proposedDropOperation 
:(NSTableViewDropOperation)operation 
{ 
NSLog(@"debug validate drop"); 
 
// Make drops at the end of the table go to the end. 
if (row == -1) 
{ 
row = [table numberOfRows]; 
operation = NSTableViewDropAbove; 
[table setDropRow:row dropOperation:operation]; 
} 
 
// We don't ever want to drop onto a row, only between rows. 
if (operation == NSTableViewDropOn) 
[table setDropRow:(row+1) dropOperation:NSTableViewDropAbove]; 
return NSTableViewDropAbove; 
} 

- (BOOL)tableView:(NSTableView*)table acceptDrop:(id )info row 
 :(int)dropRow dropOperation 
 :(NSTableViewDropOperation)op; 
{ 
NSLog(@"debug accept drop"); 
 
NSPasteboard *pb = [info draggingPasteboard]; 
 
BOOL accepted = NO; 
 
NSArray*array; 
if (!accepted && (array = [pb propertyListForType:NSFilenamesPboardType]) 
!= NULL) 
{ 
[self addFiles:[array 
sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] 
atIndex:dropRow]; 
accepted = YES; 
} 
 
return accepted; 
} 

#pragma mark - 
#pragma mark Table Update Handler 


- (void)updateLibraryTable 
{ 
// Tell the table to reload. 
[unseenLibraryView reloadData]; 
 
} 


//--- Add files to table --// 
- (void)addFiles:(NSArray*)filenames atIndex:(unsigned)index 
{ 
NSLog(@"debug add files"); 

unsigned int i = 0, count = [filenames count]; 
 
if (count == 0) 
return; 
 
for (i = 0; i < count; ++i) 
{ 
NSString *path = [filenames objectAtIndex:i]; 
NSLog(@"debug %@",path); 
 
[self updateLibraryTable]; 
} 
 
} 

@end 


I can see from the debug that the init function is called and that the dragged 
types are therefore registered.  Alas, ValidateDrop and AcceptDrop are never 
called.  Does anyone have any idea what I've done wrong?  All suggestions would 
be gratefully received. 

Regards, 

Pascal 
___

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 draw over all other windows

2009-08-26 Thread Gabriel Zachmann

I would like to replicate the behavior of this little application: 
http://krugazor.free.fr/software/highlight/
With it, you can draw over all other windows, like on a transparent  
canvas.


What mystifies me is that this even works with Powerpoint being in  
presentation mode!


I have already experimented a bit myself, starting from the little  
example RoundTransparentWindow provided on ADC.

Transparency and click-through work fine.
But as soon as I click on an element of the transparent window (in the  
example it is an image), Powerpoint quits presentation mode (which is  
its usual behavior when bringing another application to the foreground)!


I don't even know what keywords I could google for ...

Any hints, pointers, and suggestions will be highly appreciated.

Best regards,
Gabriel.











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

Question regarding parsing files and NSTask

2009-08-26 Thread Brent Smith
Hey all,
Ive been trying to think of a good way around my current solution for
displaying contents of a text file.

Right now I basically run an NSTask on tail -f and that's about it. I plan
on redoing this section of the code to allow the scroll view to go all the
way back to the beginning of the document, and possibly adding in markers.
I'm really curious if I should just parse through the file and add the
contents into the text area/scrollview or should I build out an object and
pass that object to a sub classed textview that displays the contents of the
object.

I'm really worried about how efficient this method is and what will happen
with very large files. Does anyone know how console.app accomplishes this?
Are there any sample projects I can take a look at that do something
similar?

Thanks in advance.
___

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: Autoscroll NSTableView

2009-08-26 Thread Thomas Willson
I have a related question; I wanted to figure out if the text view was  
scrolled to the bottom. I found this in the archives:



Compare the -visibleRect to the -bounds of the text view.  If the
visible rect is at the end of the bounds, the user can see the end.
Otherwise the user can not.


Being a newish cocoa developer, I need slightly more detail in the  
explanation. How do you compare the two? I am assuming I can't simply  
check if they are equal.


On Aug 26, 2009, at 2:59 PM, PCWiz wrote:


Thanks, that code worked perfectly.

On 2009-08-26, at 3:26 PM, Corbin Dunn wrote:



On Aug 26, 2009, at 2:17 PM, PCWiz wrote:

How do I make it so that an NSTableView automatically scrolls to  
the bottom as new rows are added to it?


There is no automatic way; you have to add code to do it. You  
should probably only do it if the prior row was scrolled to the  
bottom.


[tableView scrollRowToVisible:[tableView numberOfRows] - 1];

--corbin


___

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/thomas.willson%40me.com

This email sent to thomas.will...@me.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: NSTableView drag from Finder Problem

2009-08-26 Thread Nick Zitzmann


On Aug 26, 2009, at 10:10 AM, Support wrote:

I can see from the debug that the init function is called and that  
the dragged types are therefore registered. Alas, ValidateDrop and  
AcceptDrop are never called.  Does anyone have any idea what I've  
done wrong?


Are you **really** sure it's getting the message? If unseenLibraryView  
is an outlet, then you'll need to move the code to -awakeFromNib,  
since outlets aren't initialized until the nib is loaded, and nibs are  
not loaded in initializers.


Nick Zitzmann




___

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: NSSplitView resizing

2009-08-26 Thread Brandon Walkin

This can be done completely in IB if you use BWToolkit. 
http://brandonwalkin.com/bwtoolkit/

Demo video: http://brandonwalkin.com/blog/videos/iCalSplitView.mov

Brandon

On 2009-08-26, at 11:48 AM, Oftenwrong Soong wrote:


Hi all,

I have a window containing a NSSplitView. When the window is  
resized, both panes of the split view resize proportionally. I would  
like one pane to remain fixed while the other resizes. Xcode does  
this, as well as iCal and other apps.


Is there a delegate method that does this or must I subclass  
NSSplitView?


Thanks,
Soong




___

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/bwalkin%40gmail.com

This email sent to bwal...@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


Problem building for 10.4 on 10.6

2009-08-26 Thread Greg Hoover
Has anyone seen an error in XCode like this: GCC 4.2 is not compatible  
with the Mac OS X 10.4 SDK (file NSString+extras.m)


I remove the referenced file and another pops up.  I can build using  
the 10.5 SDK, but attempting to build with 10.4 doesn't seem to work.


Thanks,
Greg
___

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: Problem building for 10.4 on 10.6

2009-08-26 Thread Glenn L. Austin

On Aug 26, 2009, at 8:41 PM, Greg Hoover wrote:

Has anyone seen an error in XCode like this: GCC 4.2 is not  
compatible with the Mac OS X 10.4 SDK (file NSString+extras.m)


I remove the referenced file and another pops up.  I can build using  
the 10.5 SDK, but attempting to build with 10.4 doesn't seem to work.



Yes -- the problem is that you're using GCC 4.2.  You need to change  
the C/C++/Obj-C compiler to GCC 4.0.


--
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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: Problem building for 10.4 on 10.6

2009-08-26 Thread Ken Thomases

On Aug 26, 2009, at 10:41 PM, Greg Hoover wrote:

Has anyone seen an error in XCode like this: GCC 4.2 is not  
compatible with the Mac OS X 10.4 SDK (file NSString+extras.m)


I remove the referenced file and another pops up.  I can build using  
the 10.5 SDK, but attempting to build with 10.4 doesn't seem to work.


All things 10.6 are still under NDA.  You should go to  to discuss this issue, but search before posting.  By the way, the  
error you mention includes all of the info you need to address this.   
You've considered changing one of the two things mentioned, try  
changing the other.


Regards,
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: NSSplitView resizing

2009-08-26 Thread Oftenwrong Soong
On Wednesday, August 26, 2009 8:22:24 PM, Brandon Walkin  
wrote:
> This can be done completely in IB if you use BWToolkit. 
> http://brandonwalkin.com/bwtoolkit/
>
> Demo video: http://brandonwalkin.com/blog/videos/iCalSplitView.mov
>
> Brandon


Wow, that is a *really* impressive control! Thanks for the video and for 
pointing out your toolkit. I'll be checking it out.

In this app my needs are very limited (for now at least!) so I implemented a 
simple delegate method. Everyone's input helped tremendously. Thanks to 
everyone who posted:

- (void)splitView:(NSSplitView *)sender 
resizeSubviewsWithOldSize:(NSSize)oldSize
{
NSRect newFrame = [sender frame];
NSArray * subviews = [sender subviews];
CGFloat dividerThickness = [sender dividerThickness];

NSView * leftView = [subviews objectAtIndex:0];
NSRect leftFrame = [leftView frame];

NSView * rightView = [subviews objectAtIndex:1];
NSRect rightFrame = [rightView frame];

// Height always follows split view
leftFrame.size.height = rightFrame.size.height = newFrame.size.height;

// Width of left frame is left untouched; All width resizing occurs in right 
frame
rightFrame.size.width = newFrame.size.width - leftFrame.size.width - 
dividerThickness;

// Post our changes
[leftView setFrame:leftFrame];
[rightView setFrame:rightFrame];
}



  
___

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: Problem building for 10.4 on 10.6

2009-08-26 Thread Greg Hoover

Thanks, I knew it had to be something simple that I was overlooking.

On Aug 26, 2009, at 8:50 PM, Glenn L. Austin wrote:


On Aug 26, 2009, at 8:41 PM, Greg Hoover wrote:

Has anyone seen an error in XCode like this: GCC 4.2 is not  
compatible with the Mac OS X 10.4 SDK (file NSString+extras.m)


I remove the referenced file and another pops up.  I can build  
using the 10.5 SDK, but attempting to build with 10.4 doesn't seem  
to work.



Yes -- the problem is that you're using GCC 4.2.  You need to change  
the C/C++/Obj-C compiler to GCC 4.0.


--
Glenn L. Austin, Computer Wizard and Race Car Driver <><






___

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