locale sensitive string comparison on Tiger

2009-05-14 Thread Martin Wierschin

Hi everyone,

I'm attempting to compare some strings using arbitrary locales. On  
Leopard this works fine, the NSString method  
"compare:options:range:locale:" accepts an actual NSLocale instance.  
However, on Tiger the parameter is typed as NSDictionary. Searching  
the archives turns up that the dictionary should be generated like so:


	NSDictionary* localeDict = [[NSUserDefaults standardUserDefaults]  
dictionaryRepresentation];


Ignoring the weirdness of that, I'm sure it works great for the  
current locale, but I need a dictionary for an arbitrary locale, eg:


	NSLocale* locale = [[NSLocale alloc]  
initWithLocaleIdentifier:@"is"]; // Iceland


How do I go about generating one? I tried using:

	NSDictionary* localeDict = [NSLocale  
componentsFromLocaleIdentifier:@"is"];


But it doesn't seem to affect the comparison results. Am I just out  
of luck on Tiger?


TIA,
~Martin

___

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


Best practices for communicating with Java via Cocoa?

2009-05-14 Thread Conrad Taylor
Hi, what are the best practices for communicating to Java from Cocoa?  It
seems that a lot of the Java Bridge documents have been deprecated.  For
example, I'm seeing the following message:
Legacy Document

Important:  The information in this document is obsolute and should not be
used for new development.

I understand the message.  So, what should one use now to achieve this goal?

Thanks in advance,

-Conrad
___

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: NSSpellChecker (foundation) broken for custom NSSpellServer servers

2009-05-14 Thread Adam Strzelecki

FYI this bug has been finally fixed in 10.5.7.

I need to pay honor to Apple for writing me to check & verify the  
bugfix, and to let many of us to switch spell checker language without  
glitches.
This really makes my day! Thanks for everyone who followed this thread  
and sent reports to Apple's bugtracker as well.


Cheers,
--
Adam Strzelecki

___

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 write passord in KeyChain using cocoa

2009-05-14 Thread sandeep chaudhary
Hi all,
I am working on Objective-C( cocoa framework). I need to write some data( like 
password...) in KeyChain Utility programatically.I have searched  about how to 
write in KeyChain but could not find any solution. 
Can you plese tell me how can i write password in KeyChain programatically 
using Objective-C. Also can i create my own folder and write my passord  inside 
this folder in KeyChain?Please describe me in details
Any help is much appreciated

Thanks-sandeep


  Bollywood news, movie reviews, film trailers and more! Go to 
http://in.movies.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: how to write passord in KeyChain using cocoa

2009-05-14 Thread I. Savant

On May 14, 2009, at 6:59 AM, sandeep chaudhary wrote:

I am working on Objective-C( cocoa framework). I need to write some  
data( like password...) in KeyChain Utility programatically.I have  
searched  about how to write in KeyChain but could not find any  
solution.



  That's odd, searching the documentation for "keychain" brings up  
something called the "Keychain Services Programming Guide":


http://developer.apple.com/search.php?q=keychain&site=(cocoa)&

  It's even the first hit.

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


[Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread malte . philipp

Hello list!

On my path to learning Cocoa, I am currently trying to get a grasp on  
the "bindings thing".
Now I have run into a situation I can not solve myself, can not  
google the solution to, and could not get an answer to browsing Cocoa- 
Dev mailing list archive. I have the feeling it is very newb-ish  
indeed, but from my end of the line it feels like rocket science at  
the moment. :( Here goes:


I have stepped through the very excellent binding tutorial at http:// 
www.cocoadevcentral.com/articles/80.php by Scott Stevenson. I  
have followed the instructions and got it to run flawlessly.


I am also reading the very excellent introductory read "Cocoa  
Programming for Mac OS X" by Aaron Hillegass and have followed the  
instructions on his binding example.


Now here is what has me utterly confused and my actual question:

In his tutorial Scott is setting up an NSObjectController (named  
"ControllerAlias" there) and binds that to the "MyController"  
instance with the explanation:


This little green box is your "bridge" between the code in  
MyController.m and the bindings system.


The two NSArrayControllers afterwards are bound to that  
'ControllerAlias' NSObjectController.


Aaron in his book has me creating an NSArrayController and bind that  
directly to the instance with the array to be controlled. Essentially  
skipping the NSObjectController entirely. When I just thought it was  
my "bridge to the bindings system"?



I would really like to understand the difference in approach between  
these two methods and also if there are any implications by using or  
skipping an NSObjectController in between. Would anyone find the time  
and inclination to explain this to me, please?


Thank you!

Philipp
___

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: Best practices for communicating with Java via Cocoa?

2009-05-14 Thread Warren Dodge

On May 14, 2009, at 3:08 AM, Conrad Taylor wrote:
Hi, what are the best practices for communicating to Java from  
Cocoa?  It
seems that a lot of the Java Bridge documents have been deprecated.   
For

example, I'm seeing the following message:
Legacy Document

Important:  The information in this document is obsolute and should  
not be

used for new development.

I understand the message.  So, what should one use now to achieve  
this goal?


JNI seems to be the recommended method for Java <--> Cocoa  
interoperability now.

See Technical Note TN2147 -- JNI Development on Mac OS X
  http://developer.apple.com/technotes/tn2005/tn2147.html

Warren

___

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: Special requirements for the window param of NSAlert beginSheetModalForWindow?

2009-05-14 Thread Michael Ash
On Thu, May 14, 2009 at 12:27 AM, Sean McBride  wrote:
> Michael Ash (michael@gmail.com) on 2009-05-13 11:07 PM said:
>
>>2) Display the second window as a modal panel instead of a sheet.
>>Apple does this with NSSavePanel if you try to save over an existing
>>file. It's easy and works well, but of course the modal panel blocks
>>your entire application while it's being displayed.
>
> Mike,
>
> Your advice is good, to be sure, but you are incorrect about the above.
> In fact, the 'do you want to replace?' question is displayed in a sheet
> that appears on top of the save panel sheet.

So it is. I must have been thinking of something else.

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: Inverting a black and white NSImage

2009-05-14 Thread Eric Gorr

On May 13, 2009, at 7:08 PM, Randall Meadows wrote:


On May 13, 2009, at 4:59 PM, Eric Gorr wrote:


I have a black and white NSImage with some pixels in the image
totally transparent.

I need to change the white pixels to black, the black pixels to
white, and leave the transparent area in the image alone.

The only solution that comes immediately to mind is to get a bitmap
representation of the image, loop over all of the pixels and invert
each one by one. Based on the kind of image I am dealing with, this
should be just fine.

However, I am thinking there is an easier solution, but my mind is
drawing a blank - probably because it is getting late and I should
go home.


Use the CIColorInvert Core Image filter.


Brilliant. Thank you.

Based on this, I was able to find

  http://www.cocoadev.com/index.pl?NSImageCategory

which makes applying a CI filter to a NSImage easy.


___

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: Special requirements for the window param of NSAlert beginSheetModalForWindow?

2009-05-14 Thread Keary Suska

On May 13, 2009, at 9:07 PM, Michael Ash wrote:


3) Use performSelector:withObject:afterDelay: with a 0 delay to run
the code to show the new sheet after the old sheet has truly gone
away. This will result in one sheet being followed by another sheet as
you desire.


I have had success with successive sheet display by calling -orderOut:  
or -close: on the sheet before displaying the next. This is also  
documented as the proper way to display successive sheets.


On May 13, 2009, at 10:27 PM, Sean McBride wrote:


Your advice is good, to be sure, but you are incorrect about the  
above.


In fact, the 'do you want to replace?' question is displayed in a  
sheet



that appears on top of the save panel sheet.



Yes, but the docs are clear that stacked or nested sheets are not  
supported, and violate HIG. It also doesn't work well if you try to  
force it.


Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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

2009-05-14 Thread Scott Ribe
> Actually I have big DB, so for a single change it will take lot of time to get
> reflected

NSTableView only fetches data for rows as they are displayed, so it should
not take a long time to redraw.

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


___

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

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

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

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


Re: Updating NSTableView

2009-05-14 Thread I. Savant
On Thu, May 14, 2009 at 10:24 AM, Scott Ribe  wrote:
>> Actually I have big DB, so for a single change it will take lot of time to 
>> get
>> reflected
>
> NSTableView only fetches data for rows as they are displayed, so it should
> not take a long time to redraw.

  ... well, unless you have variable-height rows. Then (potentially
complex) calculations have to be done to determine those cells that do
need to be drawn.

  Corbin? Do I have this right?

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

