Re: sending continues NSImage data to iPhone

2009-05-29 Thread Andrew Farmer

On 28 May 2009, at 06:31, sheen mac wrote:
I am doing a screen sharing app for iPhone and Mac.I captured the  
Mac Screen as NSImage using OpenGL and send it to iPod as Gif data.  
But sending and restoring to UIImage process make delay because of  
Image size.The image size of capture is 320 x 388.

Is any better way available for compressing the Image data?.


Yes, there are a number of better compression algorithms out there.  
(See [1] for a comprehensive list.) However, you will find it  
impossible to write a screen sharing application which works in the  
way you're proposing - in order to make it use a reasonable amount of  
bandwidth, you'll need to limit it to transferring changing regions of  
the screen, rather than the whole thing every time. You can do this  
using the Quartz Display Services API (CGRegisterScreenRefreshCallback  
et. al).


You may also want to look at the Quartz Window Services (CGWindow) API  
for taking screenshots. It's supposed to be considerably faster than  
the old OpenGL method, as well as more flexible.


[1]: http://en.wikipedia.org/wiki/Comparison_of_graphics_file_formats
___

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

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

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

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


Custom view attached to a menu bar NSStatusItem application

2009-05-29 Thread John Ku
How do I proceed in creating a custom view/window that is attached and act
like an NSMenu for a NSStatusItem.So when the menu bar icon is clicked, this
custom view/window will appear right underneath the NSStatusItem.

So far im thinking to start with a custom NSWindow and an NSView inside
that. Then I'll bring front, make key that custom NSWindow with local
coordinates within NSStatusItem. Does this work?  Or is drawing inside
NSStatusItem will only be limited in the height of the menu bar?

Any alternatives? What direction should I look into? Much Appreciated!

John
___

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

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

Help/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: Custom view attached to a menu bar NSStatusItem application

2009-05-29 Thread Seth Willits

On May 29, 2009, at 12:46 AM, John Ku wrote:


Any alternatives? What direction should I look into? Much Appreciated!


How about creating a menu item and using setView: ?



--
Seth Willits



___

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

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

Help/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: Custom view attached to a menu bar NSStatusItem application

2009-05-29 Thread John Ku
Ah, but that just sets a customView for that particular menu item correct?Im
trying to built a full pop up menu from scratch. Im looking to change the
menu borders, background, add buttons, drop down lists, etc. Its actually
less of a menu in terms of function, more of a pop up window that acts like
a menu and attaches underneath the icon on the menu bar.

If I subclass NSMenu, is there a way to draw my own background, border, add
custom buttons on this Menu?


On Fri, May 29, 2009 at 1:20 AM, Seth Willits  wrote:

> On May 29, 2009, at 12:46 AM, John Ku wrote:
>
>  Any alternatives? What direction should I look into? Much Appreciated!
>>
>
> How about creating a menu item and using setView: ?
>
>
>
> --
> Seth Willits
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/john.cmyk%40gmail.com
>
> This email sent to john.c...@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


Rearrange items on NSToolbar

2009-05-29 Thread Nikhil Khandelwal
Hi,

Is it possible to rearrange items in customize toolbar ?
I want to change the order of NSToolbarItem in NSToolbar.

Thanks,
Nikhil

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

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

Help/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: Custom view attached to a menu bar NSStatusItem application

2009-05-29 Thread Cocoa Dev


I think what you want is something like MAAttachedWindow which can be  
found at http://mattgemmell.com/source.


HTH,
Tim

29 maj 2009 kl. 10.37 skrev John Ku:

Ah, but that just sets a customView for that particular menu item  
correct?Im
trying to built a full pop up menu from scratch. Im looking to  
change the
menu borders, background, add buttons, drop down lists, etc. Its  
actually
less of a menu in terms of function, more of a pop up window that  
acts like

a menu and attaches underneath the icon on the menu bar.

If I subclass NSMenu, is there a way to draw my own background,  
border, add

custom buttons on this Menu?



___

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

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

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

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


Re: Performance, Efficiency - Coding practice

2009-05-29 Thread Alexander Spohr


Am 29.05.2009 um 02:55 schrieb John Ku:

And yeah, NSMutableString will be initialized else where and  
released later.


Why use a mutable string at all? Just retain the new string and dump  
the old one.


Use
@property (retain) NSString *title;
@synthesize title;
and be done with it.

atze

___

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

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

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

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


Re: Performance, Efficiency - Coding practice

2009-05-29 Thread Jean-Daniel Dupas


Le 29 mai 09 à 11:31, Alexander Spohr a écrit :



Am 29.05.2009 um 02:55 schrieb John Ku:

And yeah, NSMutableString will be initialized else where and  
released later.


Why use a mutable string at all? Just retain the new string and dump  
the old one.


Use
@property (retain) NSString *title;
@synthesize title;
and be done with it.


Copying it is even better as it will prevent strange side effect you  
can have if you affect a mutable string to the property (and it is a  
fast as retaining if you use immutable strings).


@property (copy) NSString *title;


___

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

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

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

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


