Notification of CD-ROM inserted

2010-11-21 Thread Bilel Mhedhbi
Hi there,

I want my application to be notified when a CD-ROM is inserted. I came with two 
solutions: watching /etc/fstab (but the os doesn't use it) and watching the 
/Volumes/ directory.

What can you advice me??

Thanks! ___

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

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

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

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


Re: forcing accessibility focus

2010-11-21 Thread Travis Siegel


On Nov 12, 2010, at 3:15 PM, Kenny Leung wrote:


Hi All.

I'm working on accessibility in an app, and would like to have a  
view pop up on screen and immediately become the focused item so  
that its text will be spoken. There seems to be no call to  
"becomeAccessibilityFocus" like there is "becomeFirstResponder".


The first thing I'd have to ask is: Why are you trying to force the  
voiceover user to hear this message as soon as it comes up? Is it somet 
hing warning of computer failure? Is it critical information that if  
they don't get it will cause loads of things to break? If not, then  
you shouldn't be trying to force the user to hear it regardless of how  
important *you* think it is.
The voiceover user has a lot to deal with, and one thing that will  
irritate vo users to no end (me included) is when applications hijack  
my workflow, and force me to do something ZI had no interest in  
doing.  Vo already gets a notification when you pop-up a window, just  
make it an alert, and let the voiceover user go to the warning when  
they get around to it.
When leopard came out, the default behavior of voiceover was to  
automatically move to a newly loaded web page.  Now, imagine ifyou  
will, you press a link to load a new page, and since it's taking a  
while to load, you switch over to mail, and are happily typing a  
response to a message, and poof, you're back in safari with no  
indication you were yanked out of mail, and no explanation of how you  
got there.
Thankfully, this is no longer the default, though it can be set in  
preferences for folks who like that sort of thing.  I absolutely hated  
this behavior, and until I got the ability to turn it off, I was just  
about ready to throw my copy of leopard out the window, go back to  
tiger, and just ignore any future updates.
Don't introduce behavior into your application that interrupts  
workflow.  If you wouldn't hijack the keyboard/mouse/screen for a  
sighted user, then don't hijack voiceover for the visually impaired  
user.  It's just good computing practice.
If your warning is delivered properly, the vo user will get to it when  
they get to it, and not before.  Trying to force the vo user to do  
something just because you think it's important is not (imo) the way  
to earn trust and encourage folks touse your app.
Developers aren't doing vo users favors by yanking them out of their  
other applications, moving their cursors around, or changing what  
their told as a result of doing nothing to affect those actions.   
Please keep this in mind when developing accessible programs.   
Voiceover users have no more desire to have their work interrupted  
than you do, so try to be consistent in how you present information,  
and don't think that because you think something is important, the  
user will place the same importance on it.___


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

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

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

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


define IBOUtlet connection in design time

2010-11-21 Thread Yuriy Velichko
 Hello
   I create my IB plug-in, and can't resolve next task. I need detect
   when happens connecting the outlet between objects. I cant find, what
   message goes to object (or Inspector class or else ) to notify them
   about connecting outlet, at design time of course. (I'm sure this is
   not set/get method. Geter invoked vhen I open Connections panel. But
   when I set outlet is -set method does not invoked)
   Any body can tell me how I can catch this message? and where? 
   Thanks!
___

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

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

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

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


Re: Running JavaScript in iOS WebView.

2010-11-21 Thread Adrian Petrescu
For what it's worth, that framework is definitely fine on iOS. I've used it
successfully myself at least twice.

On Wed, Nov 17, 2010 at 2:07 PM, Conrad Shultz <
con...@synthetiqsolutions.com> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 11/17/10 1:33 PM, Geoffrey Holden wrote:
> > void SendDelegateMessage(NSInvocation*): delegate (webViewDidLayout:)
> > failed to return after waiting 10 seconds. main run loop mode:
> > GSEventReceiveRunLoopMode
> >
> > I have got webViewDidFinishLoad (that's where this code is called) -
> > so it isn't that it's trying to run on nothing.
> >
> > If you have any ideas about what I could do to fix this, I'd be most
> > interested to hear them!
>
> Hmm.  I haven't seen this myself, but are you by any chance trying to do
> this on a secondary thread?
>
> - --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFM5FIuaOlrz5+0JdURApjsAJ4uPKnHEFVUJkiJJb7gtLx9dVMnDQCfSi9O
> gMRqrPoelphoQuTmbPt4esc=
> =mRgF
> -END PGP 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/apetresc%40gmail.com
>
> This email sent to apetr...@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


Web services core problem

2010-11-21 Thread Vaibhao


Hi

I m using   Web Services Core framework  to access a  https based SOAP- 
Web service .But I am getting a error as

  "/FaultCode" = -65794;
"/FaultExtra" = {
domain = -1;
error = -65795;
msg = "No valid XML data in response";
};
"/FaultString" = "/CFStreamFault";
And In  WSDebugInBody , It says "The server encountered an internal  
error () that prevented it from fulfilling this request.(http status  
code 500)"



Actually , I have made first call to web service successfully . But  
when I make second call to web service for authentication by  passing  
username and password , I am getting error mentioned above.  So,how to  
get rid of this error ?



In the technical requirements of web service , it is mentioned that
	"The web service client must support accepting cookies from  server  
and resending them back in HTTP header lines in subsequent web service  
calls.  After  server authenticates a user successfully through web  
service, a session cookie will be sent back in response to the web  
service client.  The client must submit this cookie in all subsequent  
interaction with the server.  Otherwise, any request without this  
cookie will be blocked out."


Would I need to send back cookies to make second call?

Actually , I am getting response headers  from first call as

/WSDebugInHeaders" = {
Connection = close;
"Content-Type" = "text/xml;charset=\"utf-8\"";
Date = "Thu, 18 Nov 2010 13:35:50 GMT";
Server = Apache;
"Transfer-Encoding" = Identity;
};

Looking at response headers,  how can I send cookies using Web  
servcies core ?  Do I really need to send it ?



	I have also tried to make web service call using NSURLConnection.  
Still I am getting the same error(http status code 500) for the second  
call .


Its  Response headers :
Connection = "Keep-Alive";
"Content-Type" = "text/xml;charset=\"utf-8\"";
Date = "Fri, 19 Nov 2010 06:39:02 GMT";
"Keep-Alive" = "timeout=15, max=100";
Server = Apache;
"Transfer-Encoding" = Identity;
From response headers , I tried to collect cookies ,but its is  
returning zero objects as response headers does not contain field like  
cookie name ,expiration date and so on.



//fields is dictionary containing response headers
NSArray* allCookies =
[NSHTTPCookie cookiesWithResponseHeaderFields:fields  forURL: 
[NSURL URLWithString:url]];


Since I am not getting cookie from the first call, how can I attach it  
with second call.




So what I think after I get authenticated with web service , I will  
get session cookie in response headers and will send it to each  
subsequent web service calls. How can I send session cookie with the  
help of web-services core ?Finally , I would like to go with web  
services core as it is easy to make a call rather than making soap  
request and then using NSURLConnection.  Surprising thing for me is  
all calls are succeeded from windows platform .


Any suggestion /comments /ideas are welcome. Thanks in advance.

Vaibhao Mahore






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


how to add a custom view (a pair of controls) to an NSToolbar in Interface Builder

2010-11-21 Thread Rua Haszard Morris
I would like to add an item to my window's toolbar that is a custom view 
containing other standard views. For example a popup button and a static text 
field. If possible I would like to do this in interface builder, without 
implementing NSToolbarDelegate.

So to clarify..

I have a window with a toolbar in an interface builder file.
I want to put a popup button and static text on the toolbar as a single item - 
I want them to be removeable/addable as a pair, and I want full control over 
their layout within the toolbar item.
I want to run the interface in IB using the Cocoa Simulator and see the popup 
button and text draw.

1 - Is this possible in Interface Builder? If so, can someone briefly outline 
the steps?

2 - If this is not possible in IB, how would this best  be implemented? If this 
is the case, can this work alongside configuring the toolbar in IB, or will the 
allowed items configured in IB be ignored at runtime? (This is why I'd prefer 
to do this fully in IB).

What I have tried:
- new window NIB file
- add a toolbar
- add a custom view to the nib
- add controls to the custom view - a button, textfield, etc, tweak layout to 
taste
- drag the custom view to the toolbar customise sheet (i.e. the allowed items 
area)
- it looks like the view content will appear - the buttons are drawn in the 
allowed items area
- drag the custom item to the toolbar (so it is in the default set) - oh no, 
the buttons disappear
- simulate the interface - oh no, still no buttons!

I didn't find any confirmation that this is not possible in these previous 
threads..
http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg35450.html
http://www.cocoabuilder.com/archive/cocoa/282463-custom-view-in-toolbar.html

thanks for the help
Rua HM.

--
http://cartoonbeats.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


Customised NSCell leaves dirty traces while scrolling

2010-11-21 Thread Josh Yu
Hey guys I was implementing a customised NSCell into NSTableView and
it leaves dirty traces while scrolling up bit by bit.

The cell was subclassed from NSTextFieldCell, using
drawInteriorWithFrame: and coordinates to locate and place elements
inside (drawInRect for NSStrings whatever).

The NSTableView calls cells via dataCellForTableColumn:row: and passes
the current cell frame boundary NSRect to cells for drawing.

It looked all well and neat except for sometimes leaving dirty traces
while scrolling up slowly bit by bit. The capture below sketches the
problem as dirty bits are lying under the first "retweet by retweet
by" as a result of scrolling up.

[ Image: http://img89.imageshack.us/img89/3644/20101120060934.png ]

A call to NSTableView setNeedsDisplay:YES will always solve the
problem however too inefficient.

Can anyone please suggest if there's anything might be done to fix that up?

kjoika
___

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

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

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

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


Problem with soap based https Web service call using Web Services core

2010-11-21 Thread Vaibhao



hello,

I m using   Web Services Core framework  to access a  https based SOAP- 
Web service .I am getting a error as

  "/FaultCode" = -65794;
"/FaultExtra" = {
domain = -1;
error = -65795;
msg = "No valid XML data in response";
};
"/FaultString" = "/CFStreamFault";
And In  WSDebugInBody , It says "The server encountered an internal  
error () that prevented it from fulfilling this request.(http status  
code 500)"



Actually , I have made first call to web service successfully . But  
when I make second call to web service for authentication by  passing  
username and password , I am getting error mentioned above.  So,how to  
get rid of this error ?



In the technical requirements of web service , it is mentioned that
	"The web service client must support accepting cookies from  server  
and resending them back in HTTP header lines in subsequent web service  
calls.  After  server authenticates a user successfully through web  
service, a session cookie will be sent back in response to the web  
service client.  The client must submit this cookie in all subsequent  
interaction with the server.  Otherwise, any request without this  
cookie will be blocked out."


Would I need to send back cookies to make second call?

Actually , I am getting response headers  from first call as

/WSDebugInHeaders" = {
Connection = close;
"Content-Type" = "text/xml;charset=\"utf-8\"";
Date = "Thu, 18 Nov 2010 13:35:50 GMT";
Server = Apache;
"Transfer-Encoding" = Identity;
};

Looking at response headers,there is no field like Set-Cookie.Then ,   
how can I send cookies using Web servcies core ?  Do I really need to  
send it ? Is the error (http status code 500) getting because  of not  
sending the cookies to second call? Actually ,
I have also tried to make second request by taking response field  
headers like  Connection, accept-encoding,Content-Type, and Date (all  
are valid Http request  headers).But still I am  getting the same error.



Vaibhao Mahore






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: Notification of CD-ROM inserted

2010-11-21 Thread Sherm Pendley
On Wed, Nov 17, 2010 at 9:53 AM, Bilel Mhedhbi wrote:

>
> I want my application to be notified when a CD-ROM is inserted.


Watch for NSWorkspaceDidMountNotification notifications.

See: <
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html
>

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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

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

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

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


Re: Notification of CD-ROM inserted

2010-11-21 Thread Dave Keck
I'd use either NSWorkspaceDidMountNotification or
DARegisterDiskAppearedCallback() of the DiskArbitration framework.
___

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

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

Help/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 Basics (Was: help with bindings)

2010-11-21 Thread Rounak Jain
Thanks Jerry,
I have used the dictionaryWithObjectsAndKeys: method.
I have implemented your suggestions regarding "convenience constructors" and 
myKeys object. Regarding your comment about making everything "mutable", I 
think, at the moment, it has to be that way. 
What's next?


#import 

@interface ComboscAppDelegate : NSObject  {
IBOutlet NSComboBox *countryCombo;
NSMutableDictionary *theCountries;
NSMutableArray *myKeys;
IBOutlet NSWindow *window;
}
@property (assign) IBOutlet NSWindow *window;
- (void)applicationWillFinishLaunching:(NSNotification *)notif;
@end



#import "ComboscAppDelegate.h"
@implementation ComboscAppDelegate

@synthesize window;
- (void)applicationWillFinishLaunching:(NSNotification *)notif {
theCountries = [NSMutableDictionary dictionaryWithObjectsAndKeys:
 [NSMutableArray 
arrayWithObjects:@"AAABBB", @"AABBB", @"AAACCC", nil], @"A",
 [NSMutableArray 
arrayWithObjects:@"BBBAAA", @"", @"BBBCCC", nil], @"B",
 [NSMutableArray 
arrayWithObjects:@"CCCDDD", @"CCFGGGFF", @"CCCDDDFFF", nil], @"C", nil];

myKeys = [NSMutableArray arrayWithObjects: [theCountries allKeys], nil];
}
@end

___

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

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

Help/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: Customised NSCell leaves dirty traces while scrolling

2010-11-21 Thread jonat...@mugginsoft.com
On 20 Nov 2010, at 07:24, Josh Yu wrote:

> 
> 
> A call to NSTableView setNeedsDisplay:YES will always solve the
> problem however too inefficient.
> 
> Can anyone please suggest if there's anything might be done to fix that up?
> 
> kjoika
> ___
> 

Try overriding NSCell - drawWithFrame:inView:
IIRC this is called before - drawInteriorWithFrame:InView:

The default implementation of - drawWithFrame:inView: is perhaps the source of 
your unwanted drawing.

Regards

Jonathan Mitchell

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

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

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

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

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


Re: NSExpression is incorrect?

2010-11-21 Thread Ben Haller
  Another option would be to make your code mimic whatever NSExpression is 
doing on that machine, by evaluating 2 ** 3 ** 2 (once, and caching the result) 
and seeing whether it comes out as 64 or 512.  That way if/when Apple fixes 
their bug, your code will seamlessly follow suit.

  Which of these alternatives is best depends upon how your code is going to be 
used, of course.  Roland's suggestion of a compatibility switch seems good; the 
behavior I suggest could be a third option for that switch.  Then the user of 
the class can decide what they want to get.  Probably the best default would be 
to use the correct (right associative) parsing, though, as it seems unlikely 
that a whole lot of code specifically depends upon this bug in NSExpression, so 
for most clients there is probably no need to propagate the buggy behavior...

Ben Haller
McGill University


On 2010-11-21, at 1:07 AM, Roland King wrote:

> I agree with you that exponentiation is usually defined as right-associative. 
> 
> How about a compatibility switch in your code which you can flip to make it 
> work either way. 
> 
> On 21-Nov-2010, at 11:25 AM, Dave DeLong wrote:
> 
>> Hi everyone,
>> 
>> Let's say I have the string @"2 ** 3 ** 2".  I can run this through 
>> NSPredicate to parse it into an NSExpression tree for me, like so:
>> 
>> NSExpression * e = [(NSComparisonPredicate *)[NSPredicate 
>> predicateWithFormat:@"2 ** 3 ** 2 == 0"] leftExpression];
>> 
>> When I log/evaluate this predicate, it gives me "(2 ** 3) ** 2", which 
>> evaluates to 64.  In other words, NSExpression (or NSPredicate or whomever) 
>> has assumed that the power operator is a left-associative operator.
>> 
>> According to Wikipedia (the source of all truth and knowledge), when no 
>> parentheses are present in the expression, "the order is usually understood 
>> to be top-down, not bottom-up."  [1]  In other words, "a ** b ** c" is 
>> understood to be "a ** (b ** c)", not "(a ** b) ** c".  Put more formally, 
>> the power operator is supposed to be right associative.  
>> (rdar://problem/8692313)
>> 
>> I'm currently working on some code that mimics much of the behavior of 
>> NSExpression.  However, I'm now faced with a choice:  do I make my code 
>> technically correct by making the power operator right associative, or do I 
>> maintain parity with NSExpression and make it left associative?
>> 
>> Any suggestions you have would be welcome.
>> 
>> Thanks,
>> 
>> Dave DeLong
>> 
>> [1]: http://en.wikipedia.org/wiki/Exponentiation#Identities_and_properties
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
>> 
>> This email sent to r...@rols.org
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bhcocoadev%40sticksoftware.com
> 
> This email sent to bhcocoa...@sticksoftware.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: Help with Basics (Was: help with bindings)

2010-11-21 Thread Ricky Sharp

On Nov 21, 2010, at 2:59 AM, Rounak Jain wrote:

> Thanks Jerry,
> I have used the dictionaryWithObjectsAndKeys: method.
> I have implemented your suggestions regarding "convenience constructors" and 
> myKeys object. Regarding your comment about making everything "mutable", I 
> think, at the moment, it has to be that way. 
> What's next?

As Jerry pointed out, you need to learn the basics; please read up on the 
basics to include memory management.

The way you've now written things will cause your app to crash.  I'll leave the 
reason for the crash as an exercise for you to figure out.

> #import 
> 
> @interface ComboscAppDelegate : NSObject  {
>   IBOutlet NSComboBox *countryCombo;
> NSMutableDictionary *theCountries;
>   NSMutableArray *myKeys;
>   IBOutlet NSWindow *window;
> }
> @property (assign) IBOutlet NSWindow *window;
> - (void)applicationWillFinishLaunching:(NSNotification *)notif;
> @end
> 
> 
> 
> #import "ComboscAppDelegate.h"
> @implementation ComboscAppDelegate
> 
> @synthesize window;
> - (void)applicationWillFinishLaunching:(NSNotification *)notif {
>theCountries = [NSMutableDictionary dictionaryWithObjectsAndKeys:
>[NSMutableArray 
> arrayWithObjects:@"AAABBB", @"AABBB", @"AAACCC", nil], @"A",
>[NSMutableArray 
> arrayWithObjects:@"BBBAAA", @"", @"BBBCCC", nil], @"B",
>[NSMutableArray 
> arrayWithObjects:@"CCCDDD", @"CCFGGGFF", @"CCCDDDFFF", nil], @"C", nil];
> 
>   myKeys = [NSMutableArray arrayWithObjects: [theCountries allKeys], nil];
> }
> @end

___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.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: Help with Basics

2010-11-21 Thread Rounak Jain
> As Jerry pointed out, you need to learn the basics; please read up on the 
> basics to include memory management.

I am using Garbage collector. ___

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

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

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

2010-11-21 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Rounak Jain wrote:
>> As Jerry pointed out, you need to learn the basics; please read up on the 
>> basics to include memory management.
> 
> I am using Garbage collector. ___

The previous comments still stand.

For starters, there are a few good reasons you should still understand
non-GC memory management:

1) You may end up having to maintain someone else's reference-counted
code or develop code for a non-GC environment.  A dual-mode framework is
an example of such code.

2) There can be issues with garbage collection depending on your
application design - cf. Garbage Collection Programming Guide's
"Adopting Garbage Collection."