2009-05-14 Thread Scott Ribe
>   ... well, unless you have variable-height rows. Then (potentially
> complex) calculations have to be done to determine those cells that do
> need to be drawn.
> 
>   Corbin? Do I have this right?

Well yes. Although that can be solved with the right underlying model...

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


___

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

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

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

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


Re: Updating NSTableView

2009-05-14 Thread I. Savant
On Thu, May 14, 2009 at 10:34 AM, Scott Ribe  wrote:
>>   ... well, unless you have variable-height rows. Then (potentially
>> complex) calculations have to be done to determine those cells that do
>> need to be drawn.
>>
>>   Corbin? Do I have this right?
>
> Well yes. Although that can be solved with the right underlying model...

  [ Intrigued ] ... that being?

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

2009-05-14 Thread Scott Ribe
> [ Intrigued ] ... that being?

First a fast way to read the data off disk to begin with, for start up time.
Then caching of row heights when they are calculated. Finally binary search
of row heights/positions when mapping coordinates to row indexes.

Of course depending on what calculations are truly necessary, the first draw
may still be slow, but there's really no reason a redraw should be slow
after changing one (or a few) values.

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


___

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

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

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

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


Re: singletons and autoreleased objects (Karan, Cem (Civ, ARL/CISD))

2009-05-14 Thread Scott Ribe
> Please ignore  
> the original question.

No ;-)

It is perfectly reasonable for a handful of objects to get allocated and
never freed throughout the lifetime of a run. It is perfectly reasonable for
some such objects to be instantiated lazily rather than at startup. So it is
normal to have some false positives if you look at the whole program
execution.

A standard technique is to exercise a function, then "mark" memory, the
perform the same function and look for leaked memory. This avoids flagging
one-time-only allocations that by design don't get freed, and is what I
typically do during development. Then very late in testing I'll look at the
whole program run and try to make sure that all never-deallocated memory is
appropriate.

Maybe you already knew this, but I thought it was worth posting for the
archives...

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


___

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

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

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

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


Re: Updating NSTableView

2009-05-14 Thread I. Savant
On Thu, May 14, 2009 at 10:41 AM, Scott Ribe  wrote:

>
> First a fast way to read the data off disk to begin with, for start up time.
> Then caching of row heights when they are calculated. Finally binary search
> of row heights/positions when mapping coordinates to row indexes.
>
> Of course depending on what calculations are truly necessary, the first draw
> may still be slow, but there's really no reason a redraw should be slow
> after changing one (or a few) values.

  Informative, thank you.

--
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: [Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread Keary Suska

On May 14, 2009, at 5:51 AM, malte.phil...@mac.com wrote:


Now here is what has me utterly confused and my actual question:

In his tutorial Scott is setting up an NSObjectController (named  
"ControllerAlias" there) and binds that to the "MyController"  
instance with the explanation:
This little green box is your "bridge" between the code in  
MyController.m and the bindings system.
The two NSArrayControllers afterwards are bound to that  
'ControllerAlias' NSObjectController.


Aaron in his book has me creating an NSArrayController and bind that  
directly to the instance with the array to be controlled.  
Essentially skipping the NSObjectController entirely. When I just  
thought it was my "bridge to the bindings system"?


I would really like to understand the difference in approach between  
these two methods and also if there are any implications by using or  
skipping an NSObjectController in between. Would anyone find the  
time and inclination to explain this to me, please?


Well, these two examples do not solve the same problem, so compare/ 
contrast would not be useful. You need to understand the Model-View- 
Controller (MVC) pattern as it is used in Cocoa. You will find this  
the docs (just search for "cocoa patterns" and I bet you'll find it  
easily). NSController and its subclasses (which include  
NSObjectController and NSArrayController) were designed  to be the "C"  
in this pattern specifically for bindings. Have you read "Cocoa  
Bindings Programming Topics"?


Additional info I would add: the important difference between the two  
examples is that Scott's  uses a tiered approach (common for master- 
detail interfaces, for instance, in their simplest form), where one  
controller provides the content for another controller, while Aaron's  
is the more straightforward single-controller approach (although  
iterate, these aren't approaches to the same problem, but approaches  
to different problems). Note also the purpose of NSObjectController vs  
NSArrayController. As the name implies, the former is for binding to a  
single object, while the latter is for binding to an array of objects.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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

2009-05-14 Thread Corbin Dunn


On May 14, 2009, at 7:49 AM, I. Savant wrote:


On Thu, May 14, 2009 at 10:41 AM, Scott Ribe > wrote:






First a fast way to read the data off disk to begin with, for start  
up time.


Then caching of row heights when they are calculated. Finally  
binary search


of row heights/positions when mapping coordinates to row indexes.



Of course depending on what calculations are truly necessary, the  
first draw


may still be slow, but there's really no reason a redraw should be  
slow


after changing one (or a few) values.



 Informative, thank you.



Yup, Scott's idea sounds like a good plan. Most people get good  
performance out of variable row heights by doing some sort of caching  
or heuristic that quickly determines the row height.


-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


Hide/Show Password

2009-05-14 Thread Patrick Neave


I would like to add a little button next to my apps password field to  
hide/show the password. I have searched this list but although it has  
bee mentioned I can find no example of doing this. NSSecureTextField  
seems to be the way to go but I am not having any luck.


Any ideas how I could go about implementing this?

Regards,

Patrick


___

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: Hide/Show Password

2009-05-14 Thread Frederik Slijkerman
You can't toggle the password behavior in NSSecureTextField, so if you 
still need to toggle this, you can either create both a regular 
NSTextField and a NSSecureTextField and hide/show/synchronize them as 
needed, or recreate the text field with the correct class when needed...


Best regards,
Frederik Slijkerman


Patrick Neave wrote:


I would like to add a little button next to my apps password field to 
hide/show the password. I have searched this list but although it has 
bee mentioned I can find no example of doing this. NSSecureTextField 
seems to be the way to go but I am not having any luck.


Any ideas how I could go about implementing this?

Regards,

Patrick


___

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/fjs%40xs4all.nl

This email sent to f...@xs4all.nl



___

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: Hide/Show Password

2009-05-14 Thread Keary Suska

On May 14, 2009, at 9:40 AM, Patrick Neave wrote:



I would like to add a little button next to my apps password field  
to hide/show the password. I have searched this list but although it  
has bee mentioned I can find no example of doing this.  
NSSecureTextField seems to be the way to go but I am not having any  
luck.


A tabless/borderless NSTabView?

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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: Interpreting -underlinePosition and -underlineThickness

2009-05-14 Thread Benjamin Stiglitz
> How should NSFont's -underlinePosition and -underlineThickness values be 
> interpreted? Are they fixed values, indicating an absolute offset, or are 
> they some proportion of the pointSize or something else?

In the optimal case (I’ll explain shortly), the underlinePosition is the
number of points below the baseline to position the center of the line
with width underlineThickness.

However (and this is a big however), many fonts report an invalid
underline thickness and/or position. In this case, both the Cocoa and
CoreText rendering paths cook up values based on the average of the
metrics of Helvetica and Times, scaled to fit the metrics of the
selected font. (Please do file a bug for API to access these computed
values.)

> I ask because the results I'm getting by treating it as an absolute  
> value differ from Apple's rendition, but the docs are unenlightening on 
> this point.

An image with a comparison would go a long way to helping us diagnose
this issue.

-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: Special requirements for the window param of NSAlert beginSheetModalForWindow?

2009-05-14 Thread Sean McBride
On 5/14/09 8:12 AM, Keary Suska said:

>> Your advice is good, to be sure, but you are incorrect about the
>> above.
>
>> In fact, the 'do you want to replace?' question is displayed in a
>> sheet
>
>> that appears on top of the save panel sheet.
>
>
>Yes, but the docs are clear that stacked or nested sheets are not
>supported, and violate HIG. It also doesn't work well if you try to
>force it.

In general I agree that stacked or nested sheets are not good.  But like
everything in life, there are exceptions.  I think the "do you want to
replace?" case is one such exception.  Closing the save panel would be
annoying, because if you decide against replacing you then need to show
the save panel again.  App-wide modality is a worse evil.  So in this
case it's the least bad choice, IMHO.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: initWIthFrame or awakeFromNib