[Core Data] mergeChangesFromContextDidSaveNotification: and thread safety

2009-05-29 Thread Aurélien Hugelé

Hi !

I'm having strange crashes in my threaded core data application. Happy  
WWDC is in few days!


Core Data multithreading basic rule is to avoid passing managed  
objects across threads, and pass objectIDs instead.


To "synchronize" 2 mocs from 2 different threads (sharing the same  
psc), I use mergeChangesFromContextDidSaveNotification:. As Apple  
demonstrate in the documentation, I use performSelectorInMainThread:  
since I just want to synchronize my main moc, in the main thread, with  
inserted objects, created in a second moc, in a subthread. So there is  
no need to lock.


But the mergeChangesFromContextDidSaveNotification: method uses the  
notification as an argument, and the userInfo of this notification  
contains managed objects, not objectIDs! Managed objects are then  
passed from sub thread to mainthread...


Isn't it a violation of the basic rule described below?


Aurélien,
Objective Decision Team




___

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

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

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

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


Re: Binding to two values

2009-05-29 Thread Clint Shryock
I think the best way I can think of would be to have an object act as an
intermediate for this, which contains an aggregate array that
table3controller is bound to.
In this object define observers for tableview1controller and
tableview2controller's selection property, so that this object receives KVO
notifications when they change. In the observing method
(observeValueForKeyPath:ofObject:change:context:) do whatever logic you need
to do to based on the new selections, and update the aggregate array, making
sure to do so in a KVO Compliant way so the 3rd controller observes the
change and updates it's content accordingly.

+Clint

On Thu, May 28, 2009 at 12:30 PM, Kelvin Chung  wrote:

> I'm not sure the best way to do this, but suppose I have two
> NSArrayControllers, tableView1Controller and tableView2Controller.  Now
> suppose I have an NSArrayController, table3Controller.
>
> What I am trying to do is to have it so that table3Controller's Content
> Array binding depend on both tableView1Controller.selection and
> tableView2Controller.selection (an NSValueTransformer will then transform
> this into an NSArray).  Clearly, I can't bind to both unless I somehow
> aggregate the two together.  What is the best way to do that?
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cts3e1%40gmail.com
>
> This email sent to cts...@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: Recommendations to Reading the Xcode in built Documentation to the fullest effect

2009-05-29 Thread colo
Oooo! AppKiDo will do. Who cares about polish. As long as it finds
data fast is the goal.

Thank you all. This has helped a ton.

On Thu, May 28, 2009 at 11:24 PM, Kevin LaCoste  wrote:
> The fact that AppKiDo isn't built in is one of the reasons I like it. When
> you update your docs in Xcode's built-in browser a relaunch of AppKiDo will
> cause it to pick up the changes.
>
> Agreed on the loading delay. That's annoying. And it's pretty weak on the
> polish side. It does display inherited methods but they're all mixed
> together under ALL Instance Methods. Splitting this further into Inherited
> from NSObject, Inherited from NSResponder, etc, would be a very nice feature
> addition.
>
> Kevin
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/colo0logo%40gmail.com
>
> This email sent to colo0l...@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


How to set horizontal scroller for NSTextView?

2009-05-29 Thread archana udupa
Hi list...
  I m new to cocoa. I ve a NSTextview, for which i ve set a
scrollerview. I can scroll it vertically.But i wanted to scroll it
horizontally also. I  ve used [NSTextView
setHasHorizontalScroller:YES]; But i m wondering why its not
workingPlease help me..:(

-- 
With Regards,
  -
  Archiez...:0)
___

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

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

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

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


Apple Remote remove left and right hold events

2009-05-29 Thread Mr. Gecko
Hello, I'm trying to find out how to tell the apple remote to not do  
hold events for the left and right buttons. Is this Possible? If so  
how do I do it?


Thanks,
Mr. Gecko
___

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

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

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

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


Message from view to viewController

2009-05-29 Thread Pierre Berloquin
Hi
I have a MyAppViewController that creates a set of views and that works
fine. They are displayed and animated.

I want to know in the view controller when one of the views is touched and
work on it.
For that I have in the uiview class :

- (void) touchesBegan: (NSSet *)touches withEvent:(UIEvent *)event {

[MyAppViewController manageMyViews:self];

}
and in the viewController.m :

-(void)manageMyViews:(id)sender {


}

duly mentionned in viewController.h
But I get an error :
duplicate symbol .objc_class_name_MyAppViewController

What am I doing wrong ?
Thanks
Pierre
___

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

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

Help/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: Message from view to viewController

2009-05-29 Thread Nick Zitzmann


On May 29, 2009, at 9:39 AM, Pierre Berloquin wrote:


But I get an error :
duplicate symbol .objc_class_name_MyAppViewController

What am I doing wrong ?



You're building the class "MyAppViewController" twice for some reason.  
Did you accidentally #import a .m file anywhere, or leave an  
implementation in a header file?


Nick Zitzmann


___

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

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

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

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


Re: Message from view to viewController