3) Garbage Collection does not exist (yet) in iOS.

Even if you are sure these will never apply to you (and "never say
never"), your code reveals a general need to learn the basics.

- --
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkzpW5AACgkQaOlrz5+0JdW79ACbBB3XzDSznH2zVphfyA4oEGFg
S84AnjylhAj2oVWyPDUZEApwCPZjXVCT
=1M7v
-END PGP 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


Core data fetch and multithreading

2010-11-21 Thread vincent habchi
Hi there,

briefly speaking, I have a Core Data Entity bearing a to-many relationship 
(therefore an NSSet * iVar). A dialog on the main thread can modify this set, 
while it may be simultaneously enumerated on a background GCD thread. I have 
therefore used the managed object context provided mutex to protect the 
respective snippets.

I am improving the background thread, replacing the enumeration by a fetch 
operation. Do I still need the lock, or is it provided internally by the Core 
Data framework?

Thanks,
Vincent___

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

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

Help/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: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument

2010-11-21 Thread vincent habchi
Le 21 nov. 2010 à 20:09, Dave Zwerdling a écrit :

> The issue lies in this: I have a background-thread reader of entities.  
> Because it is multithreaded, it uses a separate MOC for the entities to be 
> read.  These MOCs have their persistent store coordinator the same as the 
> document.  The background thread always returns faulted objects until the 
> persistent document is saved.

If this is your problem, this is normal. Until they are saved to the persistent 
document, newly created objects are local to their MOC and cannot be accessed 
elsewhere: upon creation, they are assigned temporary IDs.

Vincent___

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

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

Help/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 fetch and multithreading

2010-11-21 Thread vincent habchi
Le 21 nov. 2010 à 21:39, Quincey Morris a écrit :

> It's not an ivar, it's a property.

You're perfectly right.

> You can't modify a NSSet. I suspect you mean "modify this relationship", but 
> the ambiguity leads me to wonder if you're trying to do something funky here. 
> Not that it's relevant to your actual question ...

I mean that I replace an entity in the set, so I add one new entity and I 
remove an old one via the appropriate mutators (-addEntityObject, 
-removeEntityObject).

> under the heading "General Guidelines". If I understand your scenario 
> correctly, you've been using approach #3, the one labeled "This approach is 
> strongly discouraged".

Exactly, that's why I want to change. Note that my needs are fairly basic, so I 
didn't see the point of entering into a more complex scheme.

> Use approach #1 (except in the unlikely case that performance is an issue 
> without full concurrency, in which case use approach #2).

I know I should have two MOCs, but that leads to further difficulties linked to 
mutator use. I see fairly clearly how to get a copy of the root entity (the one 
that has the NSSet *), but how about the entities at the other end of the 
relationship? Should I enumerate all those to get copies, and then perform the 
mutation on the copies? Can I directly mutate the set from the root copy object 
without making this expensive copying operation? Is the change immediately 
reflected in the other MOC (I need real time interaction), etc.

Thanks for answering, have a nice Sunday!
Vincent___

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

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

Help/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 fetch and multithreading

2010-11-21 Thread Quincey Morris
On Nov 21, 2010, at 11:47, vincent habchi wrote:

> briefly speaking, I have a Core Data Entity bearing a to-many relationship 
> (therefore an NSSet * iVar).

It's not an ivar, it's a property.

> A dialog on the main thread can modify this set,

You can't modify a NSSet. I suspect you mean "modify this relationship", but 
the ambiguity leads me to wonder if you're trying to do something funky here. 
Not that it's relevant to your actual question ...

> while it may be simultaneously enumerated on a background GCD thread. I have 
> therefore used the managed object context provided mutex to protect the 
> respective snippets.
> 
> I am improving the background thread, replacing the enumeration by a fetch 
> operation. Do I still need the lock, or is it provided internally by the Core 
> Data framework?

Look at:


http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html

under the heading "General Guidelines". If I understand your scenario 
correctly, you've been using approach #3, the one labeled "This approach is 
strongly discouraged".

Use approach #1 (except in the unlikely case that performance is an issue 
without full concurrency, in which case use approach #2).


___

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

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

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

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


Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument

2010-11-21 Thread Dave Zwerdling
Hi everyone,
Here's the context:
I have a Core-Data document-based application.  There is an importer which 
creates new data to be imported into the document.  When the user specifies, 
particular entities are then moved into the document's MOC.  Because the 
imported can run prior to a document's save, it uses an alternative, in-memory 
persistent store for its MOCs.  When the user choses to import the entities, 
they are copied to the document's MOC.

This all works fine.

The issue lies in this: I have a background-thread reader of entities.  Because 
it is multithreaded, it uses a separate MOC for the entities to be read.  These 
MOCs have their persistent store coordinator the same as the document.  The 
background thread always returns faulted objects until the persistent document 
is saved.

I have narrowed it down to a specific use case:
1) If entities are created by the importer, copied into the document, the 
document is unsaved, and then viewed using the same MOC, all the values are 
fine, and the multithreaded reader gets loaded values for entities referenced 
from the document's MOC.
2) If entities are created by the importer, copied, then the document is saved, 
the multithreaded reader gets non-faulted entities.
3) If entities are created, copied, viewed in the main thread, the document 
unsaved, the background-thread reader gets non-faulted entities.