2009-05-14 Thread Jonathan Hess

On May 13, 2009, at 9:32 PM, Joar Wingfors wrote:

...to follow up on that a bit: When you're instantiated from nib  
loading you will not see "-initWithFrame:" being called, but rather  
"-initWithCoder:". You can read more about that in the NSCoding &  
Nib Loading documentation.


Depending on what you subclass, you might get either message.

Here's a link to the documentation:
http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/1051i-CH4-SW18



You can in a case like this implement both "-initWithFrame:" and "- 
initWithCoder:" and then call the method that provides your shared  
initialization code from both of them, like Luke suggested.


I would add that if there's any chance that your view might in turn  
be subclassed, you should probably pick a unique name for the  
method, so that it's not stomped on by a subclass doing the same  
thing. Something like: "-commonInitForFoo", if Foo is the name of  
the class in question.


Finally, you need to treat "-initWithCoder:" just like you would any  
other init method. Unlike "-awakeFromNib" you must not attempt to  
access to any outlets, actions or bindings set up in the nib file -  
They probably haven't been re-established yet, as the nib file is in  
the process of being unarchived. If you need to reference anything  
configured in the nib file, you have to wait for "-awakeFromNib".  
That said, you can use "-initWithCoder:" for stuff that you would  
otherwise do in "-initWithFrame:" or any other initializer, in other  
words: Setting up your instance, without making any assumptions  
about how it's currently hooked up to the outside world.


j o a r


On 13 maj 2009, at 16.59, Luke the Hiesterman wrote:

If you have some initialization that needs to be done from multiple  
init points, it's common to create a method for this, say  
commonSetup. Then in all init paths, you would do [self commonSetup].


Luke

On May 13, 2009, at 4:56 PM, Ramakrishna Vavilala wrote:

I have a custome view class which I use to host some CALayers. As  
I specify
the view in the Nib file, I use awakeFromNib to create the  
CALayers. Part of

me however thinks that initWithFrame might be more suitable for this
initialization as it can be used for views created outside of  
interface

builder (not likely for my project).
Which method is the correct one?




___

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

This email sent to jh...@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: Updating NSTableView

2009-05-14 Thread Todd Freese
If anyone has a tutorial or sample code for this it would be greatly  
appreciated! This issues comes up from time to time and there is not a  
lot sample code out there for it. Most of the posts are conceptual  
rather than examples.


Todd


On May 14, 2009, at 10:14 AM, Corbin Dunn wrote:



On May 14, 2009, at 7:49 AM, I. Savant wrote:


On Thu, May 14, 2009 at 10:41 AM, Scott Ribe > wrote:






First a fast way to read the data off disk to begin with, for  
start up time.


Then caching of row heights when they are calculated. Finally  
binary search


of row heights/positions when mapping coordinates to row indexes.



Of course depending on what calculations are truly necessary, the  
first draw


may still be slow, but there's really no reason a redraw should be  
slow


after changing one (or a few) values.



Informative, thank you.



Yup, Scott's idea sounds like a good plan. Most people get good  
performance out of variable row heights by doing some sort of  
caching or heuristic that quickly determines the row height.


-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/applecocoalist%40filmworkers.com

This email sent to applecocoal...@filmworkers.com

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit 
http://www.messagelabs.com/email__



__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

___

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

2009-05-14 Thread Corbin Dunn
You are welcome to log a bug report requesting a sample. Please detail  
the things you would like to see in it. These are also the types of  
things we could cover at a WWDC event. I will be giving an advanced  
table view talk:


"Presenting User Data with Table Views and Browsers"
http://developer.apple.com/wwdc/sessions/#session=1581

...which I highly recommend attending. My last TableView talk covered  
the "PhotoSearch" sample code and that example answers 80% of the  
tableview questions posted here.


My new talk won't be covering this particular issue with variable row  
heights, but I will be covering Sourabh's original suggestion on how  
to properly update (complex) cells.


corbin


On May 14, 2009, at 9:35 AM, Todd Freese wrote:


If anyone has a tutorial or sample code for this it would be greatly  
appreciated! This issues comes up from time to time and there is not  
a lot sample code out there for it. Most of the posts are conceptual  
rather than examples.


___

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: [Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread malte . philipp

On 14.05.2009, at 16:55, Keary Suska wrote:


On May 14, 2009, at 5:51 AM, malte.phil...@mac.com wrote:


Now here is what has me utterly confused and my actual question:

In his tutorial Scott is setting up an NSObjectController (named  
"ControllerAlias" there) and binds that to the "MyController"  
instance with the explanation:
This little green box is your "bridge" between the code in  
MyController.m and the bindings system.
The two NSArrayControllers afterwards are bound to that  
'ControllerAlias' NSObjectController.


Aaron in his book has me creating an NSArrayController and bind  
that directly to the instance with the array to be controlled.  
Essentially skipping the NSObjectController entirely. When I just  
thought it was my "bridge to the bindings system"?


I would really like to understand the difference in approach  
between these two methods and also if there are any implications  
by using or skipping an NSObjectController in between. Would  
anyone find the time and inclination to explain this to me, please?


Well, these two examples do not solve the same problem, so compare/ 
contrast would not be useful. You need to understand the Model-View- 
Controller (MVC) pattern as it is used in Cocoa. You will find this  
the docs (just search for "cocoa patterns" and I bet you'll find it  
easily). NSController and its subclasses (which include  
NSObjectController and NSArrayController) were designed  to be the  
"C" in this pattern specifically for bindings. Have you read "Cocoa  
Bindings Programming Topics"?


Additional info I would add: the important difference between the  
two examples is that Scott's  uses a tiered approach (common for  
master-detail interfaces, for instance, in their simplest form),  
where one controller provides the content for another controller,  
while Aaron's is the more straightforward single-controller  
approach (although iterate, these aren't approaches to the same  
problem, but approaches to different problems). Note also the  
purpose of NSObjectController vs NSArrayController. As the name  
implies, the former is for binding to a single object, while the  
latter is for binding to an array of objects.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"



Keary,

thank you for your response to my question. I especially found your  
comment on the tiered approach aspect of Scott's example very  
interesting.



To possibly refine my initial question a bit better though:
In Scott's example I can *remove* the NSObjectController and bind the  
NSArrayController (he's binding to that NSObjectController)  
*directly* to the "MyController" instance in IB. And from my testing:  
it's still working exactly the same. So I'm still not sure why the  
NSObjectController is placed "in between" there. What is its purpose?


Allow me the little sketch to illustrate my point:

Scott's tutorial) ControllerInstance <--- NSObjectController <---  
NSArrayController <--- NSArrayController
Alternative) ControllerInstance <--- NSArrayController <---  
NSArrayController


What's that "NSObjectController" in Scott's example for and what is  
it doing that will not happen in the "Alternative" binding approach?


Thanks again!

Philipp


___

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


display optimization / display rectangles

2009-05-14 Thread David Harper
Hello,

I'm working on optimizing a document based application, and I've found that 
overdrawing is a significant contributor to the (tolerable, but non-ideal) 
performance issues I am experiencing.

The reason overdrawing occurs is as follows:

Let's say the user draws a line in the document from point A to point B.  The 
display rect is calculated using the points on this line and inset so that the 
selection highlight of the line is also within the display rect.  
setNeedsDisplayInRect is invoked for this rectangle.

In my document view class' drawRect: method, everything in the document 
overlapping the display rectangle is drawn.  However, my pages are drawn as 
rectangular bezier paths with attached NSShadows, so I draw an entire page if 
it overlaps the display rectangle.  The problem is that even though calling 
[pagePath fill] does not actually cause the document view to actually draw the 
entire contents of the fill (but rather what overlaps the display rectangle, as 
expected), subviews outside the display rectangle that overlap the page 
rectangle are recursively displayed in their entirety.

I find this behavior to be somewhat bizarre, but nonetheless the solution seems 
to be to only draw a white rectangle using the NSIntersectionRect of both 
relevant rectangles.  However, this causes a broken-up shadow appearance.  
Should I abandon the idea of a smooth NSShadow in favor of an additional black 
rectangle with 50% opacity instead?  Is there a better way to draw a smooth 
shadow?

Any advice would be of great help.

Thanks,
- Dave H
___

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


Check box with differwnt backgrouns colours

