Re: Need help debugging this

2011-07-17 Thread Kiel Gillard
Reference to documentation: 
http://developer.apple.com/library/mac/#recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html%23//apple_ref/doc/uid/TP40010433-CH1-SW1

Kiel

On 18/07/2011, at 10:34 AM, Andre Masse wrote:

> Hi,
> 
> I'm having problems tracking down this bug:
> 
> -[NSCFString string]: unrecognized selector sent to instance 0x7fff71192b70
> 
> Is there a way to know which instance is referred at that address? I tried 
> "info symbol *0x7fff71192b70" in gdb and all i get is a blank line. The 
> address is consistent across runs and even after a machine reboot.
> 
> Any infos, pointer to doc etc. would be appreciated,
> 
> Thanks,
> 
> Andre Masse
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: Need help debugging this

2011-07-17 Thread Kiel Gillard
Hi Andre,

To help you debug this problem, I suggest you set a breakpoint on the 
objc_exception_throw exception symbol. Using Xcode 4, this can be done by:

1) From the main menu bar choose View > Navigators > Breakpoint.
2) At the very bottom left of the project window, click the "+" button.
3) From the popup menu, choose "Add Exception Breakpoint...".

Now that you have set your breakpoint on objc_exception_throw, build and run 
your debugging product and perform the steps to reproduce the problem. I would 
expect the debugger to break when the offending message is sent.

Kiel
PS: Instructions for Xcode 3 
.

On 18/07/2011, at 10:34 AM, Andre Masse wrote:

> Hi,
> 
> I'm having problems tracking down this bug:
> 
> -[NSCFString string]: unrecognized selector sent to instance 0x7fff71192b70
> 
> Is there a way to know which instance is referred at that address? I tried 
> "info symbol *0x7fff71192b70" in gdb and all i get is a blank line. The 
> address is consistent across runs and even after a machine reboot.
> 
> Any infos, pointer to doc etc. would be appreciated,
> 
> Thanks,
> 
> Andre Masse
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: Add a view (xib) to a project

2011-01-30 Thread Kiel Gillard
1) Click once the Xcode icon in your Dock to ensure Xcode is the frontmost 
application.
2) From the menu bar, choose File > "New...". You will be presented with a 
window titled "New File".
3) Locate the column on the left hand side of the window which just opened and 
the section of the column labelled "iOS".
4) Click the words "User Interface" underneath the "iOS" section.
5) To the right, choose what type of new xib file you would like to add to your 
project by clicking the appropriate icon.
6) Directly underneath the table of new xib file types, ensure the popup menu 
labelled "Product" reads "iPhone".
7) Click the button labelled "Next" at the bottom right of the window.
8) Once you have named the file it will appear in the "Groups & Files" section 
on the left hand side of your project window.

Hope this helps,

Kiel

On 31/01/2011, at 8:59 AM, Max Stottrop wrote:

> Hey everyone,
> first of all i'd like to thank all of you for this awesome list/community. I 
> hope that i can help you sometimes...
> But now to my question. Can anyone of you explain me (slowly;)) how to add 
> another view (.xib) file to my iPhone project?  I tried several things, but 
> none worked for me. Thanks in advance.
> 
> Max
> Cologne, GER___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: OS X Desktop

2010-12-06 Thread Kiel Gillard
I'm not sure if this will help, but check out the NDAlias source here, 
specifically the - (void)finderLocation method on line 187.

https://github.com/nathanday/ndalias/blob/master/Classes/NSString%2BNDCarbonUtilities.m

Kiel

On 07/12/2010, at 10:11 AM, Charlie Dickman wrote:

> In the days of System 9 there was a thing known as the desktop database and a 
> number of applications/utilities that "remembered" the location of things on 
> the desktop and would restore a saved configuration on command.
> 
> For some time now I have been trying to find a similar OS X implementation 
> that actually works. All of the ones I have tried mess up when trying to 
> restore a saved desktop state; some put icons on top of other icons and some 
> place the icons off the screen.
> 
> I've tried searching the web for a description of where OS X keeps desktop 
> icon placement information, how to read it and how to save it with no luck.
> 
> I was wondering if anyone on this list could help me in my quest.
> 
> Charlie Dickman
> 3tothe...@comcast.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/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: What is Mac's "custom" for an agent to display its GUI?

2010-11-16 Thread Kiel Gillard
http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/PreferencePanes/PreferencePanes.html

On 17/11/2010, at 12:27 PM, eveningnick eveningnick wrote:

> Hello!
> I have to write an application, that should run on the background.
> When the user needs, it should display some control panel. On Windows
> system i would have used System tray, and an icon there - when the
> user clicks on that icon, it displays some GUI. but what is the Mac's
> usual practice? I am thinking that the analog to that tray application
> is an agent, launched by launchd. On what event it is considered to be
> good to trigger that "control panel"?
> All i could think of - is installing a global event tap (but i need
> accessibility Enabled then all the time - it is neither a good idea)
> and watch some Shortcut pressed on a keyboard.
> Another idea was to create an item in "System preferences" (but, could
> it be done? And how?).
> 
> And where should I install that application? Installing in
> /Applications doesn't seem to be nice, because it's not really a
> full-gui applicatlion, It's rather some kind of background system
> helper.
> 
> Thanks for the hints,
> George
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: Programmatically adjusting NSValueTransformer of a bound NSTextField

2010-10-26 Thread Kiel Gillard
Hey guys,

Please ignore my post. It's been a long day and I had one very bad return value 
in one of my value transformers. It always helps to take a break and return to 
the problem with a fresh perspective!

Kiel

On 27/10/2010, at 3:45 PM, Kiel Gillard wrote:

> Hi all,
> 
> Can you please look at this very small and rough reproduction of my problem 
> <http://dl.dropbox.com/u/1064994/cocoadev%20bindings.zip>.
> 
> I want to present measured values of my model with respect to the user's 
> locale. For example, I want to present a distance in imperial units of 
> measurement instead of metric. I am using NSValueTransformer subclasses to 
> transform the units of my model into imperial or metric units.
> 
> When I receive a notification indicating the user's measurement locale 
> changes in System Preferences, my code unbinds and re-binds the value binding 
> of a text field to an instance variable of the controller. I provide the 
> appropriate value transformer in the options of the binding.
> 
> I was wondering if you could please help me with my problem. My NSTextField 
> object is not editable when the change in system locale causes the text field 
> to use a value transformer different from the initial. Specifically, the 
> binding is configured in Interface Builder to use the metric value 
> transformer but when I use System Preferences to adjust my locale preferences 
> to use an imperial (U.S.) system, my text field becomes unchangeable. 
> Adjusting the locale preferences to use a metric system re-enables my text 
> field for editing.
> 
> Any thoughts, comments or suggestions would be extremely helpful and 
> appreciated!
> 
> Kiel



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Programmatically adjusting NSValueTransformer of a bound NSTextField

2010-10-26 Thread Kiel Gillard
Hi all,

Can you please look at this very small and rough reproduction of my problem 
.

I want to present measured values of my model with respect to the user's 
locale. For example, I want to present a distance in imperial units of 
measurement instead of metric. I am using NSValueTransformer subclasses to 
transform the units of my model into imperial or metric units.

When I receive a notification indicating the user's measurement locale changes 
in System Preferences, my code unbinds and re-binds the value binding of a text 
field to an instance variable of the controller. I provide the appropriate 
value transformer in the options of the binding.

I was wondering if you could please help me with my problem. My NSTextField 
object is not editable when the change in system locale causes the text field 
to use a value transformer different from the initial. Specifically, the 
binding is configured in Interface Builder to use the metric value transformer 
but when I use System Preferences to adjust my locale preferences to use an 
imperial (U.S.) system, my text field becomes unchangeable. Adjusting the 
locale preferences to use a metric system re-enables my text field for editing.

Any thoughts, comments or suggestions would be extremely helpful and 
appreciated!

Kiel

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Kiel Gillard
http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSScanner_Class/Reference/Reference.html#//apple_ref/occ/instm/NSScanner/scanCharactersFromSet:intoString:

You pass by reference to the - [NSScanner scanCharactersFromSet:intoString:] 
method an uninitialised pointer to a NSString object.

Consider the return value of the - [NSScanner 
scanCharactersFromSet:intoString:] method. If the method fails to scan the 
given characters and returns NO, your theScannedString pointer is probably 
still invalid.

Kiel

On 16/10/2010, at 5:44 AM, Chris Tracewell wrote:

> NOTE :: GC Enabled
> 
> I am using an NSScanner in an NSString category but am crashing whenever I 
> try to log the string I scanned into or to return it. If I comment out the 
> NSLog there are no problems.
> 
> NSString *theScannedString;
> NSScanner *theScanner = [NSScanner scannerWithString:theNewHTML];
> NSCharacterSet *theCharacterSet = [NSCharacterSet 
> characterSetWithCharactersInString:@"1234567890abcdefghijklmnopqrstuvwxyz...@#$%^&*()-_=+<>?,./:\";'[]\{}|
>  "];
> [theScanner scanCharactersFromSet:theCharacterSet 
> intoString:&theScannedString];
>   
> NSLog(@"%@",theScannedString);
> 
> Does anyone have a hint as to what may be the issue?
> 
> Thanks
> 
> --chris___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: Set the Cursor Position

2010-08-19 Thread Kiel Gillard
http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/c/func/CGDisplayMoveCursorToPoint

On 20/08/2010, at 10:30 AM, k...@highrolls.net wrote:

> I haven't seen anything in the docs ... is there a way to set the cursor 
> position?
> 
> -koko
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Popup button cells in a table view

2010-07-27 Thread Kiel Gillard
Hi all,

I have a table view with a column whose data cell is a NSPopupButtonCell. I am 
using one array controller to provide the table view rows and a seperate array 
controller to provide the popup button menu items.

My table column (as opposed to the cell) has its content bound to the arranged 
objects of the popup button array controller. The content values are bound to a 
"name" property of the arranged objects of the popup button array controller. 
The selected object of the table column is bound to the appropriate property of 
the table view array controller's arranged objects. I am using the null 
placeholder option in the content and content value bindings.

This is the same configuration as you'd expect to find in mmalc's ToDos 
bindings example code. The only difference is I am using the null placeholder 
option.

My problem is this. When I run my app, the popup button menus contain the 
descriptions of the arranged objects in the popup array controller instead of 
respecting the content value binding I have specified.

I am certain my model is key-value coding compliant for the content value 
binding's key path. I am also certain that I am not binding to the cell (as 
opposed to the table column). From what I can infer, it seems that using the 
null placeholder option is not the source of the problem.

Does anyone have any ideas what I am doing wrong? Why would the content value 
binding of the table column be ignored?

Thanks for your ideas and suggestions,

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: My Custom Framework Is Not Exporting One of My Header Files

2010-06-08 Thread Kiel Gillard
Have you set the scope of the necessary header files to public?

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/100-Targets/bs_targets.html

On 09/06/2010, at 11:20 AM, Chris Tracewell wrote:

> I just made my first private framework a few weeks ago. I took some common 
> categories and custom classes I use across projects and put them in my new 
> FW. All has been fine until today when I added a new class file to it. I 
> clean and build the FW and then build my project that is utilizing the FW and 
> I get an error saying there is "No such file or directory" - referring to my 
> new class file in the FW. FWIW, I use #import  in 
> my project as it imports all the FW headers - standard protocol.
> 
> After I build the FW I look in "MyFramework -> build -> Release -> 
> MyFramework.framework -> Headers" and can see the header is indeed missing. I 
> know this is the correct directory because I can see MyFramework.framework 
> being deleted when I clean the FW target.
> 
> Why would it not be exporting the file? Yes, I added it to the target when I 
> created the file.
> 
> Thanks for the help
> 
> 
> -Chris
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: new to cocoa

2010-05-13 Thread Kiel Gillard

On 14/05/2010, at 3:15 PM, Ken Thomases wrote:

> On May 13, 2010, at 11:38 PM, Kiel Gillard wrote:
> 
>> This most certainly is happening because you cannot use UIButton objects as 
>> keys in a dictionary because NSDictionary copies the objects used as keys. 
>> Furthermore, UIButton does implement the NSCopying methods.
> 
> I assume you meant "does _not_ implement".

Yes, my apologies. This was an accidental omission. UIButton does NOT implement 
the NSCopying methods.

Thanks, Ken!

> 
> 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: new to cocoa

2010-05-13 Thread Kiel Gillard
On 12/05/2010, at 6:36 AM, Alejandro Marcos Aragón wrote:

> Hi all,
> 
> I'm new to Cocoa, and I couldn't find information about an error that I'm 
> getting on the web. I'm trying to create an NSMutableDictionary where the 
> keys are of type UIButton*:
> 
> 
>   // create button for unit
>   UIButton* unitButton = [[UIButton alloc] init];
>   [sourceButtonMap setObject:[NSString 
> stringWithString:@"no"] forKey:unitButton];
> 
> Of course, the sourceButtonMap is defined in the class and initialized in the 
> init function as sourceButtonMap = [[NSMutableDictionary alloc] init];
> 
> The error I get when I try to add the key-value pair is:
> 
> *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
> reason: '*** -[UIButton copyWithZone:]: unrecognized selector sent to 
> instance 0x3931e90'
> 
> Is this happening because I can't store UIButton* as keys?