HOWEVER:
4) If entities are created, copied, the document is unsaved, the data is not 
viewed from the document's MOC, and the background-thread reader tries to 
access values, it only receives faults.

Because of the above results, I believe the background-thread MOC is not 
loading the data appropriately until a save action occurs.  This is an issue 
because I have no guarantee that users will save their documents prior to using 
the function of the App that requires background processing.

Things I have tried:
•Calling save: on the document's MOC after an entity has been copied.
•Fetching the relationships via NSFetchRequests.
•Calling willAccessValueForKey: on the faulted 

Conceptually, I understand that the data cannot be fetched from the persistent 
store if there isn't a persistent store.  In that case, where are the entities 
going when they exist and are fetchable from the MOC?  Is there a way to create 
a second, temporary in-memory store for the document?  Doesn't a MOC always 
have to have a PS via its PSC?

As you can probably tell, I've been stuck on this issue for a while.  Does 
anyone have anything I might try?___

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

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

Help/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 fetch and multithreading

2010-11-21 Thread Quincey Morris
On Nov 21, 2010, at 12:50, vincent habchi wrote:

> Exactly, that's why I want to change. Note that my needs are fairly basic, so 
> I didn't see the point of entering into a more complex scheme.

I think the point is that it's far *less* complex because the code to deal with 
a second MOC should be a lot simpler than the thread locking code. Plus, the 
chances are that your locking code is wrong. :) (Trust me, that's not a dig at 
you personally. But multithreading interlocks are *hard*. Such code can work 
almost all of the time and still be wrong.)