2009-05-14 Thread Arun
Hi All,

Is it possible to fill up check-box with different background colours? If
yes how can we achieve this?

Thanks
Arun
___

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: NSURLConnection willSendRequest: not behaving as expected on a 302 response - no further response after nil return

2009-05-14 Thread Cédric Luthi
This was indeed a bug and has been fixed in Mac OS X 10.5.7

See http://www.openradar.me/6700222 for the bug report.
___

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: [Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread Quincey Morris

On May 14, 2009, at 04:51, malte.phil...@mac.com wrote:


Now here is what has me utterly confused and my actual question:

In his tutorial Scott is setting up an NSObjectController (named  
"ControllerAlias" there) and binds that to the "MyController"  
instance with the explanation:


This little green box is your "bridge" between the code in  
MyController.m and the bindings system.


The two NSArrayControllers afterwards are bound to that  
'ControllerAlias' NSObjectController.


Aaron in his book has me creating an NSArrayController and bind that  
directly to the instance with the array to be controlled.  
Essentially skipping the NSObjectController entirely. When I just  
thought it was my "bridge to the bindings system"?


Your confusion is justified -- because the statement about a  
NSObjectController being a bridge to the bindings system is pretty  
much false. Whatever Stevenson actually meant isn't clear, since he  
doesn't explain why he sets things up the way he does.


You can use bindings without any NS...Controller objects. For example,  
you can bind a NSButton directly to File's Owner (with some suitable  
model key).


You use NS...Controller objects when they provide functionality you  
need. The prime example is NSArrayController, which provides a lot of  
useful functionality (sorting, filtering, selection maintenance) for a  
NSTableView.


The problem with NSObjectController is that it provides almost no  
functionality. It does respond to commitEditing: by sending  
commitEditing: to all of the editors bound to it, and that can be a  
useful convenience. Other than that, it doesn't do an awful lot.


Note that the picture is a little different if you check the "prepares  
content" option on a NS...Controller. In that case, the NS.Controller  
object is also responsible for creating its content object(s). For  
example, IIRC Apple's NSPersistentDocument tutorial uses this  
technique to create an initial Department object. In that case, the  
NS...Controller has a non-trivial function, mostly as a convenience  
for avoiding writing a line or two of code.



___

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: display optimization / display rectangles

2009-05-14 Thread Quincey Morris

On May 14, 2009, at 10:09, David Harper wrote:

In my document view class' drawRect: method, everything in the  
document overlapping the display rectangle is drawn.  However, my  
pages are drawn as rectangular bezier paths with attached NSShadows,  
so I draw an entire page if it overlaps the display rectangle.  The  
problem is that even though calling [pagePath fill] does not  
actually cause the document view to actually draw the entire  
contents of the fill (but rather what overlaps the display  
rectangle, as expected), subviews outside the display rectangle that  
overlap the page rectangle are recursively displayed in their  
entirety.


Can you expand on this issue a little? If pagePath is a NSBezierPath,  
filling the path shouldn't itself cause anything else to be drawn, so  
your drawing code is not likely to be the cause of the unwanted extra  
drawing.


Assuming you're doing nothing to violate the paradigm that drawing  
occurs only in response to setNeedsDisplay/setNeedsDisplayInRect, then  
the problem is likely that you're somehow invoking setNeedsDisplay...  
on too many things.


You aren't by any chance calling setNeedsDisplay... from within a  
drawRect: method, are you? That would be a Really Bad Thing to do.



___

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: [Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread Keary Suska

On May 14, 2009, at 11:07 AM, malte.phil...@mac.com wrote:


To possibly refine my initial question a bit better though:
In Scott's example I can *remove* the NSObjectController and bind  
the NSArrayController (he's binding to that NSObjectController)  
*directly* to the "MyController" instance in IB. And from my  
testing: it's still working exactly the same. So I'm still not sure  
why the NSObjectController is placed "in between" there. What is its  
purpose?


Allow me the little sketch to illustrate my point:

Scott's tutorial) ControllerInstance <--- NSObjectController <---  
NSArrayController <--- NSArrayController
Alternative) ControllerInstance <--- NSArrayController <---  
NSArrayController


What's that "NSObjectController" in Scott's example for and what is  
it doing that will not happen in the "Alternative" binding approach?


I haven't reviewed both examples in detail, but the most likely answer  
is "no difference at all". You should be able to--adjusting the  
bindings appropriately in each case--remove the NSObjectController  
from the first example and insert one into the second example, without  
any change in behavior. I have seen a number of examples from Apple  
that use NSObjectControllers in this way, so it may a situation of  
convention, but also refer to Quincy's response.


I would add that an otherwise useless NSObjectController is  
particularly useful in cases where the File's Owner maintains the  
model data. Binding to File's Owner may create retain cycles, so in  
these cases I have the owner offload the data-binding to an object  
controller. I also find them useful in Interface Builder as the app  
will maintain a list of keys and auto-suggest keys when specifying  
bindings. I wouldn't recommend using the class for just this purpose,  
but NSObjectController does have its uses.


Best.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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


NSURLConnection sendSynchronousRequest: crashes since upgrading to 10.5.7

2009-05-14 Thread Greg Hoover
After upgrading to 10.5.7 I've been having intermittent trouble with  
deallocated objects in NSURLConnections.  All of my URL requests are  
made using sendSynchronousRequest.  Everything is fine for about 10-15  
minutes, then I get this crash.  I am making requests on multiple  
threads, obviously only one at a time per thread though since they're  
synchronous.


 *** -[CFArray count]: message sent to deallocated instance 0x27eb6950
*** NSInvocation: warning: object 0x27eb6950 of class  
'_NSZombie_CFArray' does not implement methodSignatureForSelector: --  
trouble ahead


#0  0x90718640 in ___forwarding___
#1  0x90718972 in __forwarding_prep_0___
#2  0x90627da1 in CFArrayGetCount
#3  0x906ab581 in _CFStreamSignalEventSynch
#4  0x90699595 in CFRunLoopRunSpecific
#5  0x90699c78 in CFRunLoopRunInMode
#6	0x9468f530 in +[NSURLConnection(NSURLConnectionReallyInternal)  
_resourceLoadLoop:]

#7  0x9462be0d in -[NSThread main]
#8  0x9462b9b4 in __NSThread__main__
#9  0x94365155 in _pthread_start
#10 0x94365012 in thread_start

Any insight would be great,
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


[MEET] BYU CocoaHeads tonight @ 7PM

2009-05-14 Thread Dave DeLong
Hi everyone,

BYU CocoaHeads will be having their monthly meeting tonight at 7pm in W108 TNRB 
(Tanner building) on BYU Campus in Provo, UT.  Matt Stoker, developer of Mobile 
Finder and student at the University of Utah, will be presenting on OpenGL.

Parking is free, and a map to BYU campus can be found on our meeting page:  
http://cocoaheads.byu.edu/meetings/2009/05

See you there!

Dave DeLong
President, BYU CocoaHeads
___

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


NSURLConnection vs. NSThread

2009-05-14 Thread Eric E. Dolecki
Just curious, but if I am loading images into a UIImageView in table cells
from online URLs, is it better to use NSThread or use async NSURLConnection
to ensure that the scrolling is smooth while images are loaded in?

Eric
___

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: [Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread malte . philipp

Thank you Keary and Quincey for your responses.
I feel that my puzzlement has been resolved a great deal! :)

Thank you.

-Philipp
___

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: display optimization / display rectangles

2009-05-14 Thread Alastair Houghton

On 14 May 2009, at 18:09, David Harper wrote:

I'm working on optimizing a document based application, and I've  
found that overdrawing is a significant contributor to the  
(tolerable, but non-ideal) performance issues I am experiencing.


[snip]

It sounds from your description as if the actual problem is not  
overdrawing per se, but the fact that drawing a shadow for a large  
rectangle isn't terribly well optimised in the Quartz code (IMO).


My impression (from doing something similar myself) is that the system  
renders shadows by drawing the same shapes into a separate image, then  
applying some kind of blur filter to the image before rendering it  
behind the actual output.


If you draw a very large object, it unfortunately seems to generate  
and blur a very large image. At least, that's what I assume since  
shadow rendering performance seems to be very dependent on the overall  
size of the thing that you're rendering.