Welcome to iPhone OS development!

This most certainly is happening because you cannot use UIButton objects as 
keys in a dictionary because NSDictionary copies the objects used as keys. 
Furthermore, UIButton does implement the NSCopying methods.

> Can anyone point me why I'm getting this error? Thank you all,



See the second paragraph of the section titled "Overview".

I suggest you revise your design. I don't know exactly what you're trying to 
do. Perhaps @"no" should be the key for the UIButton?

Kiel


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

___

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

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

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

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


Change management using CFRunLoopObserver

2010-04-28 Thread Kiel Gillard
Hi there,

My application's model is observing a particular stage of the run loop. When 
this stage occurs, pending changes to my model are applied.

Which stage of the run loop is best to do this? I cannot seem to find a 
recommendation in the documentation.

Thanks in advance for your time,

Kiel

References:
[1] 
file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/doc/uid/20001442-CH3g-C017571

[2] 
http://developer.apple.com/mac/library/documentation/corefoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/doc/uid/20001442-CH3g-C017571

___

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: Wondering about that iPad page curling

2010-04-06 Thread Kiel Gillard
Can UIViewAnimationTransitionCurlUp/Down be of any use?

On 07/04/2010, at 2:10 AM, Alex Kac wrote:

> Well they may have done it with a private API for CoreImage if that exists 
> (not sure). THey may have done it with OpenGL. They may have taken their 
> CoreImage code on desktop and ported a part of it to iBooks and used that. 
> 
> For you, most likely the best way to do it is using OpenGL.
> 
> On Apr 6, 2010, at 10:56 AM, Laurent Daudelin wrote:
> 
>> So, no other response from the regular crowd of "resident experts" on how 
>> Apple engineers did this?
>> 
>> -Laurent.
>> -- 
>> Laurent Daudelin
>> AIM/iChat/Skype:LaurentDaudelin  
>> http://nemesys.dyndns.org
>> Logiciels Nemesys Software   
>> laurent.daude...@gmail.com
>> Photo Gallery Store: 
>> http://laurentdaudelin.shutterbugstorefront.com/g/galleries
>> 
>> On Apr 5, 2010, at 18:32, Alex Kac wrote:
>> 
>>> Except CIFilter doesn't exist on the iPad in a public SDK setting.
>>> 
>>> On Apr 5, 2010, at 8:22 PM, Laurent Daudelin wrote:
>>> 
 On Apr 5, 2010, at 18:02, Graham Cox wrote:
 
> CIFilter has a page curl transition effect. Just map the 't' value to the 
> mouse/finger location.
> 
> --Graham
> 
> 
> On 06/04/2010, at 10:55 AM, Laurent Daudelin wrote:
> 
>> I got my hands on an iPad today. I was really impressed with the 
>> built-in book reader. When you flip the page while holding your finger 
>> down, the page will curl and follow your finger. Very impressive! 
>> Anybody has any idea how one would be able to achieve such effect?
> 
 
 It's that easy?
 
 -Laurent.
>>> 
>> 
>> ___
>> 
>> 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/alex%40webis.net
>> 
>> This email sent to a...@webis.net
> 
> Alex Kac - President and Founder
> Web Information Solutions, Inc.
> 
> "The optimist proclaims that we live in the best of all possible worlds; and 
> the pessimist fears this is true."
> -- James Clabell
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: CGPoint and KVO

2010-04-03 Thread Kiel Gillard
On 04/04/2010, at 1:40 AM, Roland King wrote:

> I have a property which is a CGPoint and I'm observing it. I didn't really 
> know what to expect in the change dictionary (I have NSKeyValueObservingOld 
> as the observation flags) so I stuck in a breakpoint and went looking. After 
> messing about in the debugger when the property was changed I found the old 
> value was an NSConcreteValue and the following code appears to work to 
> extract the CGPoint from it
> 
>   CGPoint oldPoint; 
>   id oldValue = [ change valueForKey:NSKeyValueChangeOld ]; 
>   [ (NSValue*)oldValue getValue:&oldPoint ]
> 
> Is this correct? I've failed to find anything much in the KVO documentation 
> about CGPoint or how I should expect to receive structs or other primitives.

In the case of NSPoint/CGPoint:

CGPoint oldPoint = [oldValue pointValue];

> This is iPhone OS (incase that makes a difference). 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: using xcode ,how to compile .c file as .m file?

2010-03-30 Thread Kiel Gillard
On 30/03/2010, at 8:32 PM, simon Scylla wrote:

> i need to port some code to iphone and now i find that i can not call system
> interface of objc. i can rename my files from 888.c  to ***.m and it works.
> but i do not wanna rename my files.
> what should i do?i think there must be some choice in xcode.but i don't
> konw..[?]

Wrap your C functions in Objective-C methods.

For example:

SomeController.m

#import "libwhatever.h"

@implementation SomeController

+ (void)initializeLibrary
{
InititaliseCLibrary();
}

- (BOOL)writeToURL:(NSURL *)url
{
char path[255];
//convert URL to C string using NSURL/CFURL API here

//call C library
int result = WriteFileToPath(...);

//return a value
return (result == 0 ? YES : NO);
}

and so on. This is the exact same way parts of Carbon and CoreFoundation is 
used in an Objective-C based application.

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

___

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

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

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

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


Re: cocoa API to get List of hard disk Partitions

2010-02-18 Thread Kiel Gillard
On 18/02/2010, at 8:44 PM, Arjun SM wrote:

> Hi,
> 
>   Can any one help me out on How I can get the List of all hard disk
> partions mounted on the the System along with the Icon, just like Disk
> Utility application does. (Image below.)
> 
> 
> [image:
> ?ui=2&view=att&th=126df98c109f6b52&attid=0.1&disp=attd&realattid=ii_126df98c109f6b52&zw]
> 
> 
> I have used the  NSWorkspace : iconForFile:path,  by passing the "/" for the
> Path and  this would return an image of the boot partions only.
> 

See this sample code from Apple 


HTH,

Kiel

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

___

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

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

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

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


Spotlight while running windows modal

2010-02-17 Thread Kiel Gillard
Hi all,

I'm trying to cancel a modal NSAlert when Spotlight determines a file exists in 
the file system. I create and start the NSMetadataQuery before I run the alert 
modal. However I do not receive notifications of changes to my metadata query 
while my application is running modal.

The docs indicate NSMetadataQuery and MDQuery operate on particular modes of an 
application's run loop however I am required to run the NSAlert modal.

I used an NSAlert with a modal session but that produced strange results. These 
results did not include the observer receiving the appropriate notifications 
for changes to my metadata query.

Is there some way I can have the best of both worlds?

Thanks in advance,

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: What is the equivalent of SetSystemUIMode() in Leopard and above?

2010-01-26 Thread Kiel Gillard
On 27/01/2010, at 3:03 PM, Arun wrote:

> I wanted to use SetSystemUIMode() to hide the dock item and menu of my
> application. Do you know how can we achieve using the same?

Please see the LSBackgroundOnly Info.plist key:


Kiel

> On Wed, Jan 27, 2010 at 2:04 AM, Sean McBride wrote:
> 
>> On 1/25/10 5:17 PM, Arun said:
>> 
>>> Are there any cocoa equivalent API's for SetSystemUIMode() available in
>>> Leopard 10.5 and above?
>>> I want to hide dock and menu item at run time in my application.
>> 
>> SetSystemUIMode works well for me in 10.5 and above.  Is it causing
>> problems for you?
>> 
>> --
>> 
>> 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/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: Commit Editing Changes as I Type

2010-01-06 Thread Kiel Gillard
Are you using bindings for your user interface?

If you are using bindings, each binding has an option which reads something 
like "Continuously updates value". Enable this option for the text field's 
value binding. This will give you the desired effect.

Kiel
"The best way to cheer yourself up is to try to cheer somebody else up."
Mark Twain


On 06/01/2010, at 9:50 AM, cocoa-dev wrote:

> I have two controls (NSTextField and a NSTableView column) that are bound to 
> the same attribute in core data. I've set up a timer that starts after the 
> NSTextField starts editing and I'd like it to periodically commit the editing 
> as the user is typing. If the user hits the Enter key I do see the text in 
> both places but I want those updates to go as the user is typing so the text 
> will show in both fields as the typing is happening.
> 
> When my timer launches I tried calling:
> 
> [myTextField commitEditing] // but this didn't work, nothing happened.
> 
> I then tried:
> 
> [[myTextField window] endEditingFor:nil] // which worked but the NSTextField 
> loses focus so that's not a good solution.
> 
> Any ideas?___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: App works when launched from Xcode, not from Finder

2009-12-15 Thread Kiel Gillard
In Xcode, are you running the target's executable with any command line 
arguments?

Kiel

On 16/12/2009, at 11:34 AM, PCWiz wrote:

> I'm having a *really* strange issue here. First of all, my app works fine in 
> Debug mode. I can launch it from Xcode or from Finder and it will work fine.
> 
> The problem comes when using "Release". If I pick the Release config and then 
> click the Build button from Xcode, the app still works fine. _However_ when 
> launching the app from Finder (in the build/Release directory) the app just 
> completely throws up all over itself. Authentication errors, request timed 
> out (I'm contacting a web API), just about everything that could go wrong 
> does go wrong.
> 
> I don't know why this is happening. I don't think its an issue with my code 
> if it works in Debug (Xcode & Finder) and Release (Xcode only).
> 
> My build configurations for both Debug and Release are identical (I haven't 
> checked thoroughly, but I know I didnt change much). Both configs are set to 
> use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other 
> change I've made is adding a few header search paths.
> 
> Any help is greatly appreciated. 
> Thanks___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: Leopard for development / testing.

2009-12-09 Thread Kiel Gillard
On 10/12/2009, at 3:37 PM, Dan Ribe wrote:

> Hi All,
> 
> I want to get a copy of Leopard for development/testing purpose. Can anyone
> please let me know.
> 
> - Is there anyway to download it from apple's site ?

Yes 

I know they offer Snow Leopard download - not sure about Leopard. Maybe someone 
else with the appropriate membership can help?

> - Does apple provides Leopard copy for Development/Testing for free or I
> have to pay for that ?

You have to pay.

Kiel

> - If apple provides free copy of Leopard for development/testing purpose
> then what I need to do to get one ?
> 
> Please excuse me as my question is not related to cocoa but I thought
> someone will be able to answer it in this list. Thanks for your help !
> 
> Cheers
> -Dan
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com
> 
> This email sent to kiel.gill...@gmail.com

___

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

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

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

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


Re: How can a plug-in bundle get access to its own resources?

2009-11-10 Thread Kiel Gillard

On 10/11/2009, at 10:51 PM, Benjamin Miller wrote:


On 10 Nov 2009, at 11:45, Motti Shneor wrote:

This may seem a silly question, but I cannot find any decent way  
for my Plug-In bundle code to access its own resources!


... snip ...

Is there a way out? Is there any trick, or technique to work around  
this bizarre deficiency of the Bundle mechanism?




[[NSBundle bundleForClass] self class] ?


More correctly:

NSBundle *pluginBundle = [NSBundle bundleForClass:[self class]];



Then you can access the paths of the resources associated with that  
bundle using the usual methods identified in the reference given above.


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: menu action never being called?

2009-11-03 Thread Kiel Gillard


On 04/11/2009, at 12:25 PM, David M. Cotter wrote:


i have a menu that lives in the menu bar (top level)

but i also use it in a context menu


This is the source of your problem. Your design is working against you.

I would suggest using one instance of NSMenu for the main menu and  
another instance for the contextual menu. This encourages you to keep  
your code cleaner in logic, simpler to maintain and more flexible in  
the future.


I hope this helps despite the assumptions I am making about your code.

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: Core Data design question: receiving KVO notifications of partially mutated objects

2009-10-30 Thread Kiel Gillard

On 31/10/2009, at 9:01 AM, Sean McBride wrote:


Hi all,

What is considered best practice when it comes to mutating many
properties of a managed object, specifically with regard to KVO
observers getting notified before all mutations are finished?


In situations like these I personally tend to avoid KVO. It's too  
noisy and in some cases incurs too much of a performance overhead.  
But, I have a solution which I describe below.


Let's say I have an Rectangle object.  It has properties: colour,  
width,
height.  Imagine some controller observing all these properties,  
perhaps

to trigger a redraw.

If I do:

[rect setColour:...];
[rect setWidth:...];
[rect setHeight:...];



This is short and readable.  But observers will be notified after each
setter.  This could be a problem if intermediate states are not self-
consistent and could also lead to unnecessary redrawing.  In the  
general

case, I might not even know who is observing.

I guess it's safer to create a setColour:width:height: method in my
NSManagedObject subclass that does:

[self willAccessValueForKey:@"colour"];
[self willAccessValueForKey:@"width"];

[self setPrimitiveColour:...];
[self setPrimitiveWidth:...];

[self didAccessValueForKey:@"width"];
[self didAccessValueForKey:@"colour"];

Is this what I should be doing?

I can see it getting ugly with more than 3 or so properties...


Perhaps make a property that represents the state of the value these  
dependent properties contribute to? For example, is it possible to  
have a "requires redraw" property of the Rectangle? You could simply  
change the value of that property (in the overridden setColor:,  
setWidth:, setLength: methods *sigh*) to indicate the Rectangle object  
requires a redraw? Then, when a third party wants the value of the  
dependent property, you can recalculate it. In the given example, the  
rectangle will only re-draw when it's needed.


Just a few ideas, not sure if they're of any help. They're not coming  
from a Core Data perspective either, just a general one - but I  
wouldn't expect it to be much different?


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: Serial comm in Cocoa?

2009-10-15 Thread Kiel Gillard
Look for AMSerialPort on this page: 


Kiel

On 16/10/2009, at 11:12 AM, Oftenwrong Soong wrote:


Hi All,

What is the Cocoa-fied way to communicate via a serial port?

Using a kext to support the Prolific PL2303 chip and a shell utility  
like cu, it is possible to communicate via many USB-based serial  
ports. (For those who need it, the kext is at sourceforge.net/ 
projects/osx-pl2303.) I am writing a Cocoa app that needs to  
communicate interactively with a device using an in-house message  
protocol, as opposed to just sending a file across a link. (If it  
were the latter case, I would just spawn a process using NSTask and  
send the file across.)


I have written such an app under Windows before. In the .NET  
framework, there is a class SerialPort that makes it easy. You can  
do everything, including set the baud rate, parity, data bits, stop  
bits, etc.


I hope there is something similar in Cocoa (but I couldn't find it).

Thanks all,
Soong

ps, Since I mentioned the kext, I'd like to point out that if you  
use VMware Fusion, it is my experience that while this kext is  
loaded, a virtual machine cannot connect to the serial port. In this  
case, I unload the kext using kextunload, and then it works fine.  
There was a discussion about this at http://communities.vmware.com/message/1073355 
.





___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Kiel Gillard

A few other alternatives come to mind:
- archive an identifier value that uniquely identifies the object you  
are dragging or
- use and archive an instance of NSValue using the valueWithPointer:  
initializer.


<http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSValue_Class/Reference/Reference.html#//apple_ref/occ/clm/NSValue/valueWithPointer: 
>


NSValue conforms to the NSCoding protocol, you should be able to use  
NSKeyedArchiver to archive an instance of NSValue, write the archive  
to the pasteboard and unarchive it at your dragging destination using  
NSKeyedUnarchiver.


Kiel

On 15/10/2009, at 11:35 AM, Rick Mann wrote:

That's the kind of thing I'm trying to avoid. There's no need to do  
that, since the drag is only within my app. I just want the drag  
receiver to have access to a *point* to the object, not a new copy  
of the object.


On Oct 14, 2009, at 17:34:06, Kiel Gillard wrote:

You could archive and unarchive your object as data using  
NSKeyedArchiver and NSKeyedUnarchiver.


<http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/creating.html#//apple_ref/doc/uid/2949 
>
<http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/codingobjects.html#//apple_ref/doc/uid/2948 
>


Kiel

On 15/10/2009, at 11:21 AM, Rick Mann wrote:

I'm trying to implement a library like Interface Builder's. When  
the user drags an item out of the library and onto one of my  
custom views, it should instantiate an object and place it in the  
view accordingly.


I'm trying to implement the drag by writing to the pasteboard an  
NSData object I create that contains a reference to the object,  
like so:


- (BOOL)
collectionView: (NSCollectionView*) inCollectionView
 writeItemsAtIndexes: (NSIndexSet*) inIndices
 toPasteboard: (NSPasteboard*) inPasteboard
{
 MyObject* foo = self.myFoo;
 if (foo != nil)
 {
 [inPasteboard declareTypes: [NSArray arrayWithObject:  
kUTIMyObjectRef] owner: nil];

 [inPasteboard writeObjects: [NSArray arrayWithObject: plugIn]];

 return YES;
 }

 return NO;
}

In MyObject:

- (NSArray*)
writableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
 static NSArray* types = nil;
 if (types == nil)
 {
 types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
 }

 return types;
}

- (id)
pasteboardPropertyListForType: (NSString*) inType
{
 if ([inType isEqualToString: kUTIMyObjectRef])
 {
 NSMutableData* data = [NSMutableData data];
 [data appendBytes: &self length: sizeof (self)];
 return data;
 }

 return nil;
}

+ (NSArray*)
readableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
 static NSArray* types = nil;
 if (types == nil)
 {
 types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
 }

 return types;
}