> I know I should have two MOCs, but that leads to further difficulties linked 
> to mutator use. I see fairly clearly how to get a copy of the root entity 
> (the one that has the NSSet *), but how about the entities at the other end 
> of the relationship? Should I enumerate all those to get copies, and then 
> perform the mutation on the copies? Can I directly mutate the set from the 
> root copy object without making this expensive copying operation? Is the 
> change immediately reflected in the other MOC (I need real time interaction), 
> etc.

You've added important information. If you're *changing* the objects enumerated 
in the background thread, you're going to run into difficulties with the 
NSDocument metaphor. (You can't -[save:] the MOC in the background thread 
because you shouldn't be changing the document file without the user having a 
say in it, and you can't release the background MOC without losing the changes. 
You might be forced to merge the changes back into the original context.)

Approach #3 *might* be the best way after all, but I think if you're trying to 
get multithreaded data changing within a NSDocument/NSPersistentDocument 
scenario (which is kind of a hack to begin with) you might need to go deeper 
into the design process anyway. For example, you might be able to break 
everything (including your current "foreground" and "background" object 
modification loops) down into smaller steps that you schedule with GCD.

Speaking from very painful experience, I'd recommend you be careful trying to 
design for performance if you need Core Data to behave in certain ways to make 
the design work. What seems like a small operation from your side of the Core 
Data API can be something entirely different in the Core Data implementation.