Anyway, if you're trying to draw a page background with a shadow, the  
naïve approach using NSShadow probably isn't the best way, because the  
page is going to be a very large object at typical zoom factors.   
There are a few things you might consider doing instead; e.g.:


-  You might only render the edges of the page using NSShadow, and  
just draw a plain white rectangle for the centre.  You might still  
have performance problems if the width or height of the shadowed  
regions becomes too large.


-  You might use images to render the page edges (essentially the same  
way you would achieve a similar effect in HTML, if you've ever  
tried).  The downside is that you can't zoom the shadow itself (but  
you probably don't need to, in this type of application).


-  Or you could use a hybrid approach; essentially build the images at  
render time if their size is now wrong.  Remember you only need to  
render the corners plus a 1px wide image for the top, a 1px wide image  
at the bottom, and two 1px high images for the left and right.  That  
would let you zoom in on the shadow if you need to do that, but it's  
more complicated than pre-rendered shadow images drawn in e.g.  
Photoshop.


Personally I'd probably use images.

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: NSURLConnection vs. NSThread

2009-05-14 Thread Michael Ash
On Thu, May 14, 2009 at 4:52 PM, Eric E. Dolecki  wrote:
> Just curious, but if I am loading images into a UIImageView in table cells
> from online URLs, is it better to use NSThread or use async NSURLConnection
> to ensure that the scrolling is smooth while images are loaded in?

I'd recommend the async method if it's at all reasonable. Threads are
difficult to write, dangerous to use, and difficult to debug. If you
can avoid them without blocking your app or causing major coding
headaches, then it's generally best to avoid them.

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: NSURLConnection vs. NSThread

2009-05-14 Thread Luke the Hiesterman
I actually think for a simple case like this one, the NSThread  
approach will have simpler, more straightforward code. I say go with  
whichever way makes more sense for your style of coding.


Luke

On May 14, 2009, at 2:56 PM, Michael Ash wrote:

On Thu, May 14, 2009 at 4:52 PM, Eric E. Dolecki  
 wrote:
Just curious, but if I am loading images into a UIImageView in  
table cells
from online URLs, is it better to use NSThread or use async  
NSURLConnection

to ensure that the scrolling is smooth while images are loaded in?


I'd recommend the async method if it's at all reasonable. Threads are
difficult to write, dangerous to use, and difficult to debug. If you
can avoid them without blocking your app or causing major coding
headaches, then it's generally best to avoid them.

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


NSTableView clicked position

2009-05-14 Thread Richard Nichols


Hello all,

I need to get the character position that the mouse was clicked on in  
a NSTableView column.


I have the delegate and datasource set and the entire application  
works fine.


Management now wants to be able to click on specific words and get  
more information.


Getting the cell isn't a problem I just need to find the actual  
character position.


Any ideas???


Thanks,

ran6110



___

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: NSURLConnection vs. NSThread

2009-05-14 Thread Mike Abdullah

Threads would be unnecessary hassle and probably slower performing.

NSURLConnection maintains its own private thread for performing the  
work of all open URL connections, even if you are using the  
synchronous API. By using NSThread, you are just bringing an extra  
unnecessary thread into the mix (possibly more if you're planning 1  
thread per-image) and then have to co-ordinate between it and the main  
thread. The async NSURLConnection API takes care of that for you  
already.


The only possible performance bottleneck that a thread might benefit  
you is turning the downloaded image data into a UIImage. If you find  
that is being slow, then maybe consider a thread-based solution for  
that portion of the work.


Mike.

On 14 May 2009, at 21:52, Eric E. Dolecki wrote:

Just curious, but if I am loading images into a UIImageView in table  
cells
from online URLs, is it better to use NSThread or use async  
NSURLConnection

to ensure that the scrolling is smooth while images are loaded in?

Eric
___

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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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: NSURLConnection vs. NSThread

2009-05-14 Thread Luke the Hiesterman
Why is it assumed that threads created by NSURLConnection are faster  
than threads created manually with NSThread?


Luke

On May 14, 2009, at 3:36 PM, Mike Abdullah wrote:


Threads would be unnecessary hassle and probably slower performing.

NSURLConnection maintains its own private thread for performing the  
work of all open URL connections, even if you are using the  
synchronous API. By using NSThread, you are just bringing an extra  
unnecessary thread into the mix (possibly more if you're planning 1  
thread per-image) and then have to co-ordinate between it and the  
main thread. The async NSURLConnection API takes care of that for  
you already.


The only possible performance bottleneck that a thread might benefit  
you is turning the downloaded image data into a UIImage. If you find  
that is being slow, then maybe consider a thread-based solution for  
that portion of the work.


Mike.

On 14 May 2009, at 21:52, Eric E. Dolecki wrote:

Just curious, but if I am loading images into a UIImageView in  
table cells
from online URLs, is it better to use NSThread or use async  
NSURLConnection

to ensure that the scrolling is smooth while images are loaded in?

Eric
___

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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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/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: NSURLConnection vs. NSThread

2009-05-14 Thread Luke the Hiesterman
To add to that thought, I should add that even if there is a  
performance difference, I'd be surprised if it's anything that anyone  
would notice. It's generally a mistake to assume there's a performance  
problem with a certain approach until you've actually seen the  
performance problem. In cases like this, I would say that what makes  
sense to the programmer, and what makes the most simple code should  
trump what's fastest unless someone can show a tangible gain in one  
way over the other.


Luke

On May 14, 2009, at 3:39 PM, Luke the Hiesterman wrote:

Why is it assumed that threads created by NSURLConnection are faster  
than threads created manually with NSThread?


Luke

On May 14, 2009, at 3:36 PM, Mike Abdullah wrote:


Threads would be unnecessary hassle and probably slower performing.

NSURLConnection maintains its own private thread for performing the  
work of all open URL connections, even if you are using the  
synchronous API. By using NSThread, you are just bringing an extra  
unnecessary thread into the mix (possibly more if you're planning 1  
thread per-image) and then have to co-ordinate between it and the  
main thread. The async NSURLConnection API takes care of that for  
you already.


The only possible performance bottleneck that a thread might  
benefit you is turning the downloaded image data into a UIImage. If  
you find that is being slow, then maybe consider a thread-based  
solution for that portion of the work.


Mike.

On 14 May 2009, at 21:52, Eric E. Dolecki wrote:

Just curious, but if I am loading images into a UIImageView in  
table cells
from online URLs, is it better to use NSThread or use async  
NSURLConnection

to ensure that the scrolling is smooth while images are loaded in?

Eric
___

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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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/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: NSURLConnection vs. NSThread

2009-05-14 Thread Alastair Houghton

On 14 May 2009, at 23:39, Luke the Hiesterman wrote:

Why is it assumed that threads created by NSURLConnection are faster  
than threads created manually with NSThread?


It isn't.

Mike's point is that the chances of someone who is asking whether or  
not to use NSThread on a developer mailing list doing a better job of  
using NSThread than whoever at Apple (or NeXT) wrote NSURLConnection  
are slim.


Moreover, NSURLConnection's implementation (threading model, for  
instance) may change over time to better fit with developments to the  
operating system.  I can imagine some changes that might be coming in  
a future release of OS X, for instance, as I am sure can many others.


Your own NSThread won't benefit from those changes unless you rewrite  
it.


In any event, I would always prefer a pre-existing asynchronous API to  
effectively rolling my own (which is what you'd have to do anyway if  
you were using your own thread).  Even if it isn't going to run any  
faster, it's going to be a damn sight faster to implement than rolling  
your own, and it's likely to have fewer bugs to boot.


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: NSURLConnection vs. NSThread

2009-05-14 Thread Mike Abdullah
I am not saying that the threads created by NSURLConnection are in any  
way faster than those created manually. I am saying that  
NSURLConnection is going to use its own thread internally whatever you  
do, so throwing another thread into the mix is only adding additional  
overhead.


As it happens, NSURLConnection's thread implementation is also likely  
to be more efficient that anyone's custom one because it uses a single  
thread for all connections. After starting your first URL load, the  
overhead of creating a fresh thread never happens again.


Mike.

On 14 May 2009, at 23:42, Luke the Hiesterman wrote:

To add to that thought, I should add that even if there is a  
performance difference, I'd be surprised if it's anything that  
anyone would notice. It's generally a mistake to assume there's a  
performance problem with a certain approach until you've actually  
seen the performance problem. In cases like this, I would say that  
what makes sense to the programmer, and what makes the most simple  
code should trump what's fastest unless someone can show a tangible  
gain in one way over the other.