2009-05-29 Thread Pierre Berloquin
Yes, I did import too many times, but that was in a desperate attempt to
import enough!I corrected that and now I have my original error :
MyAppViewController may not respond to +manageMyViews
which blocks the program

Thanks

2009/5/29 Nick Zitzmann 

>
> On May 29, 2009, at 9:39 AM, Pierre Berloquin wrote:
>
>  But I get an error :
>> duplicate symbol .objc_class_name_MyAppViewController
>>
>> What am I doing wrong ?
>>
>
>
> You're building the class "MyAppViewController" twice for some reason. Did
> you accidentally #import a .m file anywhere, or leave an implementation in a
> header file?
>
> Nick Zitzmann
> 
>
>
___

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

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

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

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


how to set horizontal scroller for NSTextView?

2009-05-29 Thread archana udupa
Hi list...
 I m new to cocoa. I ve a NSTextview, for which i ve set a
scrollerview. I can scroll it vertically.But i wanted to scroll it
horizontally also. I  ve used [NSScrollView
setHasHorizontalScroller:YES]; But i m wondering why its not
workingPlease help me..:(

--
-- 
With Regards,
  -
  Archiez...:0)
___

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

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

Help/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: Message from view to viewController

2009-05-29 Thread Scott Ribe
> Yes, I did import too many times, but that was in a desperate attempt to
> import enough!I corrected that and now I have my original error :
> MyAppViewController may not respond to +manageMyViews
> which blocks the program

So you're not importing MyAppViewController.h? You need to learn the
difference between declaration (.h) and implementation (.m).

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


___

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

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

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

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


Re: Message from view to viewController

2009-05-29 Thread Jason Foreman
On Fri, May 29, 2009 at 11:18 AM, Pierre Berloquin  wrote:
> Yes, I did import too many times, but that was in a desperate attempt to
> import enough!I corrected that and now I have my original error :
> MyAppViewController may not respond to +manageMyViews
> which blocks the program
>

You've defined manageMyViews as an instance method:

- (void)manageMyViews:(id)sender {

but you're trying to call it as a class method:

[MyAppViewController manageMyViews]

Notice in the warning you get "MyAppViewController may not respond to
+manageMyViews".  The '+' there means it is trying to call that as a
class method.  You need to create an instance of MyAppViewController
somewhere, and call that method on the instance, or redefine the
method to be a class method.

You may also not have declared that MyAppViewController responds to
manageMyViews in the header file.


Jason
___

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

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

Help/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: Message from view to viewController

2009-05-29 Thread Pierre Berloquin
No I'm not that innocent. I do import the .h . My program is already
complex, with several classes working together ok. Only this message problem
blocks me.

2009/5/29 Scott Ribe 

> > Yes, I did import too many times, but that was in a desperate attempt to
> > import enough!I corrected that and now I have my original error :
> > MyAppViewController may not respond to +manageMyViews
> > which blocks the program
>
> So you're not importing MyAppViewController.h? You need to learn the
> difference between declaration (.h) and implementation (.m).
>
> --
> Scott Ribe
> scott_r...@killerbytes.com
> http://www.killerbytes.com/
> (303) 722-0567 voice
>
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

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

Help/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 set horizontal scroller for NSTextView?

2009-05-29 Thread Jason Foreman
On Fri, May 29, 2009 at 11:20 AM, archana udupa  wrote:
> Hi list...
>  I m new to cocoa. I ve a NSTextview, for which i ve set a
> scrollerview. I can scroll it vertically.But i wanted to scroll it
> horizontally also. I  ve used [NSScrollView
> setHasHorizontalScroller:YES]; But i m wondering why its not
> workingPlease help me..:(





Jason
___

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

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

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

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


Table column resizing overlaps the text with other column contents

2009-05-29 Thread Arun
Hi All,

I have a application in which i display application names along with an
image in a table column. Also i display their versions in another column.
I have used custom ImageAndText cell for the first column and
NSTextFieldCell fro the second column.
If i resize the second column, then the contents automatically gets
truncated with (...) appearing in the end. But if i re-size the first
column, the contents of the first column overlaps with the second. How to
truncate the contents of the ImageAndTextCell?

Thanks
Arun KA
___

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

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

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

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


Re: Table column resizing overlaps the text with other column contents

2009-05-29 Thread Corbin Dunn


On May 29, 2009, at 10:00 AM, Arun wrote:


Hi All,

I have a application in which i display application names along with  
an
image in a table column. Also i display their versions in another  
column.

I have used custom ImageAndText cell for the first column and
NSTextFieldCell fro the second column.
If i resize the second column, then the contents automatically gets
truncated with (...) appearing in the end. But if i re-size the first
column, the contents of the first column overlaps with the second.  
How to

truncate the contents of the ImageAndTextCell?


Your cell is drawing outside its frame that it was given in drawRect:.

A proper implementation is shown in the PhotoSearch example.

http://developer.apple.com/samplecode/PhotoSearch/

And, we will discuss stuff like this at WWDC ( http://developer.apple.com/wwdc/sessions/#session=110 
 ).


corbin


___

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

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

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

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


Re: Message from view to viewController

2009-05-29 Thread Scott Ribe
> No I'm not that innocent. I do import the .h . My program is already complex,
> with several classes working together ok. Only this message problem blocks me.

Well then, my second guess would be one of those frustrating typos that you
don't see even though you've looked at the identifiers several times.


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


___

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

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

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

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


Re: Rearrange items on NSToolbar

2009-05-29 Thread Peter Ammon


On May 29, 2009, at 1:41 AM, Nikhil Khandelwal wrote:


Hi,

Is it possible to rearrange items in customize toolbar ?
I want to change the order of NSToolbarItem in NSToolbar.

Thanks,
Nikhil


Hello Nikhil,

The order of the items in the toolbar is determined by the order of  
the item identifiers in toolbarDefaultItemIdentifiers, or the order  
that the user gives them by dragging.


-Peter
___

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

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

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

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


Help needed with setting autoresizing masks

2009-05-29 Thread WT

Hello list,

I've been scratching my head for a few hours already trying to get the  
autoresizing masks set correctly for the following situation, with no  
luck, and would greatly appreciate some help.


I have a view containing two labels, labelA and labelB, horizontally  
laid out in sequence, like this:


|..|labelA||labelB|..|

The outermost bars represent the edges of the view, and the labels are  
inset by a fixed amount. The dots represent empty space.


When the user taps on the view, both labels slide inwards to provide  
space for two buttons, so the final position should look like this:


|..|btnA|..|labelA||LabelB|..|btnB|..|

I've already gotten all the code working correctly (I checked the math  
in general and with specific examples), the animated sliding works,  
and it's all great - except that labelB is intersecting btnB. At first  
I thought this was an error in my code or in the math, but that isn't  
it. The problem is with the autoresizing masks. I verified that by NOT  
changing the position of labelB in code and noticing that it still  
moves.


Of course, I could hack a solution by figuring out the extra  
horizontal displacement and subtracting that amount from the final x  
coordinate of labelB, but I'd rather get it right just by setting the  
right autoresizing masks.


I also tried turning off the "autoresize subviews" option in IB for  
the container view (and all 4 elements, not that that should matter),  
in the hopes that that would work since I compute the correct  
coordinates for all elements myself. Yet, it still didn't work.


You can see some pictures of the situation here:

http://www.restlessbrain.com/auto_res_mask/before_tap.png
http://www.restlessbrain.com/auto_res_mask/after_tap.png
http://www.restlessbrain.com/auto_res_mask/cell_on_IB.png
http://www.restlessbrain.com/auto_res_mask/mask.png

The mask picture applies to all labels on the other pictures.

Any help is appreciated.

Thanks!
Wagner
___

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

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

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

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


NSURLRequest- setHTTPMethod to REPORT

2009-05-29 Thread Chris Purcell

Hello,

I'm trying to issue a "REPORT" request to a server, the HTTP Method  
header needs to look like this:


REPORT /bernard/work/ HTTP/1.1

So I use setHTTPMethod to set the HTTP Method: [theRequest  
setHTTPMethod:@"REPORT /bernard/work/"];


But when I issue the request, the server returns an error, because  
there is an extra / in the request line:


Bad request line: REPORT bernard/work/ / HTTP/1.1



Am I doing this the wrong way or is this not possible?

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/archive%40mail-archive.com

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


Re: NSURLRequest- setHTTPMethod to REPORT

2009-05-29 Thread Jason Foreman
On Fri, May 29, 2009 at 4:10 PM, Chris Purcell  wrote:
> Hello,
>
> I'm trying to issue a "REPORT" request to a server, the HTTP Method header
> needs to look like this:
>
> REPORT /bernard/work/ HTTP/1.1
>
> So I use setHTTPMethod to set the HTTP Method: [theRequest
> setHTTPMethod:@"REPORT /bernard/work/"];
>
> But when I issue the request, the server returns an error, because there is
> an extra / in the request line:
>
> Bad request line: REPORT bernard/work/ / HTTP/1.1
>
>
>
> Am I doing this the wrong way or is this not possible?
>

You are doing it wrong, but you are close.  The method is only
"REPORT", so you should just:

[req setHTTPMethod:@"REPORT"]

The "/bernard/work/" piece should be part of the NSURL you use to
initialize your request.


Jason
___

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

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

Help/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] mergeChangesFromContextDidSaveNotification: and thread safety

2009-05-29 Thread Ben Trumbull


On May 29, 2009, at 2:49 AM, Aurélien Hugelé wrote:

Core Data multithreading basic rule is to avoid passing managed  
objects across threads, and pass objectIDs instead.


yup.

To "synchronize" 2 mocs from 2 different threads (sharing the same  
psc), I use mergeChangesFromContextDidSaveNotification:. As Apple  
demonstrate in the documentation, I use performSelectorInMainThread:  
since I just want to synchronize my main moc, in the main thread,  
with inserted objects, created in a second moc, in a subthread. So  
there is no need to lock.


Ok.