But nowhere do I see a way to turn that NSData into an object  
reference, and I'm pretty sure I'm not implementing  
pasteboardPropertyListForType: correctly, anyway (I mimicked what  
I saw in the docs).


Am I just going about this all the wrong way?

TIA,
Rick

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com






___

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

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

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

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


Re: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Kiel Gillard
You could archive and unarchive your object as data using  
NSKeyedArchiver and NSKeyedUnarchiver.






Kiel

On 15/10/2009, at 11:21 AM, Rick Mann wrote:

I'm trying to implement a library like Interface Builder's. When the  
user drags an item out of the library and onto one of my custom  
views, it should instantiate an object and place it in the view  
accordingly.


I'm trying to implement the drag by writing to the pasteboard an  
NSData object I create that contains a reference to the object, like  
so:


- (BOOL)
collectionView: (NSCollectionView*) inCollectionView
   writeItemsAtIndexes: (NSIndexSet*) inIndices
   toPasteboard: (NSPasteboard*) inPasteboard
{
   MyObject* foo = self.myFoo;
   if (foo != nil)
   {
   [inPasteboard declareTypes: [NSArray arrayWithObject:  
kUTIMyObjectRef] owner: nil];

   [inPasteboard writeObjects: [NSArray arrayWithObject: plugIn]];

   return YES;
   }

   return NO;
}

In MyObject:

- (NSArray*)
writableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
   static NSArray* types = nil;
   if (types == nil)
   {
   types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
   }

   return types;
}

- (id)
pasteboardPropertyListForType: (NSString*) inType
{
   if ([inType isEqualToString: kUTIMyObjectRef])
   {
   NSMutableData* data = [NSMutableData data];
   [data appendBytes: &self length: sizeof (self)];
   return data;
   }

   return nil;
}

+ (NSArray*)
readableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
   static NSArray* types = nil;
   if (types == nil)
   {
   types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
   }

   return types;
}


But nowhere do I see a way to turn that NSData into an object  
reference, and I'm pretty sure I'm not implementing  
pasteboardPropertyListForType: correctly, anyway (I mimicked what I  
saw in the docs).


Am I just going about this all the wrong way?

TIA,
Rick

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kiel Gillard


On 28/09/2009, at 2:23 PM, Graham Cox wrote:



On 28/09/2009, at 1:47 PM, Kiel Gillard wrote:


Generally one does not put custom keys in the Info.plist.



Why not? As long as you're careful to ensure no conflict now or in  
the future with Apple's defined keys, you'll be fine (so ensure you  
use a key that couldn't possibly be used by Apple, such as prefixed  
with your name, etc - same as for any Objective-C class you create  
yourself in other words). I've seen plenty of third party code add  
keys to Info.plist, e.g. Sparkle.


--Graham


Duh. Not sure what I was thinking. Sorry, Hippo Man. Thanks for the  
heads up, Graham and Kyle.


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: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kiel Gillard



Generally one does not put custom keys in the Info.plist. You might  
want to consider a separate plist resource for your target and use  
NSBundle's pathForResource:ofType: method to query the dictionary at  
the resulting path. For more information see: 


Kiel

On 28/09/2009, at 1:33 PM, Hippo Man wrote:


Is there a way for me to put my own, custom key into a Cocoa
application's Info.plist and have the application query that key's
setting?

I know that I can use the dictionaryWithContentsOfFile: method of an
NSDictionary to read an arbitrary, dictionary-like property list,
given its pathname. However, I'm wondering if there's a way to
automatically get one or more settings in the current Cocoa
application's Info.plist without knowing anything about its pathname.
In other words, I want to query settings from "my" Info.plist.

Is this possible? If so, could someone point me to some docs which
describe how to do this?

Thanks in advance.

--
HippoMan 
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Rotation and translation of an image

2009-08-12 Thread Kiel Gillard

Hi Agha,

I'm not too sure what's wrong with the picture so I'm not sure how  
much I can help you.


But to rotate your image by the centre, first translate your image or  
context so the centre of the image/context is located at the origin:

1 Translate by negative half width, negative half height,
2 Rotate by theta degrees,
3 Translate by positive half width, positive half height to undo the  
first transform.


Maybe this helps?

Kiel

On 13/08/2009, at 12:03 PM, Agha Khan wrote:

I have 6 small images which should be rotated in a view. Picture  
worth 1000 words.



transform = CGAffineTransformMakeTranslation(0.0, 20);
transform = CGAffineTransformRotate(transform, M_PI);
//  transform = CGAffineTransformScale(transform,1, -1);

CGContextConcatCTM(ctx, transform);


DigFileName = [NSString stringWithFormat:@"n%d.png",Edges[3]];
img = [UIImage imageNamed:DigFileName];
CGContextDrawImage(ctx, CGRectMake(8, 38, 20, 20), img.CGImage);

Because I am rotating the leftside image should be flipped. I know  
it is wrong and showed you just to explain. I am confused because I  
want to rotate the image of the center of the image. I am not sure  
how to rotate image at the center.


Thank you for prompt reply.

Best regards
Agha

On Aug 12, 2009, at 6:49 PM, Kiel Gillard wrote:


Hi Agha,

An appropriate answer depends entirely on what you want to do with  
the image. Do you want to draw the image into a view? Do you want  
to save the image to the hard disk?


You'll have to give us more information to help you out.

Kiel

On 13/08/2009, at 11:22 AM, Agha Khan wrote:


HI:
Can someone point me the sample code for image transformation?
You help will be very much appreciated.
Best regards
Agha Khan
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com






___

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

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

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

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


Re: Rotation and translation of an image

2009-08-12 Thread Kiel Gillard

Hi Agha,

An appropriate answer depends entirely on what you want to do with the  
image. Do you want to draw the image into a view? Do you want to save  
the image to the hard disk?


You'll have to give us more information to help you out.

Kiel

On 13/08/2009, at 11:22 AM, Agha Khan wrote:


HI:
Can someone point me the sample code for image transformation?
You help will be very much appreciated.
Best regards
Agha Khan
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Intel Mac prefpane error

2009-08-07 Thread Kiel Gillard

What OS are those few people running?

Kiel :-)
"If video games affected us as kids, we'd all be running around in  
darkened rooms, munching on magic pills and listening to repetitive  
electronic music."


On 08/08/2009, at 7:47 AM, Trygve Inda wrote:

Although my app is a universal binary (32/64), and was developed on  
an Intel

Mac, a few people report when trying to install and error:

"You cannot open (my app) preferences because it doesn't work on an
Intel-based Mac."

It works on all three of my Intel Macs on 10.5.7, 10.5.8 and 10.6  
Dev build.


Any ideas?

Thanks,

Trygve


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kiel Gillard

On 04/08/2009, at 10:59 AM, Kyle Sluder wrote:

On Mon, Aug 3, 2009 at 5:47 PM, Kiel Gillard  
wrote:
Do you have a documentation reference for that? I would have  
expected the
isa swizzling to be an implementation detail of the runtime that is  
handled
before my subclass inits. Of course, what I expect and what happens  
in

reality do not always match ;-)


The Objective-C 2.0 Programming Guide prescribes the use of direct
ivar access inside an initializer[1] and inside dealloc[2].

[1] http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#/ 
/apple_ref/doc/uid/TP30001163-CH22-SW14
[2] http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocProperties.html#/ 
/apple_ref/doc/uid/TP30001163-CH17-SW16


Thanks for these - much appreciated. The -dealloc commentary was very  
helpful. For the OP, this means care should be taken to unobserve key  
paths before dealloc. One way this could be done by observing  
NSApplicationWillTerminateNotification.


The constraints and conventions commentary for the init method seems  
to be more about coding style (consistency in style during  
initialisation and deallocation) as one could argue the side affects  
of a custom accessor are desired (such as registering a new object  
value of an instance variable for KVO notifications).



As far as your point about when swizzling occurs, it can only happen
at the point of a KVO observer registration: the runtime can't predict
the future.


When if I observe some property of Foo *bar at some point in time, KVO  
swizzles the isa to KVONotifying_Foo. Then, if I observe a different  
property of the same object at some other point in time, are you  
suggesting KVO swizzles the isa to KVONotifying_Foo2 which in turn  
"can often" break future KVO notifications?


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: Avoiding KVO in dealloc?

2009-08-03 Thread Kiel Gillard

On 04/08/2009, at 10:26 AM, Kyle Sluder wrote:

On Aug 3, 2009, at 5:03 PM, Kiel Gillard   
wrote:
Unless, of course, you have code in your setter method that handles  
changes to and from nil. For example, you may add or remove self as  
an observer for keypaths of an different object value. This would  
save repeating the change handling code in your init, setter and  
dealloc methods.


No, this is precisely what you should not do. -init and -dealloc  
should not invoke accessor methods, because the object is in a  
partially constructed state that subclasses (including the  
dynamically created ones KVO makes) often can't handle.


Do you have a documentation reference for that? I would have expected  
the isa swizzling to be an implementation detail of the runtime that  
is handled before my subclass inits. Of course, what I expect and what  
happens in reality do not always match ;-)


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: Avoiding KVO in dealloc?

2009-08-03 Thread Kiel Gillard


On 04/08/2009, at 9:46 AM, Kyle Sluder wrote:

On Mon, Aug 3, 2009 at 4:35 PM, Todd  
Heberlein wrote:
Both methods seem to me to do the same thing (releasing foo), but I  
presume
the first one would trigger any KVO observers where as the second  
wouldn't.
Is that why the simple "release" is used instead of a setter in the  
dealloc

methods, to avoid KVO? Is this a general Cocoa pattern?


Yes, it's a general pattern.  Not just to avoid KVO, but any custom
accessor/mutator behavior.

The rule of thumb is never use your accessors/mutators inside -init or
-dealloc, and always use them elsewhere.


Unless, of course, you have code in your setter method that handles  
changes to and from nil. For example, you may add or remove self as an  
observer for keypaths of an different object value. This would save  
repeating the change handling code in your init, setter and dealloc  
methods.


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: Diagramming (a bit OT)

2009-07-30 Thread Kiel Gillard
I've always used OmniGraffle with UML stencils in the past. I'm not  
sure if you know about these already 


Hope this is of some help,

Kiel

On 31/07/2009, at 1:19 PM, Loukas Kalenderidis wrote:


Hey guys,

Sorry, this is a bit off topic for this list, but I'm mostly  
interested in responses from Cocoa people so please bear with me.


What do you use for technical diagramming for everything in the  
software development realm? I use OmniGraffle, but most of my work  
is pretty informal because I (regrettably now) avoided most of the  
boring-looking UML/etc courses at uni. Does anybody have some good  
resources for learning how this stuff is supposed to be done formally?


Does anybody know what tool/templates/etc Apple might use for the  
diagrams in their technical documentation?


e.g. 
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Art/token_generation.jpg

Thanks,
Loukas
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: something I can't understand

2009-07-28 Thread Kiel Gillard

On 29/07/2009, at 12:52 PM, Agha Khan wrote:


Hi:
I have a struct
@interface PngButton : UIButton
{
@public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
}
@property (assign) bool OffPos;
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end


No, you have an Objective-C class.

PngButton* pPngButton	= [PngButton  
buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


I get an error
error: lvalue required as left operand of assignment

Why it is not working? I shouldn't get this error.
Any help will be very much appreciated.


Do you get any warnings?

Try this and see what happens:
pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ?  
250.0 : 410.0), 50.0);


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: hide main menu, not appear in dock, "run in background".

2009-07-16 Thread Kiel Gillard

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

On 17/07/2009, at 10:43 AM, Piotr Grzybowski wrote:


Hello Everyone,

For some time I wanted my cocoa application not to appear in the  
dock, nor

to show the main menu bar. After some searching and screaming,
I managed to achieve this by adding

NSBGOnly
1

to the Info.plist, now my question is: is this the usual way of  
doing it?

I am sure that there are some apps that hide differently, but I have
no idea how..

thanx,
pg
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Use Cocoa in QL Generator

2009-07-15 Thread Kiel Gillard
Sorry, I thought I remember reading in the Quick Look documentation  
the steps required to write code with and link it against the Cocoa  
framework.


Starting with a Quick Look Plugin Template in Xcode,
- Choose from the menu bar Project > Add to Project... and add the  
framework /System/Library/Frameworks/Cocoa.framework.
- Replace the .c extensions for every file using the Objective-C code  
to .m.

- #import  in your .m files.

Hope this helps,

Kiel

On 16/07/2009, at 12:16 AM, David Blanton wrote:

I have already read that.  Do I just need to include the Cocoa  
Framework and include Cocoa.h ?


On Jul 14, 2009, at 6:48 PM, Kiel Gillard wrote:


Read the documentation:

http://devworld.apple.com/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Introduction/Introduction.html

The samples there use Cocoa as well as CoreFoundation.

On 15/07/2009, at 10:34 AM, David Blanton wrote:


I want to use Cocoa calls in my GenerateThumbnailForURL

what do I ahve to do to use Cocoa ?
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com








___

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

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

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

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


Re: Use Cocoa in QL Generator

2009-07-14 Thread Kiel Gillard

Read the documentation:

http://devworld.apple.com/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Introduction/Introduction.html

The samples there use Cocoa as well as CoreFoundation.

On 15/07/2009, at 10:34 AM, David Blanton wrote:


I want to use Cocoa calls in my GenerateThumbnailForURL

what do I ahve to do to use Cocoa ?
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Is sdp generating incomplete header files?

2009-07-08 Thread Kiel Gillard

Hi all,

In an attempt to start using the scripting bridge, I followed the  
instructions available here 


If use the sdef tool with the application I would like to interact  
with, I get an xml file describing multiple suites for the  
application, including the misc suite. However, the sdp tool only  
seems to synthesize header files defining interaction with the  
document suite. Why can't it synthesize a header file including  
functionality exposed by the misc suite? I can clearly see the misc  
suite in the application's dictionary exposed by the Script Editor.


Thanks,

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: Why do I receive KVO notification when new value IS the old value?

2009-07-08 Thread Kiel Gillard
To prevent this behaviour, you could override setName: to only change  
the value when the pointers are not the same.


Kiel

On 09/07/2009, at 8:05 AM, Jerry Krinock wrote:

Why do I receive KVO notifications when a key is set to the same  
value that it already is?


This happens not only when the new and old values are -isEqual:, but  
when they are identically the same pointer.  I can't think of any  
reason why anyone would want notification of a no-op.


I understand that it's easy enough to filter these out in my  
observer methods, but it's certainly a waste of CPU cycles.  I  
wonder if maybe Apple calculated that, in their implementation, it  
is on average less CPU cycles for me to filter them out in the  
notifications I actually receive, as compared to Cocoa filtering all  
notifications before posting?


I presume that, for example, Cocoa's NSControl subclasses must all  
be checking for equality before redrawing in responding to a KVO  
notification?


Jerry Krinock

*** Console Output **

[Session started at 2009-07-08 14:51:07 -0700.]
2009-07-08 14:51:07.678 KVO triggered by change:
{
  kind = 1;
  new = alpha;
  old = ;
}
2009-07-08 14:51:07.746 KVO triggered by change:
{
  kind = 1;
  new = beta;
  old = alpha;
}
2009-07-08 14:51:07.752 KVO triggered by change:
{
  kind = 1;
  new = beta;
  old = beta;
}
2009-07-08 14:51:07.760 KVO triggered by change:
{
  kind = 1;
  new = gamma;
  old = beta;
}
2009-07-08 14:51:07.761 KVO triggered by change:
{
  kind = 1;
  new = gamma;
  old = gamma;
}
2009-07-08 14:51:07.764 KVO triggered by change:
{
  kind = 1;
  new = delta;
  old = gamma;
}

The Debugger has exited with status 0.


*** Demo Code **

#import 


@interface Foo : NSObject {
  NSString* name ;
}

@property (copy) NSString* name ;

@end

@implementation Foo

@synthesize name ;

@end


@interface Observer : NSObject {
  id observee ;
}

@property (retain) id observee ;

@end

@implementation Observer

@synthesize observee ;


- (id)initWithObservee:(id)observee_ {
  self = [super init] ;
  if (self != nil) {
  [self setObservee:observee_] ;
  [observee addObserver:self
 forKeyPath:@"name"
options:(NSKeyValueObservingOptionOld
 + NSKeyValueObservingOptionNew)
context:NULL] ;
  }
  return self ;
}


- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
  change:(NSDictionary *)change
 context:(void *)context {
  NSLog(@"KVO triggered by change:\n%@", change) ;
}


- (void) dealloc {
  [observee removeObserver:self
forKeyPath:@"name"] ;
  [observee release] ;

  [super dealloc] ;
}

@end


int main (int argc, const char * argv[]) {
  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init] ;

  Foo* foo = [[Foo alloc] init] ;

  Observer* observer = [[Observer alloc] initWithObservee:foo] ;

  NSString* alpha = @"alpha" ;
  NSString* beta = @"beta" ;
  NSString* gamma = @"gamma" ;
  NSString* delta = @"delta" ;

  [foo setName:alpha] ;
  [foo setName:beta] ;
  [foo setName:beta] ;
  [foo setName:gamma] ;
  [foo setName:gamma] ;
  [foo setName:delta] ;

  [foo release] ;
  [observer release] ;

  [pool release] ;
}


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Cocoa System Requirements

2009-07-06 Thread Kiel Gillard
Cocoa has been around since wham and has always been a part of Mac OS  
X. However, certain API has been added or removed. Those changes are  
identifiable in the documentation for that API.


For example, Core Animation was added in Mac OS X 10.5 Leopard. The  
documentation clearly indicates Core Animation is available on Leopard  
only.


Hope this helps,

Kiel

On 07/07/2009, at 9:45 AM, Joelle Lam wrote:


Hello,

Where can I find the minimum System Requirements for Cocoa.  In  
other words,
is there a Mac OS that does not provide Cocoa support (ie Mac OS  
Tiger on

PPC)?

Thanks!
Joelle

--
Joelle Lam
j...@aptana.com

Twitter: http://twitter.com/aptana
Facebook: http://aptana.com/facebook
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Switching Contents of NSView

2009-07-05 Thread Kiel Gillard
If you are suggesting Google was the right place to look,  
unfortunately you are mistaken.


Directly underneath the toolbar of the documentation window should be  
a scope bar that attempts to help you find the information you're  
looking for. Perhaps you're searching the documentation by Title  
instead of by API? If I search by API and type "loadNibNamed" I  
immediately get the NSBundle Additions API, however if I search by  
Title I get nothing.


Hope this helps,

Kiel

On 06/07/2009, at 8:55 AM, Pierce Freeman wrote:


You're right, I was looking in the wrong place.  A good Google search
(versus the built in documentation) did the trick.  For future  
reference,

it's under "NSBundle Additions" versus the plain "NSBundle".


On 7/5/09 3:45 PM, "I. Savant"  wrote:


On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote:


That makes sense - I'll definitely try that!  And just asking, but
from the
first link you sent, what does this return?  [NSBundle
loadNibNamed:@"someNibFile" owner:d];  My assumption is that it's
not a
view.


  Come on, you're not even trying. Look the method up in the
*documentation* to find out what it returns. That's what it's there  
for.


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

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Any Good Core Animation Tutorials?

2009-06-15 Thread Kiel Gillard
Bill Dudney's Core Animation book is the best, high quality and  
inexpensive resource for any Core Animation developer .


Matt Gallagher's four part Core Animation powered Asteroids tutorials  
are pretty good, too .


In other related documentation: .


Hope this helps,

Kiel

On 16/06/2009, at 2:22 PM, Chunk 1978 wrote:


does anyone know off hand any good online tutorials using Core
Animation?  ideally, i'd like to see animation grouping, so one single
method calling a group that rotates (with specifically set anchor
point), and moves from one origin to another.  i'm pretty sure i can
figure the rest out on my own (opacity, scale, etc.) but first i would
like to see how 2 animations are configured and grouped as a guide.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: How determine if file is in Trash, given Path or Alias

2009-05-27 Thread Kiel Gillard

Nothing comes to mind from the top of my head.

A little digging through Carbon documentation suggested you could use  
FSCatalogInfo() function to determine the parent directory ID of the  
file you are testing. With the result of that function, you can use  
the IdentifyFolder() function to see if the parent directory's folder  
type == kSystemTrashFolderType.


Hope this helps,

Kiel

On 28/05/2009, at 1:05 PM, Jerry Krinock wrote:

How can I determine if a given file path, or a file alias (I have  
both), refers to an item which is in the Trash?


The obvious answer, using -[NSString hasPrefix:] on the path with  
NSHomeDirectory()/.Trash, doesn't look very pretty.


Thanks,

Jerry
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: warning 'NSEvent' may not respond to '+eventWithEventRef:'

2009-05-25 Thread Kiel Gillard
+ eventWithEventRef is Mac OS X 10.5 Leopard only API. It is  
unavailable on Mac OS X 10.4 Tiger.


If you want to write from Leopard only, set the base SDK of your  
target to the 10.5 SDK.


Kiel

On 26/05/2009, at 2:52 PM, Ken Tozier wrote:


Hi

I'm getting a warning when calling NSEvent's eventWithEventRef

NSEvent *event  = [NSEvent eventWithEventRef: ref];

I include Appkit and Carbon in the file where this warning appears

#import 
#import 

And the documentation doesn't say this is an obsolete method

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/Reference/Reference.html#/ 
/apple_ref/occ/clm/NSEvent/eventWithEventRef:


So why am I getting the warning?

Despite the warning, it seems to run fine, just kind of annoying to  
see this yellow 'WARNING " balloon in my code.


Thanks in advance
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Compiler does not synthesize KVO compliant properties for CATiledLayer subclass (was: Synthesized properties for scalars not KVO compliant)

2009-05-21 Thread Kiel Gillard

Hi Dave,

On 22/05/2009, at 4:12 PM, Dave Keck wrote:


Hello,

A few days ago I was having this same issue. The reason KVO doesn't
work out-of-the-box with CALayer subclasses, I believe, is because
CALayer overrides +automaticallyNotifiesObserversForKey: to return NO.
My solution was to override +aNOFK: in my custom subclass to return
YES for my custom key. This has worked flawlessly for me - please let
me/us know whether it does for you.


Thanks! This seems to be a solution to the problem.


Here's the applicable code
snippet:

+ (BOOL)automaticallyNotifiesObserversForKey: (NSString *)key
{

   /* The NSObject implementation defaults to returning YES to this
method. But because we're a CALayer subclass,
  we have to override it to return YES when key == one of our
properties. This is because CALayer overrides the
  NSObject default functionality, so that this method always
returns NO for CALayer and its subclasses. */

   if ([key isEqualToString: @"gridShown"])
   return YES;

   return [super automaticallyNotifiesObserversForKey: key];

}


It would be great if we could get a reason as to why it seems to  
always return NO. My guess would be that there could be a significant  
performance overhead using the KVO mechanism for every layer's property?



(I suppose we could figure out definitively whether CALayer was
overriding +aNOFK: by comparing its +aNOFK: IMP with NSObject's
+aNOFK: IMP. If I try this I'll get back to the list with my
findings...)

David


Thanks David, that'd be great!

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


Compiler does not synthesize KVO compliant properties for CATiledLayer subclass (was: Synthesized properties for scalars not KVO compliant)

2009-05-21 Thread Kiel Gillard

Hi all,

Thanks for your suggestions and help so far.

I believe my problem is that my model object is a subclass of  
CATiledLayer. Synthesized accessor methods for the CATiledLayer  
subclass are not key value observing compliant. Yet, by changing the  
immediate superclass of the model object to NSObject, the synthesized  
accessor methods are KVO compliant. Any ideas what I can do besides  
provide my own accessor methods?


Below I have some code for a Cocoa Application template in Xcode. I  
have an optional #define INHERITS_FROM_NSOBJECT. I have two custom  
classes, Controller (inheriting from NSObject) and CustomLayer  
(inheriting from CATiledLayer or NSObject). CustomLayer inherits from  
NSObject if INHERITS_FROM_NSOBJECT has been #define'd.


In the XIB I have a top level instance of Controller. It contains an  
outlet pointing to the content view of the XIB's window.


Thanks again!

Kiel

//#define INHERIT_FROM_NSOBJECT 1

#ifdef INHERIT_FROM_NSOBJECT
@interface CustomLayer : NSObject {
#else
@interface CustomLayer : CATiledLayer {
#endif
CGFloat ivar1;
CGFloat ivar2;
NSString *stringIvar;
}

@property CGFloat ivar1;
@property CGFloat ivar2;
@property (retain, nonatomic) NSString *stringIvar;
@end

@implementation CustomLayer

- (id)init
{
if (self = [super init]) {
self.ivar1 = 1.0;
self.ivar2 = 1.0;
#ifndef INHERIT_FROM_NSOBJECT
self.bounds = CGRectMake(0.0, 0.0, 2000.0, 2000.0);
self.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
#endif
self.stringIvar = @"String ivar";

		NSLog(@"Created layer %@ with ivar1 == %f, ivar2 == %f, stringIvar  
== %@", self, self.ivar1, self.ivar2, self.stringIvar);

}

return self;
}

- (void)dealloc
{
self.stringIvar = nil;
[super dealloc];
}

@synthesize ivar1;
@synthesize ivar2;
@synthesize stringIvar;
@end


@interface Controller : NSObject {
IBOutlet NSView *view;
}

@end

#import "Controller.h"
#import "CustomLayer.h"

static NSUInteger IvarChange, StringIvarChange;

@implementation Controller

- (void)awakeFromNib
{
[view setWantsLayer:YES];

//create catiledlayer or nsobject subclass with observed properties
CustomLayer *layer = [[[CustomLayer alloc] init] autorelease];
	[layer addObserver:self forKeyPath:@"ivar1" options:0  
context:&IvarChange];
	[layer addObserver:self forKeyPath:@"ivar2" options:0  
context:&IvarChange];
	[layer addObserver:self forKeyPath:@"stringIvar" options:0  
context:&StringIvarChange];


#ifdef INHERIT_FROM_NSOBJECT
//leak memory deliberately for the sake of the example
[layer retain];
#else
	//add layer as a sublayer to force the CoreAnimation machinery to use  
the tiled layer subclass

[[view layer] addSublayer:layer];
#endif

//setup a timer to modify the properties of the layer object
	NSDictionary *userInfo = [NSDictionary  
dictionaryWithObjectsAndKeys:layer, @"layer", nil];
	[NSTimer scheduledTimerWithTimeInterval:1.5 target:self  
selector:@selector(timerDidFire:) userInfo:userInfo repeats:YES];

}

- (void)timerDidFire:(NSTimer *)timer
{
NSDictionary *userInfo = [timer userInfo];
CustomLayer *layer = [userInfo valueForKey:@"layer"];

	NSLog(@"Manipulating ivar1 (%f) and ivar2 (%f) of layer %@",  
layer.ivar1, layer.ivar2, layer);

layer.ivar1 = layer.ivar1 + 1.0;
layer.ivar2 = layer.ivar2 + 1.0;
	NSLog(@"Manipulated ivar1 (%f) and ivar2 (%f) of layer %@",  
layer.ivar1, layer.ivar2, layer);


NSLog(@"Manipulating string ivar (%@)", layer.stringIvar);
layer.stringIvar = [[NSDate date] description];
NSLog(@"Manipulated string ivar (%@)\n\n", layer.stringIvar);
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object  
change:(NSDictionary *)change context:(void *)context

{
NSLog(@"%...@.%@ == %@", object, keyPath, [object valueForKey:keyPath]);

if (context == &IvarChange) {
NSLog(@"Float ivar change");

} else if (context == &StringIvarChange) {
NSLog(@"String ivar change");

} else {
		[super observeValueForKeyPath:keyPath ofObject:object change:change  
context:context];

}
}

@end

On 20/05/2009, at 10:45 AM, Jerry Krinock wrote:



On 2009 May 19, at 16:52, Kiel Gillard wrote:

I feel I may be missing something very simple but I have no idea  
what.


Never tried it with structs like CGRect but I just bound some  
integers like this yesterday and they KVO works.  The title of your  
message says "not KVO compliant".  Please clarify: Is the console  
log

Re: isKindOfClass returns null instead of YES or NO

2009-05-20 Thread Kiel Gillard
%@ is a format specifier for printing Objective-C objects.  
isKindOfClass and isMemberofClass  methods return BOOL values. BOOL  
values are not Objective-C objects.


If you want to log a BOOL value, you could use the format specifier %i  
as such:

NSLog(@"isKindOfClass: %i", myBool);

With regards to the responding to lowercase string line in code, you  
might want to see NSObject's instance method -  
(BOOL)respondsToSelector:(SEL)aSelector


Hope this helps.

Kiel

On 21/05/2009, at 1:43 AM, Jeff Decker wrote:


Hello,
I am working through the Stanford iPhone Dev assignments along with  
the videos on iTunes.  And I'm stuck on the assignment for the first  
week.  Shoot!
My goal is inspect each object of an array.  When I use  
isKindOfClass or isMemberOrClass, I do not get an expected YES or NO  
but rather a (null).

Here is the relevant code:
	NSMutableArray *myArray = [NSMutableArray arrayWithObjects:[NSURL  
URLWithString:@"AccountableTreeService.com"], @"Hello World", 	 
[NSProcessInfo processInfo], dictionary, mutableString, nil];

NSEnumerator *enumerator = [myArray objectEnumerator];
id step;
while (step = [enumerator nextObject]){
NSLog(@"");
NSLog(@"Class name: %@", [step className]);
		NSLog(@"Is Member of NSURL: %@", [[step class] isMemberOfClass: 
[NSURL class]]);
		NSLog(@"Is Kind of NSString: %@", [[step class] isKindOfClass: 
[NSString class]]);
		NSLog(@"Responds to LowercaseString: ");//I'm still working on  
this part

}
And here are my unexpected results:
2009-05-20 11:23:31.666 StanfordAssignment1B[18975:10b]  

2009-05-20 11:23:31.667 StanfordAssignment1B[18975:10b] Class name:  
NSURL
2009-05-20 11:23:31.668 StanfordAssignment1B[18975:10b] Is Member of  
NSURL: (null)
2009-05-20 11:23:31.668 StanfordAssignment1B[18975:10b] Is Kind of  
NSString: (null)
2009-05-20 11:23:31.669 StanfordAssignment1B[18975:10b] Responds to  
LowercaseString:
2009-05-20 11:23:31.670 StanfordAssignment1B[18975:10b]  

2009-05-20 11:23:31.671 StanfordAssignment1B[18975:10b] Class name:  
NSCFString
2009-05-20 11:23:31.673 StanfordAssignment1B[18975:10b] Is Member of  
NSURL: (null)
2009-05-20 11:23:31.673 StanfordAssignment1B[18975:10b] Is Kind of  
NSString: (null)
2009-05-20 11:23:31.674 StanfordAssignment1B[18975:10b] Responds to  
LowercaseString:
2009-05-20 11:23:31.674 StanfordAssignment1B[18975:10b]  

2009-05-20 11:23:31.674 StanfordAssignment1B[18975:10b] Class name:  
NSProcessInfo
2009-05-20 11:23:31.675 StanfordAssignment1B[18975:10b] Is Member of  
NSURL: (null)
2009-05-20 11:23:31.675 StanfordAssignment1B[18975:10b] Is Kind of  
NSString: (null)
2009-05-20 11:23:31.675 StanfordAssignment1B[18975:10b] Responds to  
LowercaseString:
2009-05-20 11:23:31.676 StanfordAssignment1B[18975:10b]  

2009-05-20 11:23:31.677 StanfordAssignment1B[18975:10b] Class name:  
NSCFDictionary
2009-05-20 11:23:31.680 StanfordAssignment1B[18975:10b] Is Member of  
NSURL: (null)
2009-05-20 11:23:31.681 StanfordAssignment1B[18975:10b] Is Kind of  
NSString: (null)
2009-05-20 11:23:31.682 StanfordAssignment1B[18975:10b] Responds to  
LowercaseString:
2009-05-20 11:23:31.683 StanfordAssignment1B[18975:10b]  

2009-05-20 11:23:31.683 StanfordAssignment1B[18975:10b] Class name:  
NSCFString
2009-05-20 11:23:31.683 StanfordAssignment1B[18975:10b] Is Member of  
NSURL: (null)
2009-05-20 11:23:31.684 StanfordAssignment1B[18975:10b] Is Kind of  
NSString: (null)
2009-05-20 11:23:31.684 StanfordAssignment1B[18975:10b] Responds to  
LowercaseString:


Thanks for any help!
Jeff
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Sensible way to extend base class?

2009-05-20 Thread Kiel Gillard
Can you use composition in your application to compose an instance of  
class E with instances of framework classes A through to D?


Kiel ;-)
"Peace cannot be achieved through violence, it can only be attained  
through understanding."

Albert Einstein

On 20/05/2009, at 10:09 PM, Graham Cox wrote:

I have a base class in a framework, let's call it A. This has a  
number of subclasses, B C and D.


I have some functionality I'd like to add that would apply to all A,  
B, C and D. So a category on A would be fine - except that I need  
some support in the form of a couple of ivars. The added  
functionality isn't appropriate to the framework, so though I have  
the source for A, adding ivars that have no place there grieves me.


It also grieves me that the solution appears to be separate  
subclasses of B, C and D to add the functionality which must be  
duplicated for each class.


Any solution I've missed?


___

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: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Kiel Gillard

I should also mention I am not assigning a value to the scalar directly.

On 20/05/2009, at 9:52 AM, Kiel Gillard wrote:


Hi all,

I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods  
for them. My controller objects add themselves to the model objects  
as observers with the keypaths to the scalars. However, I'm not  
getting any key-value observing notifications when changes to those  
observed properties occur (observeKeyPath... isn't being called at  
all).


I feel I may be missing something very simple but I have no idea  
what. Any suggestions?


Thanks,

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


Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Kiel Gillard

Hi all,

I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods for  
them. My controller objects add themselves to the model objects as  
observers with the keypaths to the scalars. However, I'm not getting  
any key-value observing notifications when changes to those observed  
properties occur (observeKeyPath... isn't being called at all).


I feel I may be missing something very simple but I have no idea what.  
Any suggestions?


Thanks,

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: 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 <http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#//apple_ref/doc/uid/TP40002974-CH4-SW32 
> 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: 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


Re: Does Cocoa layer translate Objective-C objects to C++?

2009-05-04 Thread Kiel Gillard

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html

On 04/05/2009, at 10:17 AM, johnmadst...@yahoo.it wrote:


I am confused.

I was discussing with a developer about my desire to translate our C+ 
+ code (really simple and few methods and classes) to Objective-C,  
for a Cocoa/Cocoa Touch software.


His answer has been: « I do not understand the reason, considering  
that, after our translation to Objective-C, the Cocoa layer will  
perform another translation to C++. »


Is it true? Cocoa (and/or Cocoa Touch) layer translates Objective-C  
objects to C++?


What is the gain with Cocoa and Obejctive-C, if this is the truth?

Thanks

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Building a 64-bit Preferences Pane

2009-04-29 Thread Kiel Gillard

Hi Satoshi,

If you run this in Terminal:
Bugdom:~ kiel$ file /Applications/System\ Preferences.app/Contents/ 
MacOS/System\ Preferences
/Applications/System Preferences.app/Contents/MacOS/System  
Preferences: Mach-O universal binary with 2 architectures
/Applications/System Preferences.app/Contents/MacOS/System Preferences  
(for architecture i386):	Mach-O executable i386
/Applications/System Preferences.app/Contents/MacOS/System Preferences  
(for architecture ppc7400):	Mach-O executable ppc


You can see the System Preferences application is not a 64 bit  
application (at least, not yet). Therefore, you cannot make a 64 bit  
preference pane.


Kiel

On 30/04/2009, at 12:48 PM, 慧 松本 wrote:

I have been trying to make a simple 64-bit preference pane. But all  
trials ended in failure.


For example:
1) Make a new preference pane project "SamplePrefPane" with Xcode.
2) Set the build option "ARCHS" to "x86_64"
3) Build it and double click SamplePrefPane.prefPane