Luke

On May 14, 2009, at 3:39 PM, Luke the Hiesterman wrote:

Why is it assumed that threads created by NSURLConnection are  
faster than threads created manually with NSThread?


Luke

On May 14, 2009, at 3:36 PM, Mike Abdullah wrote:


Threads would be unnecessary hassle and probably slower performing.

NSURLConnection maintains its own private thread for performing  
the work of all open URL connections, even if you are using the  
synchronous API. By using NSThread, you are just bringing an extra  
unnecessary thread into the mix (possibly more if you're planning  
1 thread per-image) and then have to co-ordinate between it and  
the main thread. The async NSURLConnection API takes care of that  
for you already.


The only possible performance bottleneck that a thread might  
benefit you is turning the downloaded image data into a UIImage.  
If you find that is being slow, then maybe consider a thread-based  
solution for that portion of the work.


Mike.

On 14 May 2009, at 21:52, Eric E. Dolecki wrote:

Just curious, but if I am loading images into a UIImageView in  
table cells
from online URLs, is it better to use NSThread or use async  
NSURLConnection

to ensure that the scrolling is smooth while images are loaded in?

Eric
___

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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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/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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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: NSURLConnection vs. NSThread

2009-05-14 Thread Michael Ash
On Thu, May 14, 2009 at 6:42 PM, Luke the Hiesterman  wrote:
> To add to that thought, I should add that even if there is a performance
> difference, I'd be surprised if it's anything that anyone would notice. It's
> generally a mistake to assume there's a performance problem with a certain
> approach until you've actually seen the performance problem. In cases like
> this, I would say that what makes sense to the programmer, and what makes
> the most simple code should trump what's fastest unless someone can show a
> tangible gain in one way over the other.

Certainly the overhead is highly unlikely to matter for this
situation. It could become significant if you're loading many hundreds
of images simultaneously, and the problem will transition from
"overhead" to "bug" as you pass about 2600 simultaneous loads due to
the inherent per-process thread limit in OS X.

(If you wanted to avoid the problem for such an unreasonable number of
simultaneous loads, NSOperationQueue is probably the way to go.)

I agree completely that the simplest code should win, but I also think
that the thread adds complexity, not just overhead.

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: Interpreting -underlinePosition and -underlineThickness

2009-05-14 Thread Graham Cox


On 15/05/2009, at 1:59 AM, Benjamin Stiglitz wrote:

How should NSFont's -underlinePosition and -underlineThickness  
values be
interpreted? Are they fixed values, indicating an absolute offset,  
or are

they some proportion of the pointSize or something else?


In the optimal case (I’ll explain shortly), the underlinePosition is  
the

number of points below the baseline to position the center of the line
with width underlineThickness.


Ok, that's what I plumped for, and the results are OK for many fonts,  
but not all.



However (and this is a big however), many fonts report an invalid
underline thickness and/or position.


What is "invalid"? A value of 0?

Using the NSFontExplorer sample code, I notice that for example,  
Zapfino reports an offset of -2.25 for the 12 point font, but  
positioning the underline here is not where NSLayoutManager puts it,  
-2.25 being much closer. Some fonts do report 0 for the offset... so  
treating 0 as invalid is not the real story it seems.



In this case, both the Cocoa and
CoreText rendering paths cook up values based on the average of the
metrics of Helvetica and Times, scaled to fit the metrics of the
selected font. (Please do file a bug for API to access these computed
values.)


Will do, though if someone in the know could tell me how to perform a  
similar computation I'd be happy to roll my own for now.



I ask because the results I'm getting by treating it as an absolute
value differ from Apple's rendition, but the docs are  
unenlightening on

this point.


An image with a comparison would go a long way to helping us diagnose
this issue.


Ok, I'll send something to you off-list.

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


Class Singleton Instantiation

2009-05-14 Thread Eric Hermanson
In the CryptoExercise iPhone example, they allocate a shared instance  
like this:


=
static SecKeyWrapper * __sharedKeyWrapper = nil;

+ (SecKeyWrapper *)sharedWrapper {
@synchronized(self) {
if (__sharedKeyWrapper == nil) {
[[self alloc] init];
}
}
return __sharedKeyWrapper;
}

+ (id)allocWithZone:(NSZone *)zone {
@synchronized(self) {
if (__sharedKeyWrapper == nil) {
__sharedKeyWrapper = [super allocWithZone:zone];
return __sharedKeyWrapper;
}
}
return nil;
}

=