But the mergeChangesFromContextDidSaveNotification: method uses the  
notification as an argument, and the userInfo of this notification  
contains managed objects, not objectIDs! Managed objects are then  
passed from sub thread to mainthread...


This is supported.  You may pass the NSNotification object from  
didSaveChanges to the mergeChangesFromContext... method on another MOC  
even across threads.  Of course, if you yank the managed objects out  
of the NSNotification and use them in different threads yourself, that  
is a violation.



Isn't it a violation of the basic rule described below?


In a literal sense, it can appear that way.  The specific  
implementation details of mergeChangesFromContextDidSaveNotification  
address the paradox.  The framework gets to bend its own rules a touch  
in much the same way that an object accessing its own private ivars is  
still honoring encapsulation.


You can download the debug version of Core Data from ADC and use the  
multithreading assertions.  They enforce the rules, even on the  
framework itself :-)


A lot of strange crashes with threads are actually very complicated  
memory management bugs.  Something like malloc_history can be very  
useful for tracking those down.  Instruments as well with its  
ObjectAlloc tool can provide stack traces for every retain and release  
ever on an object.


- Ben

___

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

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

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

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


Re: Help needed with setting autoresizing masks

2009-05-29 Thread Seth Willits

On May 29, 2009, at 1:38 PM, WT wrote:

I also tried turning off the "autoresize subviews" option in IB for  
the container view (and all 4 elements, not that that should  
matter), in the hopes that that would work since I compute the  
correct coordinates for all elements myself. Yet, it still didn't  
work.


Which seems to confirm that it is *not* a problem with the  
autoresizing masks. (And if the containing view is not resizing, then  
how could it be?)


I would say some pasted code is in order, here. Can you replicate the  
problem in a small sample project?


--
Seth Willits



___

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

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

Help/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] mergeChangesFromContextDidSaveNotification: and thread safety

2009-05-29 Thread Kyle Sluder
On Fri, May 29, 2009 at 2:25 PM, Ben Trumbull  wrote:
> In a literal sense, it can appear that way.  The specific implementation
> details of mergeChangesFromContextDidSaveNotification address the paradox.
>  The framework gets to bend its own rules a touch in much the same way that
> an object accessing its own private ivars is still honoring encapsulation.

Can we please have some further clarification on this in the docs
please?  r.6933634

Thanks,
--Kyle Sluder
___

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

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

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

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


Re: [Core Data] mergeChangesFromContextDidSaveNotification: and thread safety

2009-05-29 Thread mmalc Crawford


On May 29, 2009, at 2:46 PM, Kyle Sluder wrote:


Can we please have some further clarification on this in the docs
please?  r.6933634


The documentation states explicitly:

You can use this method to, for example, update a managed object  
context on the main thread with work completed in another context in  
another thread. You must, though, lock the receiver or otherwise  
ensure thread safety (that is, the notification contents are handled  
safely by Core Data, but the receiver's usage is still expected to  
conform to the standard Core Data threading policies). For example,  
you might implement a method to handle a notification that a worker  
thread had finished saving as follows:






Could you elaborate on what is unclear?

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/archive%40mail-archive.com

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


Re: [Core Data] mergeChangesFromContextDidSaveNotification: and thread safety

2009-05-29 Thread Kyle Sluder
On Fri, May 29, 2009 at 2:59 PM, mmalc Crawford  wrote:
> Could you elaborate on what is unclear?

Perhaps it would suffice to just have a simple one-liner that mentions
NSManagedObjectContextDidSave, specifically in the context of
multi-threaded Core Data.  It's not an easy topic, so I think an
airtight and direct guarantee (not qualified with any "for examples"
or such) that this method is able to use the managed objects contained
in a notification received on another thread, along with a link to the
NSManagedObjectContextDidSave (which also has a link back to
-mergeChangesFromContextDidSaveNotification:) and a caution about the
perils of using managed objects belonging to another thread's MOC
yourself, would be helpful.

And if it's determined to already be clear enough, please close the
bug, don't just leave it hanging like a lot of others.  Thanks very
much.  :)

--Kyle Sluder
___

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

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

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

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


Getting localized /Users/Shared Dir Name

2009-05-29 Thread Erg Consultant
I don't see any methods such as NSSearchPathForDirectoriesInDomains() for 
getting the localized name of the /Users/Shared directory. Is there one?

Thanks,

Erg



  
___

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

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

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

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


Re: [Core Data] mergeChangesFromContextDidSaveNotification: and thread safety

2009-05-29 Thread mmalc Crawford


On May 29, 2009, at 3:40 PM, Kyle Sluder wrote:


And if it's determined to already be clear enough, please close the
bug






No, there is something there to be addressed -- thanks for the  
clarification.


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/archive%40mail-archive.com

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


Re: Getting localized /Users/Shared Dir Name

2009-05-29 Thread Chris Parker


On 29 May 2009, at 3:49 PM, Erg Consultant wrote:

I don't see any methods such as  
NSSearchPathForDirectoriesInDomains() for getting the localized name  
of the /Users/Shared directory. Is there one?