Then System Preferences app says:
Preferences Error
You can't open SimplePrefPane preferences because
it doesn't work on an Intel-based Mac.

But my machine is MacPro, Quad-Core Intel Xeon.

When I change the build option "ARCHS" to "32-bit universal", it  
works fine.


Does anybody know how to make 64-bit preference panes?

Satoshi
-
Satoshi Matsumoto 
816-5 Odake, Odawara, Kanagawa, Japan 256-0802




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: How to show items in a list ,grid or coverflow?

2009-04-22 Thread Kiel Gillard

List: NSTableView/NSOutlineView/NSBrowser
Grid: NSCollectionView
Coverflow: Use a layer backed (Core Animation) NSView 


Kiel

On 23/04/2009, at 12:36 PM, Bright wrote:


Hi,
   In my App's tableview, I want to show the items in a list ,grid  
or coverflow.

which APIs should I to call?Could anybody tell me?
 Tks very much.
Bright

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: nstoolbar in tiger

2009-04-16 Thread Kiel Gillard

Hi Rick/Jo/whoever,

You don't need to create a subclass of NSwindow, all you need is an  
object to provide the NSWindow instance a NSToolbar.


Running "NSToolbar" through Google would give you this result on the  
first page: 


Hope this helps,

Kiel :-)
"B.I.B.L.E. - Basic Instructions Before Leaving Earth"

On 16/04/2009, at 11:13 PM, Jo Phils wrote:


Hello,

I think I know the answer already but to be sure I'm not missing  
something if I want the equivalent of NSToolbar in Tiger I must  
create a custom window is that correct?  Unless there's a trick I  
don't know about I can't use NSToolbar in Tiger right?


Thanks for your input,

Rick



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Struct Property Key Path

2009-04-14 Thread Kiel Gillard

Hi Richard,

You can't bind to the individual members of your struct.

You could create a pair of accessor methods for the object containing  
the struct. These methods could return the values of the struct. For  
example:


@interface MyManagedObject : NSManagedObject {
NSPoint origin;
}

- (CGFloat)originX;
- (CGFloat)originY;

@end

@implementation MyManagedObject

- (CGFloat)originX
{
return origin.x;
}

- (CGFloat)originY
{
return origin.y;
}

@end

You would then implement two + (NSSet  
*)keyPathsForValuesAffectingOrigin[X | Y] and return the keypath to  
your struct ivar.


Hope this helps,

Kiel

On 15/04/2009, at 2:49 PM, Richard Somers wrote:

I have a model object which is a subclass of NSManagedObject. This  
object has a transformable property similar to NSPoint.


The frameworks automatically wrap and unwrap my NSPoint like struct  
in an NSValue instance. I would like to bind the individual struct  
members x and y to elements of the user interface with a key path. I  
can not seem to figure out how to get this work or if it is even  
possible.


Any suggestions?

Richard

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Looking for [NSNumber numberWithString:]

2009-04-01 Thread Kiel Gillard

As far as I know, this is the simplest way:
NSNumber *number = [NSNumber numberWithDouble:[@"3.14159" doubleValue]];

Kiel

On 02/04/2009, at 12:17 PM, Greg Robertson wrote:


I would like to convert an NSString to an NSNumber. Is there a direct
method for this or should I go NSString to double and then double to
NSNumber?

Thanks

Greg
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: App icon

2009-04-01 Thread Kiel Gillard
That's ok, his original question said "first time in simulator" so I  
figured his app had some sort of simulator mode for its first launch.


Kiel

On 02/04/2009, at 11:26 AM, Dave DeLong wrote:

Given that he mentioned running it in the simulator, I was guessing  
that he was asking about an iPhone application (upon which  
assumption I based my answer).


Dave

On Apr 1, 2009, at 6:24 PM, Kiel Gillard wrote:


NSApplication provides the instance method setApplicationIconImage:

At startup (say, the applicationDidFinishLaunching: method) you  
could determine what icon you need to display and set it, using the  
above method, to the appropriate icns file from your bundle.


Note that this will not permanently modify the icon, it only  
modifies the icon image used for one session of your application.


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

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: App icon

2009-04-01 Thread Kiel Gillard

NSApplication provides the instance method setApplicationIconImage:

At startup (say, the applicationDidFinishLaunching: method) you could  
determine what icon you need to display and set it, using the above  
method, to the appropriate icns file from your bundle.


Note that this will not permanently modify the icon, it only modifies  
the icon image used for one session of your application.


Kiel

On 02/04/2009, at 2:44 AM, fawad shafi wrote:



Dear All,
i m developing one application, my requirement is that when the user  
opens the application first time in simulator, i want to display  
1.icn file as an app icn, and if not the first time. then i wana  
display 2.icn.

is it possible?

Regards,
Fawad Shafi



_
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_042009___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Subclassing NSClipView

2009-03-31 Thread Kiel Gillard

Hi all,

Bill Dudney provides this sample app to show a CATiledLayer presenting  
a large image in multiple levels of detail . In his sample code, he implements a rudamentary form of scrolling  
with the arrow keys.


I'd like to subclass NSClipView to allow me to scroll a sublayer of  
the document view's backing layer.


The idea is to reposition the sublayer of the document view's backing  
layer when the scroll bars are manipulated, just as if I where to  
press an arrow key in the sample app. Furthermore, I'd like the scroll  
bars to consider the size of the sublayer of the backing layer of the  
document view instead of the size of the document view. This allows me  
to have a sublayer that is potentially larger than it's superlayer  
(the backing layer of the document view).


I've been able to reposition the sublayer when the scroll bars are  
clicked by overriding NSClipView's scrollToPoint: method. However, I  
can't seem to or I don't see how I can make my NSClipView subclass use  
the bounds and frame of the sublayer without manipulating the document  
view's frame. This problem gives situations such as the scroll bars  
not accurately representing the length of the sublayer.


Has anyone ever attempted to do something like this before? Any  
suggestions or ideas would be appreciated!


Thanks :-)

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: Storing API keys in plist file

2009-03-27 Thread Kiel Gillard

[NSUserDefaults standardUserDefaults]

Kiel :-)
"Love does not consist in gazing at each other but looking together in  
the same direction."

Antoine de Saint-Exupery

On 28/03/2009, at 2:38 PM, Devraj Mukherjee wrote:


Hi all,

My app relies on an external RESTful services, the service issues a
key for the REST services and at the moment I have hard coded that in
my wrapper classes.

I would like to put this into a preference file somewhere (suspecting
a plist file).

Obvious App-Info.plist doesn't seem to be the right place.

Any suggestions?

--
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Advice on the suitability of Core Animation in this situation

2009-03-26 Thread Kiel Gillard

Hi all,

We're developing a document based app that displays many potentially  
small and large shapes within a given document, much like a CAD app.  
We've gone down the path of Core Animation so far and it works for the  
most part. But we're often limited by the 2048x2048 OpenGL texture  
size and the performance of many CATiledLayers seems to bog us down  
quite bit, especially with very large shapes. The animations we can  
create with Core Animation are extremely useful in providing end users  
feedback (for example, if the shapes move, they actually *move* to  
their new position).


These limitations have me wondering, what would you advise in this  
situation, especially given the usability advantages offered by Core  
Animation? I think it would be premature to make any decisions until  
we release version 1.0 of our app and until the release of Snow  
Leopard. But if Snowy doesn't offer a solution, my gut instinct is to  
use OpenGL.


Thanks for sharing your thoughts,

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: Help with recursive includes

2009-02-21 Thread Kiel Gillard


On 22/02/2009, at 10:27 AM, Aaron Wallis wrote:

if I remove the #import "TMPSTManagedFile.h" from the header of the  
class and change it to @class TMPSTManagedFile the error goes away,  
and the application *would* run fine, if I didn't start getting  
errors caused from the ObjC 2.0 style property accessors like:

TMPSTManagedFile *tFile = [blah blah];
NSLog(@"%@", tFile.name);

In which case I start getting errors like:
Error: request for member 'name' in something not a structure or union

Any ideas?


Are you #importing the header file for "TMPSTManagedFile" in the .m  
file?


Towards the start of TMPSTLocalStore.m, you're declaring a static  
pointer within the @implementation. I didn't think you could do this,  
I thought you could only declare a static variable outside of the  
@implementation in the .m file.


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: Memory management question in Objective-C 2.0 @property notation

2009-02-05 Thread Kiel Gillard

Thanks mmalc, that clears things up for me.

On 05/02/2009, at 8:08 PM, mmalc Crawford wrote:



On Feb 4, 2009, at 10:01 PM, Kiel Gillard wrote:

I'm confused as to why else the memory would be leaking? Can you  
please identify my error?



The error is in your explanation.


However, doing this will yield a memory leak:
self.name = [[NSString alloc] init];
...because the property definition tells the compiler the methods  
it synthesizes should retain the value.


This is not a memory leak "because the property definition tells the  
compiler the methods it synthesizes should retain the value"; it is  
a leak because you're not abiding by the memory management rules.   
You're creating an object you own (alloc), and not relinquishing  
ownership.
(See <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html 
> for full details.)


There are several ways to remedy the problem; the overall best  
practice approach is:


NSString *aString = [[NSString alloc] init];
self.name = aString;
[aString release];


I suggest that the code quoted above will yield a memory leak  
because the NSString instance allocated will have a retain count of  
two


Explaining memory management at this level in terms of retain counts  
is a leap down the wrong path.


mmalc

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: Memory management question in Objective-C 2.0 @property notation

2009-02-04 Thread Kiel Gillard

On 05/02/2009, at 4:20 PM, Chris Suter wrote:

On Thu, Feb 5, 2009 at 4:10 PM, Kiel Gillard  
 wrote:



However, doing this will yield a memory leak:
self.name = [[NSString alloc] init];

...because the property definition tells the compiler the methods it
synthesizes should retain the value.


You're right that it will leak in that case but you've given the wrong
reason as to why. Memory management rules are covered by Apple's
documentation.

Regards,

Chris


Thanks for your reply, Chris.

I suggest that the code quoted above will yield a memory leak because  
the NSString instance allocated will have a retain count of two after  
the setName: message has be sent to self. To correct this error, I  
suggest that the code should read:

self.name = [[[NSString alloc] init] autorelease];

Under the heading of "Setter Semantics" of <http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#//apple_ref/doc/uid/TP30001163-CH17-SW2 
>, I can see that Apple's documentation clearly states that the  
implementation of a property declared with a retain attribute will  
send a retain message to the value given in the right hand side of the  
assignment.


I'm confused as to why else the memory would be leaking? Can you  
please identify my error?


Thanks,

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: Memory management question in Objective-C 2.0 @property notation

2009-02-04 Thread Kiel Gillard

Hi Devraj,

If you have declared and synthesized a property:
@property (retain, nonatomic) NSString *name;

...then any value assigned to name will retain it. Therefore, to  
initialise it, you could do something like:

self.name = [NSString string];

However, doing this will yield a memory leak:
self.name = [[NSString alloc] init];

...because the property definition tells the compiler the methods it  
synthesizes should retain the value.


Hope this helps,

Kiel

On 05/02/2009, at 3:54 PM, Devraj Mukherjee wrote:


Hi all,

I have a few classes that form the domain logic of my application and
comprise of objects of NSNumber, NSDate, NSString. I initialize these
with new objects in the init message of each of these classes.

These properties are defined using the @property (nonatomic, retain)
and @synthesize directives.

When I create objects of these Classes and replace these other values
(objects), my app seems to leak memory (according to Instruments)
specially when working with NSDates. Is there a trick that I should be
looking for when using @property and @synthesize or should I actually
be writing my own setters and getters to handle these properly.

Thanks.

--
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Overlay controls a la iTunes and QuickTime

2009-01-06 Thread Kiel Gillard

Howdy all,

What would be the best way to implement a HUD-like overlay of controls  
in the same manner as iTunes and QuickTime? These overlays can be seen  
when playing a video in iTunes 8 or a full screen video in (at least)  
the free version of QuickTime.


Is there example code or open source code that does this?

Thanks,

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: Sorting a bound NSTableView programatically

2008-12-17 Thread Kiel Gillard
Have you tired [arrayController rearrangeObjects]? 


You may need to ensure that the sort descriptors of the table view are  
bound to the NSArrayController instance.


Finally, there is a boolean attribute of NSArrayController in IB's  
Attributes Inspector labelled "Auto Rearrange Content". Ticking this  
should keep your model objects sorted as well.


Hope this helps,

Kiel

On 18/12/2008, at 1:53 PM, Jean-Nicolas Jolivet wrote:

I'm pretty sure this one is obvious but I'm just spinning around in  
circles in the docs here and I can't seem to find out how to do it...