Is the above paradigm any better/worse than doing something simpler,  
like the following (which is the paradigm I've been using):



+ (SecKeyWrapper *)sharedWrapper
{
static SecKeyWrapper * __sharedKeyWrapper = nil;

@synchronized(self) {
if (__sharedKeyWrapper == nil) {
   __sharedKeyWrapper = [[self alloc] init];
}
}

return __sharedKeyWrapper;
}


Thank You,
Eric

___

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


NSCFArray autoreleased with no pool in place

2009-05-14 Thread Tron Thomas
I am writing a Cocoa application that links to many frameworks.  For  
some reason when I debug the program the following message appears in  
the debug output:


*** _NSAutoreleaseNoPool(): Object 0x409660 of class NSCFArray  
autoreleased with no pool in place - just leaking


This message is occurring before the main function for the application  
is executed.  Suspicions are that something in one of the frameworks  
that gets loaded is causing the problem.


What can be done to track down where this problem is occurring and fix  
it?


___

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: Class Singleton Instantiation

2009-05-14 Thread Kiel Gillard

On 15/05/2009, at 11:32 AM, Eric Hermanson wrote:

Is the above paradigm any better/worse than doing something simpler,  
like the following (which is the paradigm I've been using)


The sample code prevents other developers from allocating subsequent  
instances.


See  for more information.


Kiel
___

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


Fetch Requests on Non Standard Classes in Core Data

2009-05-14 Thread Ian Peters-Campbell
Hey all,

I'm fairly new to iPhone/Cocoa, and brand new to Core Data.  I'm in the
process of writing a data manager, and I would like it to use Core Data.
Unfortunately my brain is breaking a little bit with a conceptual issue.  I
need an entity which will store some binary data along with a guid (a 16
byte int) for indexing/lookup.  This in itself is a little bit harrowing,
since I don't see any native support for 16 byte ints in Core Data.

To make matters worse though, the guid is wrapped in what is effectively a
container class which includes network serialization functionality, an
isEqual method, etc along with the 16 bytes of guid data.  If possible I
would like to store the wrapper object in Core Data rather than extracting
data from it and then rebuilding it each time I store/retrieve the object.
It seems eminently possible to do the actual storage/retrieval using an
NSValueTransformer with a Transformable attribute, but what is hurting my
brain is the idea of lookups.  How (if at all) can I store these wrapper
objects in such a way that I can do fetch requests based on their internal
values?

That is, if I have an object:

wrapperA:
guidBytes ""

And I have already stored two entities in Core Data with something like

EntityInstanceA:
binaryData: foo
accessDate: bar
guidInstance:
guidBytes: ""


EntityInstanceB:
binaryData: baz
accessDate: quz
guidInstance:
guidBytes: ""

Is it possible for me to do a fetch request using the guidBytes inside
wrapperA to return me EntityInstanceA with its matching guidBytes, which are
stored as a member of a class which is "blobbed" into an entity attribute?

Wow, I hope that all makes sense.

Possible solutions I have now are
- to save the guid bytes as an additional string attribute in the entity and
just key off that (like an id column) but that seems like it's storiing
extra data.
- to not save the wrapper object at all, just the inner byes, and rebuild
the wrapper each time I do a fetch, but that seems less efficient than I
would like and means i can't just return the fetched entity to the requestor
without also returning one of the wrapper objects.

Ideas?  Suggestions?  Rollings of eyes?  Pitchforks and torches?
___

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


Invoice program made in Objective c/Cocoa

2009-05-14 Thread Pedro Castel-Branco

Hi

I am a 4D developer for almost 15 years.
In the beginning of this year I am studding the idea of chancing my  
range of Invoice Programme made in 4D to XCODE/Objective-c 2.0/Cocoa.


One of the reasons is the very expensive cost that 4D has when you  
work in Client/Server Mode.
And the constant need of upgrade 2003 to 2004 to v11 and so one in  
future.
The other is the idea of a new project that merge iPhone and Mac in a  
invoice program.


Its easy and is the interface will be nice.
Can I made a invoice program in cocoa.
Is there any one made a program with this  
framework(Xcode;cocoa;objective-c 2.0)


My invoice program have modules of TPV, Code Bar its a small ERP

Best regards

--
Pedro Castel-Branco
pedr...@infordesenvolvimento.pt

Av.Javea Aldeamento Turistico Palmela Village 31 5
2950-580 Quinta do Anjo
Palmela Portugal

Telef. (+351) 917 263 116

http://www.infordesenvolvimento.pt
--

___

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


LMSetKey[Rep]Thresh

2009-05-14 Thread Christopher Hansen
Hello,

I'm writing a game and I need to set the key and key repeat thresholds in my 
Cocoa application.  The functions needed to do to this under Carbon (Events.h) 
are:

LMGetKeyThresh
LMSetKeyThresh
LMGetKeyRepThresh
LMSetKeyRepThresh

I'm looking for the Cocoa equivalents.

Thank you,
Christopher




___

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 an arraycontroller for different object classes

2009-05-14 Thread Gideon King
Hi, I have a situation where I have an array of objects that I want to  
bind to so I can use them in an inspector, but the objects are of  
different classes, and I want the inspector to only see the objects  
that have the key that I am binding to.


For example, if I have an array of vehicles, and this array contains 4  
car objects and 2 bulldozer objects. Now I want to have in my  
inspector a binding for weight, and one for tyre size.


So for the binding for weight, it is applicable to both classes - they  
both have an instance variable called "weight", so the array would  
contain 6 objects, but for the binding for tyre size, the bulldozers  
don't have tyres, so the array would only have 4 objects in it.


How should I approach this issue? It appears that the filter  
predicates are set on the whole array and would affect everything, and  
I have no way to set them based on the key that is being accesses.


Thanks in advance

Gideon
___

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

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

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

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


Re: Class Singleton Instantiation

2009-05-14 Thread Kiel Gillard
The first sentence of my reply should read "The sample code prevents  
the allocation of subsequent instances".


Sorry for the ambiguity.

Kiel

On 15/05/2009, at 11:46 AM, Kiel Gillard wrote:


On 15/05/2009, at 11:32 AM, Eric Hermanson wrote:

Is the above paradigm any better/worse than doing something  
simpler, like the following (which is the paradigm I've been using)


The sample code prevents other developers from allocating subsequent  
instances.


See  for more information.


Kiel


___

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: NSURLConnection vs. NSThread

2009-05-14 Thread George Warner
On Thu, 14 May 2009 16:52:48 -0400, Eric E. Dolecki"  
 wrote:
Just curious, but if I am loading images into a UIImageView in table  
cells
from online URLs, is it better to use NSThread or use async  
NSURLConnection

to ensure that the scrolling is smooth while images are loaded in?



This probably depends on how long the async callback takes; more than  
about 1/10th of a second and it will start impacting the smoothness of  
the scrolling.


I'd write it async first and if the scrolling isn't smooth I'd move it  
to its own thread.

--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)

___

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: NSCFArray autoreleased with no pool in place

2009-05-14 Thread Clark Cox
On Thu, May 14, 2009 at 6:43 PM, Tron Thomas  wrote:
> I am writing a Cocoa application that links to many frameworks.  For some
> reason when I debug the program the following message appears in the debug
> output:
>
> *** _NSAutoreleaseNoPool(): Object 0x409660 of class NSCFArray autoreleased
> with no pool in place - just leaking
>
> This message is occurring before the main function for the application is
> executed.  Suspicions are that something in one of the frameworks that gets
> loaded is causing the problem.
>
> What can be done to track down where this problem is occurring and fix it?

Set a breakpoint in _NSAutoreleaseNoPool

-- 
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: NSURLConnection vs. NSThread

2009-05-14 Thread Eric E. Dolecki
I'm going to try NSURLConnection first I guess and see how it goes. I'm
loading larger images that get resized down in the table so I'll have the
larger images cached for display in a details view.
Thanks for all of this valuable feedback!
Eric

On Thu, May 14, 2009 at 11:21 PM, George Warner  wrote:

> On Thu, 14 May 2009 16:52:48 -0400, Eric E. Dolecki" 
>  wrote:
>
> Just curious, but if I am loading images into a UIImageView in table cells
> from online URLs, is it better to use NSThread or use async NSURLConnection
> to ensure that the scrolling is smooth while images are loaded in?
>
>
> This probably depends on how long the async callback takes; more than about
> 1/10th of a second and it will start impacting the smoothness of the
> scrolling.
> I'd write it async first and if the scrolling isn't smooth I'd move it to
> its own thread.
>  --
> Enjoy,
> George Warner,
> Schizophrenic Optimization Scientist
> Apple Developer Technical Support (DTS)
>
>


-- 
http://ericd.net
Interactive design and development
___

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: [Newbie] Binding an NSArrayController with/without NSObjectController

2009-05-14 Thread Ken Thomases

On May 14, 2009, at 6:51 AM, malte.phil...@mac.com wrote:

I would really like to understand the difference in approach between  
these two methods and also if there are any implications by using or  
skipping an NSObjectController in between. Would anyone find the  
time and inclination to explain this to me, please?


In addition to what others have written, there's a section in the  
documentation that addresses this question directly.


See "Why Are NSControllers Useful?":
http://devworld.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/WhatAreBindings.html#/ 
/apple_ref/doc/uid/20002372-177085


So, it is always a question: should I use a controller to manage a  
relationship to a model object?  The issues discussed in that section  
help you make that judgment.  Since it is a judgment call, there's not  
really a right answer or a single, specific reason why one developer  
does it one way and another a different way.


Cheers,
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: Class Singleton Instantiation

2009-05-14 Thread Eric Hermanson
Thank You.  Good explanation.  The example/doc makes sense and seems  
to be the safest route, although possibly overkill for private code  
that is not going to be distributed to other developers.


- Eric



On May 14, 2009, at 9:46 PM, Kiel Gillard wrote:


On 15/05/2009, at 11:32 AM, Eric Hermanson wrote:

Is the above paradigm any better/worse than doing something  
simpler, like the following (which is the paradigm I've been using)


The sample code prevents other developers from allocating subsequent  
instances.


See  for more information.


Kiel


___

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: Using an arraycontroller for different object classes

2009-05-14 Thread Ken Thomases

On May 14, 2009, at 7:07 PM, Gideon King wrote:

Hi, I have a situation where I have an array of objects that I want  
to bind to so I can use them in an inspector, but the objects are of  
different classes, and I want the inspector to only see the objects  
that have the key that I am binding to.


For example, if I have an array of vehicles, and this array contains  
4 car objects and 2 bulldozer objects. Now I want to have in my  
inspector a binding for weight, and one for tyre size.


So for the binding for weight, it is applicable to both classes -  
they both have an instance variable called "weight", so the array  
would contain 6 objects, but for the binding for tyre size, the  
bulldozers don't have tyres, so the array would only have 4 objects  
in it.


How should I approach this issue? It appears that the filter  
predicates are set on the whole array and would affect everything,  
and I have no way to set them based on the key that is being accesses.


Filter predicates are set on array controllers, not arrays.

Something is controlling what key the inspector is using.  Whenever  
that decision is made, you can change the filter predicate.  You can  
do that programmatically with -setFilterPredicate:.  You could also  
bind the array controller's filter predicate binding to a property of  
a coordinating controller, and change that property.


If you have multiple views which are displaying the array, and you  
want most to continue showing all of the elements with only the  
inspector showing a subset, then you will need multiple array  
controllers -- one which is presenting the whole list and another  
which is presenting the filtered subset.


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: NSCFArray autoreleased with no pool in place

2009-05-14 Thread Tron Thomas

Clark Cox wrote:

On Thu, May 14, 2009 at 6:43 PM, Tron Thomas  wrote:
  

I am writing a Cocoa application that links to many frameworks.  For some
reason when I debug the program the following message appears in the debug
output:

*** _NSAutoreleaseNoPool(): Object 0x409660 of class NSCFArray autoreleased
with no pool in place - just leaking

This message is occurring before the main function for the application is
executed.  Suspicions are that something in one of the frameworks that gets
loaded is causing the problem.

What can be done to track down where this problem is occurring and fix it?



Set a breakpoint in _NSAutoreleaseNoPool

  
That did the trick.  The stack trace allowed me to track down the cause 
of the error.  Because Objective-C++ does not have a concept of class 
static variables I had an NSArray defined in an anonymous namespace in 
the implementation module that was initializing its contents.  I changed 
the code so the array is initially set to nil in the anonymous 
namespace, and then assign it to an NSArray instance the init method of 
the class using the array if the array had not been initialize.


Thanks for the help.

___

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: Check box with differwnt backgrouns colours

2009-05-14 Thread Graham Cox


On 15/05/2009, at 3:15 AM, Arun wrote:


Hi All,

Is it possible to fill up check-box with different background  
colours? If

yes how can we achieve this?



You have to make your own, or use the code here:

http://mattgemmell.com/source

(scroll down to iTableView, which includes coloured checkboxes)

--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: display optimization / display rectangles

2009-05-14 Thread Graham Cox


On 15/05/2009, at 3:09 AM, David Harper wrote:

I find this behavior to be somewhat bizarre, but nonetheless the  
solution seems to be to only draw a white rectangle using the  
NSIntersectionRect of both relevant rectangles.  However, this  
causes a broken-up shadow appearance.  Should I abandon the idea of  
a smooth NSShadow in favor of an additional black rectangle with 50%  
opacity instead?  Is there a better way to draw a smooth shadow?



One problem is that currently, ANY shadow drawing will drag your  
drawing performance into the mud. That's especially true on lower end  
machines like the MacBook.


NSShadow (and the underlying CFShadow code) uses Gaussian blurring  
which is very nice and smooth but can be very processor intensive,  
especially if the blur radius or the object being shadowed is large.


You might need to cache the shadow in an image or just use a simple  
solid "shadow" as you suggested.


--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: display optimization / display rectangles

2009-05-14 Thread Graham Cox


On 15/05/2009, at 3:24 PM, Graham Cox wrote:


NSShadow (and the underlying CFShadow code)


By which I meant CGContextSetShadow - you knew that... ;-)

--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: Check box with differwnt backgrouns colours

2009-05-14 Thread Arun
Hi,

I had a look at the code ... with the method suggested, user may not be able
to click on the chec-box itself.

Thanks
Arun

On Fri, May 15, 2009 at 10:48 AM, Graham Cox  wrote:

>
> On 15/05/2009, at 3:15 AM, Arun wrote:
>
>  Hi All,
>>
>> Is it possible to fill up check-box with different background colours? If
>> yes how can we achieve this?
>>
>
>
> You have to make your own, or use the code here:
>
> http://mattgemmell.com/source
>
> (scroll down to iTableView, which includes coloured checkboxes)
>
> --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: Check box with differwnt backgrouns colours

2009-05-14 Thread Graham Cox


On 15/05/2009, at 3:37 PM, Arun wrote:


Hi,

I had a look at the code ... with the method suggested, user may not  
be able to click on the chec-box itself.



I haven't gone into it in great detail, but it appears to support  
checked and unchecked states, but currently in the test app the table  
datasource doesn't flip the state, but always returns YES. I'd suggest  
you experiment with it, as it looks like it can be made to work.


But even if, you could use the same basic technique to implement a  
custom checkbox cell of your own and make it do whatever you want.


I think Matt Gemmel reads this list so he may be able to give you more  
help.


--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: Check box with differwnt backgrouns colours

2009-05-14 Thread Kyle Sluder
On Fri, May 15, 2009 at 1:37 AM, Arun  wrote:
> I had a look at the code ... with the method suggested, user may not be able
> to click on the chec-box itself.

I doubt that Matt Gemmell would fail implement such fundamental behavior.

You seem to be asking for someone to hand you source code.  Even
though Graham has already done so, the appropriate course of action at
this point seems to be learning how to implement a custom control
yourself.

--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: Fetch Requests on Non Standard Classes in Core Data

2009-05-14 Thread Quincey Morris

On May 13, 2009, at 20:41, Ian Peters-Campbell wrote:

I'm fairly new to iPhone/Cocoa, and brand new to Core Data.  I'm in  
the
process of writing a data manager, and I would like it to use Core  
Data.
Unfortunately my brain is breaking a little bit with a conceptual  
issue.  I
need an entity which will store some binary data along with a guid  
(a 16
byte int) for indexing/lookup.  This in itself is a little bit  
harrowing,

since I don't see any native support for 16 byte ints in Core Data.

To make matters worse though, the guid is wrapped in what is  
effectively a

container class which includes network serialization functionality, an
isEqual method, etc along with the 16 bytes of guid data.  If  
possible I
would like to store the wrapper object in Core Data rather than  
extracting
data from it and then rebuilding it each time I store/retrieve the  
object.
It seems eminently possible to do the actual storage/retrieval using  
an
NSValueTransformer with a Transformable attribute, but what is  
hurting my
brain is the idea of lookups.  How (if at all) can I store these  
wrapper
objects in such a way that I can do fetch requests based on their  
internal

values?

That is, if I have an object:

wrapperA:
   guidBytes ""

And I have already stored two entities in Core Data with something  
like


EntityInstanceA:
   binaryData: foo
   accessDate: bar
   guidInstance:
   guidBytes: ""


EntityInstanceB:
   binaryData: baz
   accessDate: quz
   guidInstance:
   guidBytes: ""

Is it possible for me to do a fetch request using the guidBytes inside
wrapperA to return me EntityInstanceA with its matching guidBytes,  
which are
stored as a member of a class which is "blobbed" into an entity  
attribute?


I think you have several viable options here, although the answer will  
depend on the total number of objects involved. If it's not too large,  
then even the solution of duplicating the stored data isn't terrible.


Another option is to store the guid as a string in the persistent  
store (and use that for your fetches), but to implement the 16-byte  
guid data as a transient NSData attribute that's calculated from the  
string when you insert or fetch an object. (No value transformer is  
required if you keep the bytes in a 16-bye NSData object.) That way  
you wouldn't waste as much space in the persistent store.


Or, since you appear (from your description) to be using these guid  
values as an ad-hoc implementation of relationships between objects,  
you could create actual Core Data relationships instead. For example,  
instead of your wrapperA object having a guidBytes attribute, it could  
have a 1-1 EntityInstance relationship, which is an actual reference  
to the EntityInstanceA object.


Remember, Core Data is an *object graph* mechanism with a persistent  
store (which happens to look a lot like a database). So, it's easiest  
to use Core Data if you model your object relationships as Core Data  
relationships.


Is that any help?


___

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


Retrieving Multiple Anchor Tags.

2009-05-14 Thread Philip Juel Borges

Hi,

The code below retrieves an anchor tag name '25' from the '1.html'  
document when I type '25' in my NSTextField, and loads it in WebView.
But the '1.html' document contains many numerical anchor tags. Does  
anybody know how I can retrieve any anchor tag I type in NSTextField  
and load it in WebView?


- (void)gotoAnchor:(NSString *)name {

	NSString*path = [[NSBundle mainBundle] pathForResource:@"1"  
ofType:@"html"];

NSURL   *baseURL = [NSURL fileURLWithPath:path];
	NSURL   *url = [NSURL URLWithString:[NSString  
stringWithFormat:@"%...@#%@",[baseURL absoluteString], name]];



NSURLRequest*req = [NSURLRequest requestWithURL:url];

[[webView mainFrame] loadRequest:req];
}

- (IBAction)gotoAnchorTag25:(id)sender
{
[self gotoAnchor:@"25"];

}

/Philip

___

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: Retrieving Multiple Anchor Tags.

2009-05-14 Thread Kyle Sluder
On Thu, May 14, 2009 at 10:50 AM, Philip Juel Borges
 wrote:
> The code below retrieves an anchor tag name '25' from the '1.html' document
> when I type '25' in my NSTextField, and loads it in WebView.
> But the '1.html' document contains many numerical anchor tags. Does anybody
> know how I can retrieve any anchor tag I type in NSTextField and load it in
> WebView?

To make sure I'm understanding this correctly... it seems like you're
implying that you do a lookup based on what has been typed into a text
field and then call one of a number of action methods, named
gotoAnchorTag1:, gotoAnchorTag2:, etc. all the way through 25?

Why not just use an NSNumberFormatter and feed the text field's value
straight to your -gotoAnchor: code?

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