Once you have any path, you can get the localized components via - 
[NSFileManager componentsToDisplayForPath:].


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html

.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/archive%40mail-archive.com

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


Re: Getting localized /Users/Shared Dir Name

2009-05-29 Thread Erg Consultant
How does that help?

I can get a list of all user dirs via:

NSSearchPathForDirectoriesInDomains( NSUserDirectory, NSLocalDomainMask, YES );

But I still don't know which of those returned is the Shared one.

Erg





From: Chris Parker 
To: Erg Consultant 
Cc: Chris Parker ; cocoa-dev@lists.apple.com
Sent: Friday, May 29, 2009 3:52:45 PM
Subject: Re: Getting localized /Users/Shared Dir Name


On 29 May 2009, at 3:49 PM, Erg Consultant wrote:

> I don't see any methods such as NSSearchPathForDirectoriesInDomains() for 
> getting the localized name of the /Users/Shared directory. Is there one?

Once you have any path, you can get the localized components via 
-[NSFileManager componentsToDisplayForPath:].

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html

..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/archive%40mail-archive.com

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


Re: Help needed with setting autoresizing masks

2009-05-29 Thread WT

Hi Seth,

thanks for answering to my call for help. You make a good point.  
Perhaps it is a problem with my code after all. However, not updating  
the label positions still causes them to move and if I am not moving  
them, someone else is. Anyhow, I created a sample project that still  
shows the problem. It can be downloaded from:


http://www.restlessbrain.com/auto_res_mask/ARMaskIssue.zip

Thanks for taking a shot at it.

Wagner

On May 29, 2009, at 11:34 PM, Seth Willits wrote:


On May 29, 2009, at 1:38 PM, WT wrote:

I also tried turning off the "autoresize subviews" option in IB for  
the container view (and all 4 elements, not that that should  
matter), in the hopes that that would work since I compute the  
correct coordinates for all elements myself. Yet, it still didn't  
work.


Which seems to confirm that it is *not* a problem with the  
autoresizing masks. (And if the containing view is not resizing,  
then how could it be?)


I would say some pasted code is in order, here. Can you replicate  
the problem in a small sample project?


--
Seth Willits

___

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

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

Help/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: Getting localized /Users/Shared Dir Name

2009-05-29 Thread Michael Ash
On Fri, May 29, 2009 at 7:01 PM, Erg Consultant
 wrote:
> How does that help?
>
> I can get a list of all user dirs via:
>
> NSSearchPathForDirectoriesInDomains( NSUserDirectory, NSLocalDomainMask, YES 
> );
>
> But I still don't know which of those returned is the Shared one.

This is not even remotely close to what you originally asked. You
originally asked how to find out its localized name, and now you're
asking how to find its path. If you're after the second but ask for
the first, of course the answer does not help you.

I see no constant for NSSearchPathForDirectoriesInDomains, but the
kSharedUserDataFolderType for FSFindFolder sounds like that's what you
want.

Mike
___

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

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

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

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


Get Users/Shared full path and its localized dir name

2009-05-29 Thread Erg Consultant
How can I get the full path to the Users/Shared dir and the dir's localized 
name?

Thanks,

Erg



  
___

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

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

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

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


Re: Get Users/Shared full path and its localized dir name

2009-05-29 Thread Steve Christensen

On May 29, 2009, at 4:27 PM, Erg Consultant wrote:

How can I get the full path to the Users/Shared dir and the dir's  
localized name?


FSRef usersSharedFSRef;

if (FSFindFolder(kOnAppropriateDisk, kSharedUserDataFolderType,  
kDontCreateFolder, &usersSharedFSRef) == noErr)

{
NSString* usersSharedPath = [[(NSURL*)CFURLCreateFromFSRef(NULL,  
&usersSharedFSRef) autorelease] path];
NSString* usersSharedDisplayName = [[NSFileManager  
defaultManager] displayNameAtPath:usersSharedPath];

}

___

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

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

Help/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: Drag and drop query

2009-05-29 Thread Nate Weaver
It seems to me that you want to also use NSTIFFPboardType/ 
NSPDFPboardType with the image data. Mail/iPhoto like to deal with  
files (for attachments/library items), but TextEdit wants a raw image  
(IIRC).


-W

On May 30, 2009, at 4:21 AM, Srinivasa Prabhu wrote:


Hi all,

	I am trying to drag image files from my application to other  
applications like Mail,iPhoto,TextEdit etc. I am using  
NSFilesPromisePboardType to do this.


This is the code snippet:

	 [inPasteboard declareTypes : [NSArray  
arrayWithObjects:NSFilesPromisePboardType, nil]  owner:self];
	 [inPasteboard setPropertyList:fileTypes  
forType:NSFilesPromisePboardType];


I implemented the following method in my dragSource(IkBrowserview)

- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)  
dropDestination

{
// here I am creating actual image file
}

This works fine for applications like Mail,iPhoto.
But , when I try to drag files to applications like  
TextEdit,Thunderbird this method never gets called.