I have a basic NSTableView binding setup in place (NSTableView's  
columns bound to an NSArrayController, which is bound to an  
NSMutableArray ...)


I'm trying to keep things simple so lets say my NSMutableArray is  
filled with custom "Person" objects that have only 2 properties:  
FirstName and LastName (the 2 columns of my NSTableView)...


Now, without doing anything (basically, just by setting my bindings  
correctly in IB) I can sort the 2 columns (FirstName and LastName)  
by clicking their headers, it works just fine (I'm guessing because  
"Create Sort Descriptors" is checked in IB)...


Now the thing is, the NSMutableArray is populated by an XML file  
that I am opening and parsing (again, no problems with that part)...  
I parse the XML file, which contains First names and Lastnames,  
create and add my "Person" objects to my array and the data is added  
to my NSTableView automatically


What I need to do then, is to sort my tableview by FirstName  
automatically and then disable sorting altogether


Basically, I am only opening XML files, the user is not allowed to  
add new rows/remove rows/etc. in the table, I only want to show the  
data, ordered alphabetically 


Now I think I can "disable" sorting by unchecking "Create Sort  
Descriptors" in IB for my 2 columns, but I can't figure out how to  
sort my table view programatically...


(Also, while I'm on the subject, does sorting the  
NSArrayController's arrangedObjects also sorts the NSMutableArray to  
which my NSArrayController is bound to??)


Thanks,

Jean-Nicolas Jolivet
silver...@videotron.ca
http://www.silverscripting.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/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: how to separate the path name from a file name

2008-12-17 Thread Kiel Gillard

Hi there,

Not too sure what you mean by "path name", but the API you'll want to  
look at could be here .


Kiel  :-)
"Violence is the last refuge of the incompetent."
Isaac Asimov, Foundation

On 17/12/2008, at 10:52 PM, wamozart wrote:

Hi, I'm writing an NSDocument class code. I would like to separate  
the path

name from a file name.
NSString *filename = [self fileName];

returns the full path and file name. How do I get the path name only?
Thanks.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Re: how to manage two nib files

2008-12-07 Thread Kiel Gillard





Hope this helps!

On 08/12/2008, at 1:47 PM, XiaoGang Li wrote:


Hi, List,

 I have a question about how to design my applicaiton in Cocoa.

 My applicaiton is not a normal application.  it is a utility  
for my
printer device. when user double-click the application icon, the  
application
first register an apple event before any UI being shown, he  
application will
receive a apple event from Mac OS later, which tells it that whether  
the
device is USB-connected or Network-connected, when the application  
get this
information, then it will launch the corresponding UI depend on the  
connect

mode. (there are two nib files, one for USB, another for Network.).

 I have no idea how to manage two nib files, or two window  
controller.

I hope soneone can give me some comments. thanks very much.

XiaogangLi
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Using a string as filepath

2008-11-26 Thread Kiel Gillard

On 27/11/2008, at 11:09 AM, Knut Lorenzen wrote:


Dear list,

I would like to name a file according to an user defined entry.  
However, the user's name entry might be illegal as a filepath,  
containing illegal characters for a pathname like "." or "-" as 1st  
character, "/", ":", etc.


I've looked into the Cocoa docs for NSString and NSFileManager to no  
avail.


Is there a recommended way to "clean" an NSString in order to get a  
valid filepath? One could simply replace all suspicious characters  
with an underscore (or something else), but that is not very elegant  
and feels like fighting the framework.


Can you use NSSavePanel? It handles all that detail for you.  
Alternatively, try using NSString's stringByAppendingPathComponent:  
method, it may validate the path component you're trying to add.


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 [EMAIL PROTECTED]


Re: Autorelease Question

2008-11-20 Thread Kiel Gillard


On 21/11/2008, at 3:45 PM, Jim Correia wrote:


On Nov 20, 2008, at 11:36 PM, Kiel Gillard wrote:


While your discovery is interesting, maybe we're not supposed to  
know how NSString is implemented. Even if on your computer you do  
not get double free messages in your run log, a crash or whatever,  
I'm all for keeping the memory management rules simple and treating  
anything that doesn't contain "alloc] init...]" or "new]" as  
autoreleased.


The memory management rules are already simple. There are three rules.

Making up your own interpretations of them, such as "treating  
anything that doesn't contain 'alloc] init]' or 'new]' as  
autoreleased", is not only incorrect, but gets in the way of a  
fundamental understanding of how things work.


On their own is incorrect but in the context of the message I was  
replying to, it was not.


What happens to an object before it is handed to you is completely  
irrelevant. It doesn't matter. Thinking about what the method might  
have done with the object is a waste of mental effort. The only  
thing which is important is whether or not you are responsible for  
releasing the object.


I totally agree.




Jim

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Autorelease Question

2008-11-20 Thread Kiel Gillard


On 21/11/2008, at 2:55 PM, Adam Leonard wrote:


I think this is a bug in the documentation. I am curious to know  
what others think.


While your discovery is interesting, maybe we're not supposed to know  
how NSString is implemented. Even if on your computer you do not get  
double free messages in your run log, a crash or whatever, I'm all for  
keeping the memory management rules simple and treating anything that  
doesn't contain "alloc] init...]" or "new]" as autoreleased.


Kiel


Adam Leonard

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Difference between "Target" and "Executable" ?

2008-11-20 Thread Kiel Gillard

On 21/11/2008, at 12:08 PM, Jean-Nicolas Jolivet wrote:


thanks you for all the information! I'm still reading 

However, this makes me think: Even though the "Executable" (in XCode  
that is) has the old name, if I look in my project directory under / 
Build/Debug or /Build/Release , my resulting app is there with the  
new name...


This is probably because you did not clean your project before you  
renamed your product name.


So does the "Executable" name has any effect on the resulting app's  
name??


Nope. The name of the "Executable" is meaningful name that should  
reflect the runtime settings of the executable, much like how a  
meaningful name of a target reflects the construction and packaging of  
the target.


Consider this example: if you had a single, multi-lingual app you  
could specify multiple executables, each of which runs the executable  
in a different language.


(Sorry if this question has been answered already, I'm still reading  
the replies!...)


No worries. Hope this helps!

Kiel





On 20-Nov-08, at 7:32 PM, Jean-Nicolas Jolivet wrote:

I just renamed my project (according to the instructions here: http://aplus.rs/cocoa/how-to-rename-project-in-xcode-3x/ 
 )


However, I noticed that the "Executable" in my project still has  
the old name... should I (and how do I) rename it to the new name?


Also, what exactly is the difference between "Targets" and  
"executables" ?? Seems like I am always editing/configuring the  
Target but never the executable...? What is the purpose of the  
executable anyway?



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Difference between "Target" and "Executable" ?

2008-11-20 Thread Kiel Gillard
Exectuables specify settings that the running executable should honour  
(for example, run-time arguments).


Targets describe how the source should be compiled, linked, packaged,  
etc. Therefore, the name of your (compiled, linked, packaged etc)  
product will be defined in the active target.


On 21/11/2008, at 11:32 AM, Jean-Nicolas Jolivet wrote:

I just renamed my project (according to the instructions here: http://aplus.rs/cocoa/how-to-rename-project-in-xcode-3x/ 
 )


However, I noticed that the "Executable" in my project still has the  
old name... should I (and how do I) rename it to the new name?


Also, what exactly is the difference between "Targets" and  
"executables" ?? Seems like I am always editing/configuring the  
Target but never the executable...? What is the purpose of the  
executable anyway?



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: deep deep copies, or shallow deep copies?

2008-11-13 Thread Kiel Gillard

Hi Graham,

If you do want a deep copy of a collection, check out . NSPropertyListSerialization would be the Cocoa equivalent of this  
API.


Kiel

On 14/11/2008, at 11:07 AM, Ken Ferry wrote:

On Thu, Nov 13, 2008 at 3:58 PM, Graham Cox <[EMAIL PROTECTED]>  
wrote:

Does anyone know whether methods such as:

[NSArray initWithArray: copyItems:YES];

continue to deep-copy items for further collections within the root
collection, or do they fall back to a shallow copy (retaining)?

If no-one knows I can spend an hour or two doing some experiments  
but if

it's just a known 'yes' or 'no' I'd rather save the time!


It will send the -copy method to each of the items in the array, and
insert the resulting copies into the new array.

So, context specific.  If the items are Cocoa collections, that means
shallow copies of items.

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: When and how often do you mix C++ with Objective C in your project?

2008-10-30 Thread Kiel Gillard

On 31/10/2008, at 10:33 AM, Boon Chew wrote:


Hi all,

I am a newbie to the cocoa world (PC -> Mac switcher).  I have a  
fair amount of experience coding in C and C++ and I am just getting  
into Obj C now.  Right now I am trying to learn the language idioms  
and patterns in the Obj C world, specifically, when do you find  
yourself mixing C++ code with your Obj C code in your project?  How  
often do you do that? What's the pros and cons of doing that?


- boon


Welcome to Cocoa with Objective-C!

Any new code I write I always used Objective-C. If I need to mix C++,  
it's usually because there is some legacy code that I need to support.  
This happens rarely.


I guess some pros are code reuse and enforcing structured/modular  
design (for example, I could write my model layer in C++ and write the  
controller and view layers in Objective-C using Cocoa). I would  
suspect some cons could be slightly slower compile times, inconsistent  
coding styles (alternating between similar yet slightly different  
languages) and missing out on some of the sweet features of Cocoa that  
Objective-C allows it to implement (key value coding, for example).


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 [EMAIL PROTECTED]


Re: Hud window controls

2008-10-23 Thread Kiel Gillard
This framework looks pretty good too 


Kiel

On 24/10/2008, at 3:06 AM, I. Savant wrote:

On Thu, Oct 23, 2008 at 11:52 AM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:


I am trying to design a HUD window, but the controls (buttons, edit  
boxes)