(Note that I'm not saying anything against Core Data performance -- it's highly 
optimized -- but rather against making assumptions about how Core Data 
implements its behavior. You can't observe Core Data to find out, either. Its 
implementation characteristics really do change in dramatic ways between Mac OS 
versions.)


___

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

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

Help/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 fetch and multithreading

2010-11-21 Thread vincent habchi
Quincey:

> I think the point is that it's far *less* complex because the code to deal 
> with a second MOC should be a lot simpler than the thread locking code. Plus, 
> the chances are that your locking code is wrong. :) (Trust me, that's not a 
> dig at you personally. But multithreading interlocks are *hard*. Such code 
> can work almost all of the time and still be wrong.)

Oh, I know that too ;) Back when I was in U. I worked on a custom 4 x MC68000 
machine, with TAS semaphores in assembler. That was fun, hardware AND software 
(rewriting code is fairly free, but burning PALs was not! ;))

> You've added important information. If you're *changing* the objects 
> enumerated in the background thread, you're going to run into difficulties 
> with the NSDocument metaphor. (You can't -[save:] the MOC in the background 
> thread because 

[…]

No, fortunately, that's the contrary: I'm reading objects in the background, to 
get them displayed, while the user can modify their properties in the 
foreground, so only the main thread alters the relationship entity members. 
Besides, the background processes are transitory (only -displayInContext: in 
GCD queues).

I try to keep it short here, but if you desire more info, I'll happily send it 
to you in a separate mail.

Thanks again (I'm going to bed this time)!
Vincent

___

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

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

Help/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: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument

2010-11-21 Thread Dave Zwerdling

On Nov 21, 2010, at 11:37 AM, vincent habchi wrote:

> Le 21 nov. 2010 à 20:09, Dave Zwerdling a écrit :
> 
>> The issue lies in this: I have a background-thread reader of entities.  
>> Because it is multithreaded, it uses a separate MOC for the entities to be 
>> read.  These MOCs have their persistent store coordinator the same as the 
>> document.  The background thread always returns faulted objects until the 
>> persistent document is saved.
> 
> If this is your problem, this is normal. Until they are saved to the 
> persistent document, newly created objects are local to their MOC and cannot 
> be accessed elsewhere: upon creation, they are assigned temporary IDs.
> 
> Vincent

Is there a recommended way to enhance this to do what I need?  I assume I would 
need to create an in-memory store and keep the entities there, but how do I 
ensure that the documents will also make it to the persistent document on save?

Dave___

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

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

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

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


Re: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument

2010-11-21 Thread Kyle Sluder
On Sun, Nov 21, 2010 at 2:32 PM, Dave Zwerdling  wrote:
>
> On Nov 21, 2010, at 11:37 AM, vincent habchi wrote:
>
> > Le 21 nov. 2010 à 20:09, Dave Zwerdling a écrit :
> >
> >> The issue lies in this: I have a background-thread reader of entities.  
> >> Because it is multithreaded, it uses a separate MOC for the entities to be 
> >> read.  These MOCs have their persistent store coordinator the same as the 
> >> document.  The background thread always returns faulted objects until the 
> >> persistent document is saved.
> >
> > If this is your problem, this is normal. Until they are saved to the 
> > persistent document, newly created objects are local to their MOC and 
> > cannot be accessed elsewhere: upon creation, they are assigned temporary 
> > IDs.
> >
> > Vincent
>
> Is there a recommended way to enhance this to do what I need?  I assume I 
> would need to create an in-memory store and keep the entities there, but how 
> do I ensure that the documents will also make it to the persistent document 
> on save?

Saving means writing things to the persistent store. You cannot share
unsaved objects between MOCs. Ergo, in order to get access to the
objects from the other MOC, the objects must already be in the
persistent store because the originating MOC has been saved.

What are you trying to accomplish?

--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: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument

2010-11-21 Thread Dave Zwerdling

On Nov 21, 2010, at 2:47 PM, Kyle Sluder wrote:

> On Sun, Nov 21, 2010 at 2:32 PM, Dave Zwerdling  wrote:
>> 
>> On Nov 21, 2010, at 11:37 AM, vincent habchi wrote:
>> 
>>> Le 21 nov. 2010 à 20:09, Dave Zwerdling a écrit :
>>> 
 The issue lies in this: I have a background-thread reader of entities.  
 Because it is multithreaded, it uses a separate MOC for the entities to be 
 read.  These MOCs have their persistent store coordinator the same as the 
 document.  The background thread always returns faulted objects until the 
 persistent document is saved.
>>> 
>>> If this is your problem, this is normal. Until they are saved to the 
>>> persistent document, newly created objects are local to their MOC and 
>>> cannot be accessed elsewhere: upon creation, they are assigned temporary 
>>> IDs.
>>> 
>>> Vincent
>> 
>> Is there a recommended way to enhance this to do what I need?  I assume I 
>> would need to create an in-memory store and keep the entities there, but how 
>> do I ensure that the documents will also make it to the persistent document 
>> on save?
> 
> Saving means writing things to the persistent store. You cannot share
> unsaved objects between MOCs. Ergo, in order to get access to the
> objects from the other MOC, the objects must already be in the
> persistent store because the originating MOC has been saved.
> 
> What are you trying to accomplish?
> 
> --Kyle Sluder


I have a fetcher which provides managed objects into the persistent store.  I 
also have a class which needs to read the objects from another MOC because it 
is being run in a background thread.  Unless the fetcher provides the managed 
objects, then the user saves, and only then attempts to use the functionality 
that requires the background thread does the MOC in the background thread 
become useful.  Since I cannot guarantee that the user will save (nor do I want 
to require that procedure) I need to somehow be able to have accurate data in 
the background-thread MOC.

Does this make sense?
Dave___

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

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

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

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


Re: Re: Customised NSCell leaves dirty traces while scrolling

2010-11-21 Thread Josh Yu
> Try overriding NSCell - drawWithFrame:inView:
> IIRC this is called before - drawInteriorWithFrame:InView:

> The default implementation of - drawWithFrame:inView: is perhaps the source 
> of your unwanted drawing.

> Regards

> Jonathan Mitchell

Thanks Jonathan for your reply. I've tried replacing
drawInteriorWithFrame with drawWithFrame and no luck :(

I however looked into my overriding on heightOfRow, which hands back a
calculated row height according to the variable heights of elements
placed inside. Forcing heightOfRow producing a fixed height for each
row seemed to have fixed the problem which is suggesting that there
might be flaws in my text rect calculating codes.

kjoika
___

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

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

Help/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: Loading NSManagedObjects across NSManagedObjectContexts in an unsaved NSPersistentDocument

2010-11-21 Thread vincent habchi
Le 22 nov. 2010 à 00:38, Dave Zwerdling  a écrit :

> I have a fetcher which provides managed objects into the persistent store.  I 
> also have a class which needs to read the objects from another MOC because it 
> is being run in a background thread.  

You've somehow run into the same issue than me. At that point, there are, I 
think, two possibilities:

1. Use a single MOC and its provided mutex for accessing shared ressources (but 
this is strongly discouraged);

2. Create a private pool of memory in which you duplicate new objects until 
they are saved.

Vincent


___

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

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

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

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