Does this mean that applications like TextEdit and Thunderbird do  
not support

NSFilesPromisePboadType ?
If yes, Is there any workaround for this issue?

Regards,
Srinivas.


___

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

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

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

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


Showing more warnings possible in Xcode?

2009-05-29 Thread Eric Hermanson
I am periodically bitten by EXC_BAD_ACCESS memory problems that are  
sometimes hard to find.  One that just occurred was that I was   
mistakenly returning an un-initialized local variable from a method  
(i.e.


NSObject myObject;

...
... some if-statements
...

return myObject;  // I should have at least set myObject = nil above.

Is there a way to tune xCode so that it warns you of these types of  
potential problems (and more)?  The Java development environment I've  
been using for the past several years (Jetbrains IDEA) has  
unbelievably fantastic code-editing and compile-time warning systems  
that allow you to show a myriad of situations as warnings (some are  
user definable).  Is there a way to do this in xCode, or at least set  
some flags to get more verbose warnings (especially those that can  
prevent "dumb" mistakes)?


Thank You,
- Eric

___

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

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

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

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


Re: Showing more warnings possible in Xcode?

2009-05-29 Thread Graham Cox


On 30/05/2009, at 1:13 PM, Eric Hermanson wrote:

Is there a way to tune xCode so that it warns you of these types of  
potential problems (and more)?  The Java development environment  
I've been using for the past several years (Jetbrains IDEA) has  
unbelievably fantastic code-editing and compile-time warning systems  
that allow you to show a myriad of situations as warnings (some are  
user definable).  Is there a way to do this in xCode, or at least  
set some flags to get more verbose warnings (especially those that  
can prevent "dumb" mistakes)?



In your project's build settings, scroll down to "Other Warning  
Flags", and paste this lot in:


-Wall -Wcast-align -Wchar-subscripts -Wextra -Wextra-tokens -Wformat=2  
-Wmissing-field-initializers -Wpointer-arith -Wshadow -Wswitch-default  
-Wundef -Wwrite-strings


I'm not immediately sure what they all do, but that's what I compile  
with (cleanly).


--Graham


___

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

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

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

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


Re: Showing more warnings possible in Xcode?

2009-05-29 Thread Eric Hermanson
Thank You.  I also just found this useful web page based on your  
feedback:


http://developer.apple.com/TOOLS/xcode/staticanalysis.html



On May 29, 2009, at 11:22 PM, Graham Cox wrote:



On 30/05/2009, at 1:13 PM, Eric Hermanson wrote:

Is there a way to tune xCode so that it warns you of these types of  
potential problems (and more)?  The Java development environment  
I've been using for the past several years (Jetbrains IDEA) has  
unbelievably fantastic code-editing and compile-time warning  
systems that allow you to show a myriad of situations as warnings  
(some are user definable).  Is there a way to do this in xCode, or  
at least set some flags to get more verbose warnings (especially  
those that can prevent "dumb" mistakes)?



In your project's build settings, scroll down to "Other Warning  
Flags", and paste this lot in:


-Wall -Wcast-align -Wchar-subscripts -Wextra -Wextra-tokens - 
Wformat=2 -Wmissing-field-initializers -Wpointer-arith -Wshadow - 
Wswitch-default -Wundef -Wwrite-strings


I'm not immediately sure what they all do, but that's what I compile  
with (cleanly).


--Graham




___

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

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

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

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


Re: Showing more warnings possible in Xcode?

2009-05-29 Thread Gwynne Raskind

On May 29, 2009, at 11:22 PM, Graham Cox wrote:
Is there a way to tune xCode so that it warns you of these types of  
potential problems (and more)?  The Java development environment  
I've been using for the past several years (Jetbrains IDEA) has  
unbelievably fantastic code-editing and compile-time warning  
systems that allow you to show a myriad of situations as warnings  
(some are user definable).  Is there a way to do this in xCode, or  
at least set some flags to get more verbose warnings (especially  
those that can prevent "dumb" mistakes)?
In your project's build settings, scroll down to "Other Warning  
Flags", and paste this lot in:


-Wall -Wcast-align -Wchar-subscripts -Wextra -Wextra-tokens - 
Wformat=2 -Wmissing-field-initializers -Wpointer-arith -Wshadow - 
Wswitch-default -Wundef -Wwrite-strings


I'm not immediately sure what they all do, but that's what I compile  
with (cleanly).



Nice list, Graham :).

It's important to note that the original question, warning about  
uninitialized automatic variables, is only possible in GCC when  
optimization is turned on. From Xcode's research assistant for that  
particular setting (emphasis mine):


--
Warn if a variable might be clobbered by a setjmp call or if an  
automatic variable is used without prior initialization.


***Detection of uninitialized automatic variable requires data flow  
analsys that is only enabled during optimized compilation.***


Note that GCC cannot detect all cases where an automatic variable is  
initialized or all usage patterns that may lead to use prior to  
initialization.

--

In short, you can't get this warning in a Debug-style build unless you  
want to sabotage your debugging efforts by adding optimization.


-- Gwynne