don't fit color wise, is there a property i should set
to have them look like the hud window?


 There are no properties available to control this (they're all
Apple's own custom stuff), but there is this:

http://lipidity.com/apple/ilife-controls-hud-windows-and-more

 It looks alright but I haven't tried it personally.

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: /Library/Logs vs. user/Library/Logs

2008-10-22 Thread Kiel Gillard

Hi Chris and welcome to Mac OS X development,

The only helpful suggestion I can think of is to have a read of the  
following document: 


It *may* help you determine where you want to store your log files. My  
two cents would be to put log files in the ~/Library/Logs folder. The  
user running your application is more likely to have permission to  
write files in that folder.


Good luck,

Kiel

On 23/10/2008, at 4:34 PM, Chris Markle wrote:


New to OS X development here... I see some things log to /Library/Logs
and others to user/Library/Logs (user=an individual account). I'm
thinking my app, which is a user-oriented app (not a system app) would
log to the user-specific location. Unless it's bad form to log there
and there is some other, more acceptable, best practice with respect
to log file location. So... is there a best practice? Is is documented
anywhere in Apple doc? Where should I go to read about accepted usage
of the /Library and user/Library directories and the files therein?
Thanks in advance. Chris
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: CGPoint wrapper?

2008-10-22 Thread Kiel Gillard

Use NSValue's valueWithPoint class method.

Kiel

On 23/10/2008, at 1:06 PM, DKJ wrote:


I've just found NSPointFromCGPoint() etc,.



On 22 Oct, 2008, at 18:49, DKJ wrote:

Is there some straightforward way of wrapping a CGPoint so I can  
put it in an NSArray? I don't want to use a C array because I want  
to have fast enumeration available. Or should I just write a simple  
NSPoint - CGPoint conversion method?


dkj
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hatzicware%40shaw.ca

This email sent to [EMAIL PROTECTED]



Hatzic Intellectual Software
Victoria BC, Canada
www.hatzicware.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/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Creating Toolbar Items in IB

2008-10-22 Thread Kiel Gillard

On 23/10/2008, at 12:33 PM, Quincey Morris wrote:


On Oct 22, 2008, at 17:39, Graham Cox wrote:

I can place a toolbar in my window, and I can add items to it. I  
can set the delegate outlet of the toolbar to my document controller.


What I can't do is to tie any outlets to the toolbar items or set  
any actions or targets for the items. IB's interface doesn't even  
let me select the items individually, and I cannot assign my own  
identifiers to them.


At runtime, when the nib is loaded, the pre-installed items are  
there but they have been assigned identifiers which are UUID  
strings. My delegate gets called and I can add additional custom  
items just as I would if I were doing it all in code, but for the  
nib-supplied items, I get nothing. Since the identifiers are  
assigned UUIDs somewhere there's no way to know what identifier to  
use to retrieve an item from the bar and fix up its target/action.


The whole ability to set up toolbars in IB appears to be useless to  
me.


So before I ditch it all and go back to doing it the harder-but- 
saner way, can anyone point me in the direction of something that  
will help me make any sense of this?


The identifier thing is annoying. There isn't any way to set your  
own. The best alternative seems to be to create an outlet for each  
toolbar item you need to refer to in code, and hook them up in IB.  
Then you can extract the identifier via the outlet if you need it.


You could implement NSToolbar's toolbarWillAddItem: delegate method,  
for example, and build a collection of toolbar items.


The toolbar that IB shows you in its owner window is actually the  
default set of items, and you can't select them individually there.  
To get the full set of items, you click on the toolbar once to  
select it, then again so that the "allowed items" sheet slides out,  
and you can select individual items in that sheet. Click once to  
select the toolbar item, click again to select the underlying control.


There were some bugs in IB's toolbar handling, where it wouldn't  
save the toolbar after you changed it. I'm not sure if that bug is  
still in the shipping 3.1 version. (The only workaround I found was  
to put a separator item at the beginning and the end of the toolbar.  
Then it seemed to save OK.)


HTH


The bug seems to be there still.

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 [EMAIL PROTECTED]


Re: Unregistered weak referrer

2008-10-22 Thread Kiel Gillard
I don't have much experience with GC, so I'd suggest you check out <http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcUsing.html#//apple_ref/doc/uid/TP40008006-SW3 
> or wait until someone with some experience in GC can help you out.


GC keeps tabs on all your instances of classes, smells like it's  
object graph has been messed up somehow.


Sorry I can't be more help.

On 23/10/2008, at 10:48 AM, Ross Carter wrote:

Yes, GC is enabled. I get the message when I remove a subview from a  
NSScrollView's documentView. The removed subview contains 3  
NSTextViews, 2 of which have their own layoutManager and  
textStorage. A lot of code fires at that time. Without knowing what  
"unregistered weak referrer" means, or how to find what the  
offending object is, it's hard to know where to start.



On Oct 22, 2008, at 7:35 PM, Kiel Gillard wrote:


Do you have garbage collection enabled? Can you give us any hints  
as to why you'd be getting that message?


Kiel

On 23/10/2008, at 10:31 AM, Ross Carter wrote:


What does this console message mean?

malloc: auto malloc[542]: attempted to remove unregistered weak  
referrer 0x128538c


___

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 [EMAIL PROTECTED]


Re: Unregistered weak referrer

2008-10-22 Thread Kiel Gillard

Hi Ross,

Do you have garbage collection enabled? Can you give us any hints as  
to why you'd be getting that message?


Kiel

On 23/10/2008, at 10:31 AM, Ross Carter wrote:


What does this console message mean?

malloc: auto malloc[542]: attempted to remove unregistered weak  
referrer 0x128538c

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: [OT] How do people use and contribute to this list?

2008-10-19 Thread Kiel Gillard
Thanks for the replies all, these are helpful suggestions.

Kiel

On Mon, Oct 20, 2008 at 12:12 PM, Nathan <[EMAIL PROTECTED]> wrote:
> The easiest thing to do is just set up a smartbox, except that it sorts, it
> doesn't move the messages. Set up a rule and mailbox, to simply move all
> cocoalist messages there. Also, don't receive in digest mode. You'll get
> more messages, but it's easier to find old topics you're looking for then. I
> rarely post, but I haven't deleted any so I now have a huge collection of
> searchable questions and multiple answers for all sorts of problems.
> Nate
>
> On Oct 19, 2008, at 20:32, Kiel Gillard <[EMAIL PROTECTED]> wrote:
>
>> Hi all,
>>
>> I subscribe to the cocoa-dev list RSS feed instead of receiving
>> individual or digest emails. I find this approach is a fast and
>> convenient method to scan the topics, examine individual messages and
>> receive regular updates to the cocoa-dev's content without flooding my
>> inbox. In contrast, if I choose to use the digest mode, I have to
>> scroll or search digests for particular topics and delete digest
>> messages once I'm done with them, which is obviously more tedious.
>> Using an RSS feed reader, it can automatically check for new content
>> and with a keystroke investigate or dismiss content. Given that I read
>> the list more than I contribute to it, I prefer using the RSS feed.
>>
>> However the RSS feed approach carries two problems. Firstly, I cannot
>> reply to individuals off-list because their email addresses are
>> censored. Finally, my contributions become tedious to compose as I
>> have to copy and paste relevant information such as previous messages
>> and subject headers into the new reply.
>>
>> Can anyone offer any advice or suggestions? Or should I settle for the
>> cumbersome digest mode?
>>
>> Thanks,
>>
>> Kiel Gillard
>> ___
>>
>> 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/lipton_lover%40mac.com
>>
>> This email sent to [EMAIL PROTECTED]
>
___

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 [EMAIL PROTECTED]


Re: [OT] How do people use and contribute to this list?

2008-10-19 Thread Kiel Gillard
On Mon, Oct 20, 2008 at 11:47 AM, Rob Keniger <[EMAIL PROTECTED]> wrote:
>
> On 20/10/2008, at 10:32 AM, Kiel Gillard wrote:
>
>> Can anyone offer any advice or suggestions? Or should I settle for the
>> cumbersome digest mode?
>
>
> Why not just create a mail folder and add a rule to move Cocoa-Dev messages
> to it? This is standard procedure AFAIK.

Thanks for your reply, Rob. However, I still have to scroll or search
digests for particular topics and delete digest messages once I'm done
with them, which is obviously more tedious and involved than just
hitting space bar in NetNewsWire, for example. Filtering cocoa-dev
messages doesn't enable me to quickly scan and identify threads I
would like to contribute to like the RSS feed allows me to.

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 [EMAIL PROTECTED]


[OT] How do people use and contribute to this list?

2008-10-19 Thread Kiel Gillard
Hi all,

I subscribe to the cocoa-dev list RSS feed instead of receiving
individual or digest emails. I find this approach is a fast and
convenient method to scan the topics, examine individual messages and
receive regular updates to the cocoa-dev's content without flooding my
inbox. In contrast, if I choose to use the digest mode, I have to
scroll or search digests for particular topics and delete digest
messages once I'm done with them, which is obviously more tedious.
Using an RSS feed reader, it can automatically check for new content
and with a keystroke investigate or dismiss content. Given that I read
the list more than I contribute to it, I prefer using the RSS feed.

However the RSS feed approach carries two problems. Firstly, I cannot
reply to individuals off-list because their email addresses are
censored. Finally, my contributions become tedious to compose as I
have to copy and paste relevant information such as previous messages
and subject headers into the new reply.

Can anyone offer any advice or suggestions? Or should I settle for the
cumbersome digest mode?

Thanks,

Kiel Gillard
___

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 [EMAIL PROTECTED]


Re: How to call functions of a C dylib on a C++ dylib

2008-09-18 Thread Kiel Gillard
Howdy,

I think the following syntax is the right idea:

extern "C" { extern void MyFunction(void *args);
}

However, because it is insanely late, I may be wrong. If you have a look at
the headers for Apple's frameworks (eg: one of the Core Foundation headers)
you'll see how you should do it.

Hope this helps,

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 [EMAIL PROTECTED]


Re: Newbie question re Xcode on Leopard

2008-08-21 Thread Kiel Gillard
Hi Paul,

Hope you're enjoying Cocoa ;-)

As you probably noticed, the Classes tab has been removed in Interface
Builder 3 (the Leopard Interface Builder). The projects header files are
automagically synced with the xib. To instansiate your custom class;
1) Drag an Object (plain blue cube) from the Library panel into your xib.
2) Select the Object instance you dropped from the palette.
3) Choose from the menu bar Tools > Identity Inspector.
4) In the Class combo box, begin typing the name of your custom class (that
is, "AppController").

If the project's header files are synced with the xib properly, Interface
Builder 3 should guess the untyped portion of AppController.

Hope this helps,

Kiel

You wrote:

Hi--

I'm working my through the Cocoa II lesson at:
http://www.cocoadevcentral.com/d/learn_cocoa_two/

This lesson was originally written for Tiger, and has not yet been updated
for Leopard.

My question: Halfway through the lesson, after creating the AppController.h
and AppController.m files, I'm at the Add Header to NIB (section 12). At the
top of the lesson, the writer explains that the new class is added
automatically to the MainMenu.xib without having to be dragged from Xcode to
IB.

But I don't see it.

How do I find the new class in IB?

Thanks!

-- 
Paul Denlinger
___

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 [EMAIL PROTECTED]


Re: Calling an object from a C function

2008-08-19 Thread Kiel Gillard
Hi Charlie,
The format is like any normal C function.

int MyStaticCFunction(int someArg) {

//invoke myMethod and return the int the myMethod returns
return [objcObject myMethod:someArg];
}

You wrote:

What is the syntax? For example, how do I invoke the method

- (int) myMethod: (int) int;

In object myObject

from within a C (not Objective C) function and make use of the result?


There are no Objective-C functions. Only C functions. There are Objective-C
methods.

In Objective C I would invoke

[myObject myMethod: myInt];

Even better, how do I invoke

- (myObject) myMethod: (myObject *) myObjectArg;

an make use of the result in a C function?


MyObject * MyStaticCFunction(MyObject *myObjectArg) {

//assuming MyObject is an Objective C instance
[myObjectArg myMethod:myObjectArg];
return myObjectArg;
}

Hope this helps,

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 [EMAIL PROTECTED]


Framework and NSApplication

2008-08-07 Thread Kiel Gillard
@synthesize greeting;

I'm writing a Cocoa framework that links with an old Carbon application. The
Carbon application indirectly interacts with it through a wrapper framework.
Within the Cocoa framework, I want to observe the
NSApplicationWillTerminateNotification notification, posted by the
NSApplication to the default NSNotificationCenter. However, my method does
not seem to be invoked.

Figuring there was some incompatibility with NSApplication and the fact the
framework is being dynamically linked to an old Carbon application, I
installed a Carbon event handler for the application quitting. The callback
does not seem be invoked by the Carbon Event Manager.

Any suggestions as to how I could code the framework to notice when the
application it's linked to is quitting?

Thanks,

Kiel

PS: Sorry, I couldn't resist the nerdy salutation ;-)
___

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 [EMAIL PROTECTED]


Re: Basic question on /Library/Application Support

2008-07-22 Thread Kiel Gillard
Hi John,

If you use Carbon, you can use FSFindFolder() to find the application
support folder and have Carbon create it for you by passing kCreateFolder as
an argument. However, if you are using Cocoa, I'm not sure
if NSSearchPathForDirectoriesInDomains() creates folders when you search for
a path, as this is not obvious in the documentation. I would imagine it
would, but I would double check that this is the case. I also would not be
sure if that is a consistent behaviour among releases of Mac OS X, either.
Ideas, anyone else?

Hope this helps,

Kiel

You wrote:

Hello,

A generic install of Leopard produces a file system with NO
/Library/Application Support directory.

Is this directory something that is created by an Xcode install?

John F. Richardson
___

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 [EMAIL PROTECTED]


Attributed menu titles

2008-07-09 Thread Kiel Gillard
Hi all,
I have a menu of items whose titles are attributed strings. I have specified
custom colours for parts of those strings. The documentation reads:

If you do not set a text color for the attributed string, it is black when
not selected, white when selected, and gray when disabled. Colored text
remains unchanged when selected.

Is there some way to provide a colour for the NSMenuItem's attributedTitle
when the item is selected or disabled? For example, is there some key I can
set in an attributes dictionary that allows me to specify a colour to use
when either of these cases occurs? Have I overlooked or missed something in
the documentation?

Thanks,

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 [EMAIL PROTECTED]


NSTableView problems when 0 items

2008-06-15 Thread Kiel Gillard
Howdy,
Are there any messages in your Run Log or in Console that might help you
figure out the problem? Can you verify the table data source method
implementations are returning the right values?

Kiel

I have an NSTableView object and an NSPopUpButton that I use to select a
> category of information to display in the table...
>

The problem is this:


If I select a category with 0 items in it, the table view will update as
expected... but, if I select one with more than one item right afterwards,
the entire list does not display right away. Instead, it updates row by row
when I select it.


I AM sending it a [nameOfTable reloadData] message, and it IS getting that
information it needs to be getting... but I cannot figure out why it's doing
this!


To see what I mean, click here: http://www.gooblidood.com/temp/weird.mp4


Anyone have any idea how to fix this stupid problem? Any help would be
greatly appreciated!
___

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 [EMAIL PROTECTED]


Re: Making use of a static library?

2008-06-11 Thread Kiel Gillard
Hi Graham,
In my experience, this warning generally does mean that there is something
wrong in the build target settings for either the static library or the
application including the library.

Until I know more, this is the only thing I can suggest. Assuming you are
using Xcode for the project of your static library, double check the
architecture build settings. I personally find the best way to eliminate
architecture compile and link problems is to revert the architecture build
settings to their defaults (that is, by selecting the "Architecture" and
"Valid Architectures" build settings in the project and target build
settings and pressing the delete key). The default architecture settings
should be fine in most cases. In addition, ensure that you are modifying the
build settings for all configurations, instead of a specific configuration.
Finally, it may be beneficial to check the build settings for the Cocoa
application's project and target, see if it's not trying to link a x86
binary with a PPC binary or something weird like that.

Hope this is some sort of help,

Kiel


Hi all,
>

This is not directly a Cocoa question, but I hope someone will know the
answer to saving me jumping through all the hoops needed to join another
list.


I have a project which builds a static library from some pure C code. I want
to use this library in another Cocoa project. I've set up the cross-project
dependency and included the .a file in the Cocoa project. When the Cocoa
project builds it complains (warning) that the library "file is not of
required architecture". Is this referring to whether it's
PPC/i386/universal? In the library project, the architecture build setting
only offers me 32 bit or 64 bit, not i386/ PPC.


What does the warning really mean and how should I fix it?



tia,



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 [EMAIL PROTECTED]


  1   2   >