___

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

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

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

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


Custom view resizing

2009-05-29 Thread Robert Olivier


I'm a new Cocoa programmer working on my first non-trivial custom view  
and I have a question regarding the right way to handle view resizing.


Say that I have a list of shapes that I need to draw left to right  
across my view, and this list grows over time.  Eventually, I will  
need to draw a shape outside of the existing view frame and I when  
this happens I want to resize the view.


Initially I had all of the drawing code directly in the view and when  
the code detected that the next shape would be outside of the existing  
view bounds it would resize it like this:


if((current + spacing + headerSize.width) >= rect.size.width) {
  NSSize newSize;
  newSize.width = [self frame].size.width + spacing+headerSize.width;
  newSize.height = [self frame].size.height;
  [super setFrameSize:newSize];
  [self setNeedsDisplay:YES];
}

I want to move to a model where the shapes draw themselves rather than  
having all of the drawing code in the custom view, but without the  
shape object knowing anything about the NSView object itself, only the  
NSRect that is being drawn.


What is the best practice for this?  Am I thinking right that the  
shapes should draw themselves rather inspecting each shape and drawing  
it in the view?  IF so, and a shape object knows that the view is not  
big enough for it to render itself, should it send a notification to  
the view telling it to resize or would it be best to just let the  
shape objects know about the NSView object?  What are the implications  
for pagination during a print job?


I've looked at all the book examples that I have and did some  
searching on view resizing but none of the examples seem to really  
cover this case.


Thanks in advance for any help!

rjo
___

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

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

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

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


[ NS KeyedArchiver ] archiveRootObject:toFile: hoses my directory's permissions

2009-05-29 Thread Erg Consultant
I have an app I install with PackageMaker setting the permissions on the 
staging dirs to root/admin as mentioned in the Apple docs so that the app gets 
installed with permissions for any user.

I also install an empty dir with full rwxrwxrwx permissions - this is a data 
dir that my app will use to write files to at runtime.

So far, so good. Everything works.

In my app I then write a file to that data dir like this:

BOOL flushed = NO;

flushed = [ NSKeyedArchiver archiveRootObject:self 
toFile:@"/datadir/datafile.dat" ];

Problem is, when this line completes, the permissions on the data dir have 
changed to the current user/wheel and non-writable for all other users:

drwxr-xr-x@

And the permissions on the data file itself are set to the current user/wheel 
and:

-rw-r--r--@

Why does archiveRootObject:toFile: change the permissions on the parent 
directory? I didn't ask it to. This dir has to be writable for all users - the 
way I installed it - not by only the current user.

How can I avoid having the permissions changed?

Thanks,

Erg



  
___

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

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

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

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


Re: Custom view resizing

2009-05-29 Thread Graham Cox


On 29/05/2009, at 10:14 AM, Robert Olivier wrote:

I'm a new Cocoa programmer working on my first non-trivial custom  
view and I have a question regarding the right way to handle view  
resizing.


Say that I have a list of shapes that I need to draw left to right  
across my view, and this list grows over time.  Eventually, I will  
need to draw a shape outside of the existing view frame and I when  
this happens I want to resize the view.


Initially I had all of the drawing code directly in the view and  
when the code detected that the next shape would be outside of the  
existing view bounds it would resize it like this:


if((current + spacing + headerSize.width) >= rect.size.width) {
 NSSize newSize;
 newSize.width = [self frame].size.width + spacing+headerSize.width;
 newSize.height = [self frame].size.height;
 [super setFrameSize:newSize];
 [self setNeedsDisplay:YES];
}


This is a very bad idea. From what you're saying this is called within  
-drawRect: You should never try do do anything except drawing there.


I want to move to a model where the shapes draw themselves rather  
than having all of the drawing code in the custom view, but without  
the shape object knowing anything about the NSView object itself,  
only the NSRect that is being drawn.


What is the best practice for this?  Am I thinking right that the  
shapes should draw themselves rather inspecting each shape and  
drawing it in the view?



There are differing views on this, but yes, I think this is a good way  
to go. I'd suggest you do need a way to tell the shapes what view they  
are drawing in though, so they can ask it whether they really need to  
draw (using -needsToDrawRect:, etc).



IF so, and a shape object knows that the view is not big enough for  
it to render itself, should it send a notification to the view  
telling it to resize or would it be best to just let the shape  
objects know about the NSView object?  What are the implications for  
pagination during a print job?


Do NOT attempt to resize the view while drawing. It doesn't matter if  
this is triggered by a notification or in some other way, resizing the  
view at drawing time is a bad idea. Don't do it.


Instead, look at it another way. You are adding and removing shapes in  
a data model. Each shape has a bounding rect. The data model could  
calculate the union of the bounding rect easily, so when a shape is  
added/removed, ask the DM for the overall bounds and size the view to  
that. This is done totally outside of the drawing code. Adding/ 
Removing/Resizing will trigger drawing, which then just iterates over  
the shapes and asks them to draw. At that point the view will be the  
right size.


--Graham


___

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

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

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

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