Long Time Dealy When getting Vended Object

2009-04-22 Thread Kiran Kumar S

Hi,

	Really going mad, it is taking  long time response when i am trying  
to get vended Object from the remote machine which doesn't exist in  
the network. .
	  I am facing same long time delay(more than 60 sec) when i am trying  
to get vended object from the remote machine which gone to sleep.

  Below is the code

-(id)serverObject {
id serverObject = nil;
@try{
serverObject = [[self serverConnection] rootProxy];
}...@catch(NSException *exception)  {
serverObject = nil;
[self destroyConnection];
 }
return serverObject;
}
-(NSConnection *)serverConnection {
if(!serverConnection)   {
		NSString *webAppURLString = [[NSUserDefaults standardUserDefaults]  
objectForKey:kPXWebAppURL];

NSString *host = nil;
if(!(webAppURLString  [webAppURLString length]  0)) {
host =[[NSProcessInfo processInfo] hostName];
} else {
host = [[NSURL URLWithString:webAppURLString] host];
}
		NSSocketPort  *port = [[NSSocketPort alloc]  
initRemoteWithTCPPort:PORT_NUMBER host:host];
		serverConnection = [[NSConnection  alloc] initWithReceivePort:nil  
sendPort:port];

[serverConnection setDelegate:self];
[serverConnection setRequestTimeout:1.0f];
[serverConnection setReplyTimeout:1.0f];
		[[NSNotificationCenter defaultCenter] addObserver:self  
selector:@selector(handleConnectionDied:)  
name:NSConnectionDidDieNotification object:serverConnection];

[port release];
}
return serverConnection;
}


Please help me out in this

Regards
SKiranKumar
___

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

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

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

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


Which is the event that when the mouse move out of the window area would response?

2009-04-22 Thread Joe Yi
hello all:I had searched the document of the NSWindow,but I can't find the
event the would response when the mouse move out of the window area . Anyone
can tell me which method I could use?
thank you

Joe YIK
___

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

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

Help/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: Which is the event that when the mouse move out of the window area would response?

2009-04-22 Thread Joar Wingfors


On 21 apr 2009, at 23.22, Joe Yi wrote:

hello all:I had searched the document of the NSWindow,but I can't  
find the
event the would response when the mouse move out of the window  
area . Anyone

can tell me which method I could use?



I don't think that's functionality that's built into NSWindow, but you  
can get to it using tracking areas:


	http://developer.apple.com/documentation/Cocoa/Reference/NSTrackingArea_class/Reference/Reference.html 

	http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/TrackingAreaObjects/TrackingAreaObjects.html 

	http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/MouseTrackingEvents/MouseTrackingEvents.html 



j o a r


___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Benjamin Dobson


On 22 Apr 2009, at 06:32:55, Mario Kušnjer wrote:


Greetings everyone !

So the question is how to make a window that doesn't have a title  
bar and borders ?

Actually I would like it to be just like user login window of OS X.

This could also go for a so called Splash Screen on app launch.


Although I'd appreciate it if you could in any way avoid the latter. I  
have always found them extremely annoying on OS X. If you're app takes  
a long time to load, something small and simple like what iWork does  
seems better.___


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

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

Help/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: Time since Login?

2009-04-22 Thread Uli Kusterer

On 22.04.2009, at 04:43, Trygve Inda wrote:

Is there also a way to determine some sort of overall system activity?



 There's Unix calls in the Kernel to do this, for instance  
host_statistics() with the HOST_CPU_LOAD_INFO selector. They're a  
little fiddly to use because everything you do in response to them can  
change their value again, but you might find a heuristic that works.  
We used them for some fun in one of our about screens, so I can't tell  
you whether they're suitable for what you're doing, but it looked OK.


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





___

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

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

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

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


Re: Drag and drop display image and file path?

2009-04-22 Thread Uli Kusterer

On 22.04.2009, at 00:03, Henrietta Read wrote:

  NSArray *files = [pboard propertyListForType:NSTIFFPboardType];
   [self setImage:[files objectAtIndex:0]];



This is probably your mistake. setImage expects an NSImage*. Whatever  
is on the pasteboard in that array you have, it's unlikely to be an  
NSImage. AFAIK NSTIFFPboardType is an NSData containing raw TIFF data,  
so you'll probably have to create an NSImage from that or something  
like that.


Mind you, that's from memory, I might be misremembering this  
pasteboard flavour.


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





___

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

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

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

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


Re: how to get the save File path from NSPrintpanel

2009-04-22 Thread Uli Kusterer

On 21.04.2009, at 12:08, sandeep chaudhary wrote:
I am using  the  Objective-C  for my application. In my  
application I use the NSPrintPanel to print the document. In the  
NSPrintPanel user can save the document using the Save as pdf  
option of NSPrintPanel, and a new dialog is open to save the  
document. In this dialog user can choose any path to save the file.  
So i want to get this path selected by user .  I have go through the  
NSPrintPanel API's but could not get any api who can give me the  
saved path. Sp please tell me in details how can i get this saved  
path from NSPrintPanel.



 Short answer: You don't. All that is handled by the print panel for  
you. The print panel is supposed to produce output that looks the same  
as if it was printed. So what it does is it asks your app to do the  
drawing for printing, but gives you a PDF graphics context to draw  
into. You just do the same as when printing to paper.


 If you want to do your own custom PDF export, add that to the Save  
as... menu item and use PDFKit or similar to set up a PDF the way you  
want and draw to it.


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





___

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

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

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

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


Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness

2009-04-22 Thread Ben Trumbull

Of course, why Apple couldn't have then added automatic support
for in-memory matching as the second step I don't know


Probably because nobody ever cared enough to file an enhancement  
request, and it didn't occur to us that writing 1 line of code to call  
filteredArrayWithPredicate was so troublesome.


- 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: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Mario Kušnjer


On 2009.04.22, at 08:55, Benjamin Dobson wrote:


Although I'd appreciate it if you could in any way avoid the latter.  
I have always found them extremely annoying on OS X. If you're app  
takes a long time to load, something small and simple like what  
iWork does seems  
better.___




Thanks everyone for answering !
Actually I was thinking on making a Splash Screen until app loading  
and when ready to do some kind of transition (like cube rotate that OS  
X uses) to the login window
It wouldn't display Splash Screen for long because login window is  
simple except for network connection checking because app should be  
able to use network resources


Mario
___

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

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

Help/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: Long Time Dealy When getting Vended Object

2009-04-22 Thread Ken Thomases

On Apr 22, 2009, at 1:14 AM, Kiran Kumar S wrote:

	Really going mad, it is taking  long time response when i am trying  
to get vended Object from the remote machine which doesn't exist in  
the network. .
	  I am facing same long time delay(more than 60 sec) when i am  
trying to get vended object from the remote machine which gone to  
sleep.

  Below is the code

[...]


On which line is the code blocking?  You can find out by sampling the  
process from Activity Monitor or breaking into the process with the  
debugger.


The delay you're seeing is probably the TCP connection timeout.  On  
most systems, it will take about 9 minutes for TCP to give up all  
attempts to connect and timeout.  I would hope that NSConnection would  
implement its own timeout mechanism as an alternative to allowing TCP  
to exhaust itself.


As near as I can tell from reviewing the documentation, the reply  
timeout should govern the -rootProxy method.  Since you're setting  
that, then I'm not sure why it's not working.


This might be a bug, which you should file at http://bugreport.apple.com 
.


Regards,
Ken

___

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

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

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

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


Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness

2009-04-22 Thread Ben Trumbull

The fact that Core Data cannot fetch using a predicate based on
transient properties [1] seems to greatly limit the utility of the
NSPredicateEditor view, and makes me very sad.


Dear list.

transient (adj):
(1)  passing especially quickly into and out of existence

May I suggest that the expectation that Core Data should fetch based  
on criteria that DOES NOT EXIST in the file seems somewhat  
unrealistic ?  However, enhancement requests are always welcome if you  
can articulate a coherent solution to the existential limitation.



But there's an even better way.  Upon further study of the Predicate
Programming Guide, I find that there are even more limitations to Core
Data fetches with predicates.  The most troubling is that:

The Core Data SQL store supports only one to-many operation per
query; therefore in any predicate sent to the SQL store, there may be
only one operator (and one instance of that operator) from ALL, ANY,
and IN.


Do you have a specific scenario in which you need to perform nested to- 
many operations, yet you cannot use SUBQUERY or compound queries like  
OR ?  Or is this troubling, in the sense that the universe is doomed  
to evaporate kind of way ?



A much better way appears to be to fetch all objects from the store
with no predicate and then use -[NSArray
filteredArrayWithPredicate:].  This takes only one more line of code,
solves all problems, and is supposedly cheaper too:



This does not solve all problems, it most emphatically is NOT cheaper,  
and most assuredly does NOT scale.


The atomic file approach is convenient and extremely simplistic.  It  
also fails to scale gracefully past 10^2 objects.


Optimizing memory management is very important for launch time and  
concurrency.  The monster 8 core mac pro will be constrained by the  
memory bus (vastly slower compared to the sum computational power) if  
you're careless with memory usage.  In addition to the memory bus  
bandwidth, concurrency is highly impacted by locality of reference.   
Keeping the voracious cpus fed with useful work is quite challenging  
for many pragmatic application tasks.



Makes me wonder why NSFetchRequest even supports a predicate, since
its predicate has all these limitations and is supposedly more
expensive when compared to fetching all objects and then using -
[NSArray filteredArrayWithPredicate:] ?



...

If you redrew the entire window all the time, for each and every pixel  
change, and then marveled at the limitations, people might suggest  
clipping your drawing to the intersection of the dirty and visible  
regions.  You might also use bounding rects as a convenient  
approximation of more complex region clipping calculations.


These days even apps with modest requirements need bounding rects and  
region clipping for their data too.


- 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: MDItemCopyAttribute and kMDItemFinderComment

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 04:30, Jeremy W. Sherman wrote:

getxattr(2) will directly access the current on-disk attribute  
value. Why

not just use it as Alastair suggested?


I suppose it is worth mentioning that getxattr() won't work as a way  
of getting the Finder information if the drive you're using is  
formatted with a filesystem that doesn't support attributes.  But on  
HFS+ I think it's a good bet that the attribute name won't change  
(unless the format of the data changes dramatically, and in that case  
you need more code anyway).


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness

2009-04-22 Thread Mike Abdullah


On 22 Apr 2009, at 08:48, Ben Trumbull wrote:


Of course, why Apple couldn't have then added automatic support
for in-memory matching as the second step I don't know


Probably because nobody ever cared enough to file an enhancement  
request, and it didn't occur to us that writing 1 line of code to  
call filteredArrayWithPredicate was so troublesome.


Calling -filteredArrayWithPredicate is no hassle, but for a large  
predicate, it has the bad performance of comparing a bunch of the  
persistent properties all over again, despite already knowing they'll  
match the predicate. Since I assume Core Data must do some kind of  
internal splitting up of the predicate in order to perform its fetch,  
I'd have thought it is in a good position to know what the remaining  
transient portion of the predicate is.


I haven't filed a radar I admit as this hadn't become a issue for me  
yet, but may well do.

___

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

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

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

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


Re: newbie questions on NSString* as a class attribute

2009-04-22 Thread Mike Abdullah


On 22 Apr 2009, at 02:15, Andrew Farmer wrote:


On 21 Apr 09, at 17:53, Wayne Shao wrote:
Let's say that I have a member variable   NSString* logFilePath, I  
do init

in the   initWith method as
  logFilePath = [[some_other_path  
stringByAppendingPathComponent:@log.txt]

copy];

The question is, if I do not call copy, is it true that logFilePath  
could be

subject to be GC'ed?


Are you using garbage collection or not?

If you ARE using garbage collection, the copy is unnecessary. So  
long as the value is reachable through strong references (which  
logFilePath is, so long as the object itself is reachable), it will  
not be collected.


If you ARE NOT using garbage collection, you should be retaining  
this value rather than copying it. See the memory management  
programming guide [1] for details.


[1]: 
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/index.html


To be fair, NSString's immutable nature does make -copy perfectly  
acceptable (and I would say desirable in many cases) as it ends up  
doing the same as -retain.


Mike.

___

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

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

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

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


Re: Really big files and encodings

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 06:57, Seth Willits wrote:

In my app, I import data from potentially very large files. In the  
first pass, I simply mmap'd the entire file, created a string using  
CFStringCreateWithBytesNoCopy, and go about my business. This works  
great until it hits the address limit when it's running as a 32-bit  
process, so now in the second pass I want to rework it a bit to only  
mmap a chunk (128 MB) at a time.


Now, if it were simply binary data, I could chop up the file however  
I wanted, but since the file I'm processing is actually a huge  
*text* file, I need to mmap an appropriate range so creating the  
string doesn't fail because a multi-byte character was split down  
the middle.


Hi Seth,

I think this highlights a significant deficiency in the CFString/ 
NSString API, which is that it's impossible to get any kind of  
streaming encoder/decoder (which is really what you want for this kind  
of task).


Have you considered using libiconv instead to convert to UTF-16, then  
creating your strings from that?  That would give you more control and  
would mean that you didn't have to guess where the encoder would want  
to start/finish working on your data (since it will tell you).


I guess ICU might also be a way around this, though iconv() et al.  
have the significant benefit of being documented and supported API.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


file extensions and Mime Type

2009-04-22 Thread rajesh

Hi All,

(posting this on behalf of my colleague)

Application we are currently working supports file drag from desktop
It typically finds what type of file it is and then processes it  
accordingly.


we don't want to solely  depend on file extension.
How can file Mime Type help us..

We have listed few mime types which we support and mapped them  
accordingly for processing.
How can one retrieve the Mime type for a particular file?  tried  
NSFileHandle and NSWorkSpace but of no help , (even googled around for  
hints , may be my search strings aren't effective )


Thanks
Rajesh 
 
___


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

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

Help/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: file extensions and Mime Type

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 10:31, rajesh wrote:

Application we are currently working supports file drag from  
desktop
It typically finds what type of file it is and then processes it  
accordingly.


we don't want to solely  depend on file extension.
How can file Mime Type help us..

We have listed few mime types which we support and mapped them  
accordingly for processing.
How can one retrieve the Mime type for a particular file?  tried  
NSFileHandle and NSWorkSpace but of no help , (even googled around  
for hints , may be my search strings aren't effective )


OS X doesn't rely on MIME types, for a variety of reasons.

You want to be using UTIs instead.  Take a look here:

  http://developer.apple.com/macosx/uniformtypeidentifiers.html

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Long Time Dealy When getting Vended Object

2009-04-22 Thread Kiran Kumar S

Thanks, Ken for your Reply,

Usually we will get time out exception when  trying to get vended  
object that is not available but in the below case i use to get same  
exception after a long long delay and some times My app crashes


Thanks
SkiranKumar




On 22-Apr-09, at 1:52 PM, Ken Thomases wrote:


On Apr 22, 2009, at 1:14 AM, Kiran Kumar S wrote:

	Really going mad, it is taking  long time response when i am  
trying to get vended Object from the remote machine which doesn't  
exist in the network. .
	  I am facing same long time delay(more than 60 sec) when i am  
trying to get vended object from the remote machine which gone to  
sleep.

  Below is the code

[...]


On which line is the code blocking?  You can find out by sampling  
the process from Activity Monitor or breaking into the process with  
the debugger.


The delay you're seeing is probably the TCP connection timeout.  On  
most systems, it will take about 9 minutes for TCP to give up all  
attempts to connect and timeout.  I would hope that NSConnection  
would implement its own timeout mechanism as an alternative to  
allowing TCP to exhaust itself.


As near as I can tell from reviewing the documentation, the reply  
timeout should govern the -rootProxy method.  Since you're setting  
that, then I'm not sure why it's not working.


This might be a bug, which you should file at http://bugreport.apple.com 
.


Regards,
Ken




___

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

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

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

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


Re: file extensions and Mime Type

2009-04-22 Thread rajesh

Thanks Alastair.

On Apr 22, 2009, at 11:51 AM, Alastair Houghton wrote:


On 22 Apr 2009, at 10:31, rajesh wrote:

Application we are currently working supports file drag from  
desktop
It typically finds what type of file it is and then processes it  
accordingly.


we don't want to solely  depend on file extension.
How can file Mime Type help us..

We have listed few mime types which we support and mapped them  
accordingly for processing.
How can one retrieve the Mime type for a particular file?  tried  
NSFileHandle and NSWorkSpace but of no help , (even googled around  
for hints , may be my search strings aren't effective )


OS X doesn't rely on MIME types, for a variety of reasons.

You want to be using UTIs instead.  Take a look here:

 http://developer.apple.com/macosx/uniformtypeidentifiers.html

Kind regards,

Alastair.

--
http://alastairs-place.net





___

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

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

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

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


[NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit

2009-04-22 Thread Iceberg-Dev
What's the official way to replace _outlineCell and  
_trackingOutlineCell in Cocoa 64-bit?


I do this for 32-bit:

@implementation NSOutlineView (PrivateCells)

- (NSButtonCell *) outlineCell
{
return _outlineCell;
}

- (void) setOutlineCell:(NSButtonCell *) inButtonCell
{
if (_outlineCell!=inButtonCell)
{
[_outlineCell release];

_outlineCell=[inButtonCell retain];
}
}

- (NSButtonCell *) trackingOutlineCell
{
return _trackingOutlineCell;
}

- (void) setTrackingOutlineCell:(NSButtonCell *) inButtonCell
{
if (_trackingOutlineCell!=inButtonCell)
{
[_trackingOutlineCell release];

_trackingOutlineCell=[inButtonCell retain];
}
}

@end

But 64-bit is not happy with it at all.

---

I need to replace among other things the drawWithFrame:inView: method  
to get a different rendering.



- (void)outlineView:(NSOutlineView *)outlineView  
willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn *) 
tableColumn item:(id)item; is probably not what I'm looking for.




___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Gregory Weston

Mario Ku?njer wrote:


Greetings everyone !

So the question is how to make a window that doesn't have a title bar
and borders ?
Actually I would like it to be just like user login window of OS X.

This could also go for a so called Splash Screen on app launch.

Thanks to all in advance.


This is more a couple of philosophical digressions than anything to do  
with Cocoa, but I think there are a couple of things here that would  
benefit from a little extra scrutiny before you pursue them.


I would argue against making an effort to make one of your windows  
look just like a security-related OS UI. You'll confuse users who  
don't realize there's a difference and likely anger some of those who  
do and decide you're trying to be deceptive.


I would also argue that in general splash screens are an anachronism.  
They're a holdover from slow hard drives attached to slow CPUs and the  
idea that an app taking several seconds to finish preparing itself for  
user interaction was normal. Today there are relatively few apps for  
which that's the case. Splash screens are no longer the norm and it's  
fairly gratuitous to force a user to wait for a while as you  
essentially advertise a product they already own to them.

___

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

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

Help/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: Time since Login?

2009-04-22 Thread Dave DeLong

There's also the w command that you could run in an NSTask.

Dave

On Apr 22, 2009, at 1:21 AM, Uli Kusterer wrote:


On 22.04.2009, at 04:43, Trygve Inda wrote:
Is there also a way to determine some sort of overall system  
activity?



There's Unix calls in the Kernel to do this, for instance  
host_statistics() with the HOST_CPU_LOAD_INFO selector. They're a  
little fiddly to use because everything you do in response to them  
can change their value again, but you might find a heuristic that  
works. We used them for some fun in one of our about screens, so I  
can't tell you whether they're suitable for what you're doing, but  
it looked OK.


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





___

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

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

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

This email sent to davedel...@me.com


___

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

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

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

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


Problem implementing keyPathsForvaluesAffectingKey

2009-04-22 Thread jonat...@mugginsoft.com
The property canDelete is dependent on three other properties as shown  
below.


Is there a problem with my implementation of  +  
keyPathsForValuesAffectingCanDelete with regard to the key path  
@arrayController.canRemove?


Modifying property1 and property2 results in the re-evaluation of - 
canDelete.
Removing all items in the array bound to arrayController does not  
cause -canDelete to be evaluated, even though [arrayController  
canRemove] becomes NO.


- (BOOL)canDelete
{
BOOL canRemove = [arrayController canRemove];
if (self.property1  self.property2) {
canRemove = NO;
}

return canRemove;
}


+ (NSSet *)keyPathsForValuesAffectingCanDelete
{
return [NSSet setWithObjects:@property1, @property2,  
@arrayController.canRemove, nil];

}

Jonathan Mitchell

Central Conscious Unit
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: Really big files and encodings

2009-04-22 Thread Michael Ash
On Wed, Apr 22, 2009 at 1:57 AM, Seth Willits sli...@araelium.com wrote:
 So, I generally know what I should do, but the problem is that I don't know
 how to identify an encoding as fixed-width or variable. I could spend the
 time to look up each and every encoding on the internet, but there are kind
 of a lot of them :) And then my code wouldn't be future-proof if an encoding
 is added.


 Can anyone offer some insight into how I could dynamically determine an
 encoding's characteristics? Or maybe I should just hard code it/do it by
 hand because there are really very few cases to handle.

Do your files have regularly occurring newlines like most normal text
files? If so, then you can just scan for a \r or \n and break it up
there. Virtually every encoding you'll encounter today encodes \r and
\n as \r and \n, and will not use those bytes for anything else.

Mike
___

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

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

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

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


Bindings making NSNumberFormatter strange

2009-04-22 Thread Ulai Beekam

Hi,

I have an (editable) NSTextField with an NSNumberFormatter attached to it. The 
text field is bound to some other numerical property (if you want to test this, 
you can just make a simple AppController and put the @property(readwrite) int 
foo; inside it, and bind the text field to AppController's foo).

My problem is that when I type some invalid stuff in the text field, such as 
some letters abc, I don't get a beep (which is the normal behaviour and the 
one I want), but I get some sheet popping up saying Formatting Error. I don't 
want this sheet. I want the beep like usual. How can I get rid of this sheet 
behaviour that the bindings is causing? And why is it even causing it?

Second question: How can I make my text field just disallow entering of invalid 
characters in the first place (and producing beep when it is tried)? I want, as 
you probably guessed, a method that is compatible with bindings.

Thanks very much,
U
_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx___

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

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

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

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


Re: Fast Forward and backward about QuickTime movie

2009-04-22 Thread douglas welton
According to the documentation for QTMovie, setting the playback rate  
using the -setRate: is rather straightforward.  As for getting the  
button's state to align with playback, I would probably subclass the  
button, overriding -mouseUp: and -mouseDown: as appropriate.


On Apr 21, 2009, at 11:05 PM, Bright wrote:



Hi douglas,
 thank you for your help.
 Now I expect that the speed is fast when user press the button  
and the speed
 is normal when user unfasten the button. I am a fresh man,ha. I  
don't know how

to do this. Could you tell more detail?thank you!
2009-04-21,douglas welton douglas_wel...@earthlink.net
To implement a fast (scan) forward or backward, simply set the  
movie's

playback rate to a value greater than 1.0 ( or -1.0 for going
backward).  You'll want to experiment with want looks best for you,
but a typical value might be 2.0, 4.0, 8.0... you get the picture.

Depending on how you want to the user to interact with your fast
forward or fast backward buttons, you'll want to create an action  
that
interprets the button's click, then determines when to start the  
movie

playing at the scan rate.

later,

douglas

On Apr 21, 2009, at 10:39 AM, Bright wrote:

 Hi,
   By using the -stepForward: and the -stepBackward: methods
 of the QTMovie class, I realized the forward/backward a frame
 when I click the corresponding buttons.
   But my purpose is to implement fast forward and fast backward
 when I press the corresponding buttons for a while. The result
 should like the QuickTime Play's fast forward and fast backward
 buttons.How to implement it? Any help is useful for 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: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit

2009-04-22 Thread Corbin Dunn

Howdy,

On Apr 22, 2009, at 4:37 AM, Iceberg-Dev wrote:

What's the official way to replace _outlineCell and  
_trackingOutlineCell in Cocoa 64-bit?


I do this for 32-bit:

@implementation NSOutlineView (PrivateCells)

- (NSButtonCell *) outlineCell
{
return _outlineCell;
}


Note that what you are doing is not an official way to make things  
work in 32-bit. It is strongly discouraged to access the ivars to  
AppKit classes, and what you are doing may break in the future.


There is no way to replace the outlinecell -- please log a bug  
requesting the ability to do so.


Thanks!

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


Combine multiple sources into an NSOutlineView using NSTreeController

2009-04-22 Thread Marcel Philipp Harris

Hello,
in my app, I have an outline view that is bound to an  
NSTreeController, which is connected to a Core Data entity. It works  
like a charm, but I would like to add category headings to the outline  
views categories and possibly even add some sources unrelated to the  
Core Data model.


Is this possible in any way without resorting to reimplementing  
NSTreeController from scratch? I've thought about subclassing  
NSTreeController, but to be honest, I don't really understand how it  
interoperates with an NSOutlineView. It seems not to act as a  
conventional data source, as it apparently doesn't implement the  
methods defined in the corresponding protocol (I may be wrong here,  
maybe they're implemented privately).


Any pointers much appreciated.

---
Marcel Hansemann
___

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

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

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

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


Re: Problem implementing keyPathsForvaluesAffectingKey

2009-04-22 Thread Ken Thomases

On Apr 22, 2009, at 9:45 AM, jonat...@mugginsoft.com wrote:

Removing all items in the array bound to arrayController does not  
cause -canDelete to be evaluated, even though [arrayController  
canRemove] becomes NO.


How are you removing the items?  Is it being done in a KVO-compliant  
manner?


Regards,
Ken

___

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

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

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

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


Re: Problem implementing keyPathsForvaluesAffectingKey

2009-04-22 Thread jonat...@mugginsoft.com


On 22 Apr 2009, at 17:02, Ken Thomases wrote:


On Apr 22, 2009, at 9:45 AM, jonat...@mugginsoft.com wrote:

Removing all items in the array bound to arrayController does not  
cause -canDelete to be evaluated, even though [arrayController  
canRemove] becomes NO.


How are you removing the items?  Is it being done in a KVO-compliant  
manner?



I think the following is okay in this regard:

- (IBAction)delete:(id)sender
{
if ([arrayController canRemove]) {
[arrayController remove:sender];
}
}


Regards,
Ken



Jonathan Mitchell

Central Conscious Unit
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: Problem implementing keyPathsForvaluesAffectingKey

2009-04-22 Thread Keith Duncan


On 22 Apr 2009, at 15:45, jonat...@mugginsoft.com wrote:

Is there a problem with my implementation of  +  
keyPathsForValuesAffectingCanDelete


You method signature is slightly wrong, it needs to be of the form

+keyPathsForValuesAffectingValueForKey:

Keith
___

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

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

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

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


performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Torsten Curdt
Hey folks,

Is this supposed to work or not?

  - (void) setActivated:(BOOL)theStatus;

  [view performSelectorOnMainThread:@selector(setActivated:)
withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES];

It does not seem like it works that way.

Do I really have to use NSInvocation for this?

cheers
--
Torsten
___

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

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

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

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


Re: Problem implementing keyPathsForvaluesAffectingKey

2009-04-22 Thread jonat...@mugginsoft.com


On 22 Apr 2009, at 17:10, Keith Duncan wrote:



On 22 Apr 2009, at 15:45, jonat...@mugginsoft.com wrote:

Is there a problem with my implementation of  +  
keyPathsForValuesAffectingCanDelete


You method signature is slightly wrong, it needs to be of the form

+keyPathsForValuesAffectingValueForKey:

Keith


I think it's okay.

You can register you dependent keys either using

+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key

or

You can also achieve the same result by implementing a class method  
that follows the naming convention
 keyPathsForValuesAffectingKey, where Key is the name of the  
attribute (first letter capitalized) that is dependent on the values.


But correct me again if I am wrong.




Jonathan Mitchell

Central Conscious Unit
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: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Michael Ash
On Wed, Apr 22, 2009 at 12:06 PM, Chris Williams ch...@clwill.com wrote:
 So you'd rather the user sits there wondering if this huge, highly complex
 application (like any Office or Adobe app) that takes 10-15 seconds to load,
 even longer on a slow laptop, is actually starting up, or should I click it
 again, or is my computer dead, or what the heck is going on here...?

This is why the icon bounces in the Dock. If it's bouncing, it's launching.

I don't really mind splash screens, although I find them to be
pointless. However, if your splash screen does not go into the
background when I click on another app while waiting for your app to
load, then your app goes into the trash instantaneously.

Much better than a splash screen is to *make your app launch faster*.
Usually the startup tasks that take forever can be deferred until
after the basics of the app have been set up. For example, your SQL
connection doesn't need to be set up while the app is launching. Let
it launch, set up your menu bar and welcome window and whatever else
you have, *then* establish the connection. Your icon is no longer
bouncing, your app is started, and you're in a much better
environment for a long-running task.

Mike
___

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

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

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

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


Re: performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Volker in Lists

Hi Torsten,

do you have more details on what the main thread implements and what  
you expect it to do, but doesn't do? I am using similar constructs and  
they work .


Volker

Am 22.04.2009 um 18:13 schrieb Torsten Curdt:


Hey folks,

Is this supposed to work or not?

 - (void) setActivated:(BOOL)theStatus;

 [view performSelectorOnMainThread:@selector(setActivated:)
withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES];

It does not seem like it works that way.

Do I really have to use NSInvocation for this?

cheers
--
Torsten
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/volker_lists%40ecoobs.de

This email sent to volker_li...@ecoobs.de


___

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

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

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

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


Re: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Benjamin Dobson


On 22 Apr 2009, at 17:06:10, Chris Williams wrote:

So you'd rather the user sits there wondering if this huge, highly  
complex
application (like any Office or Adobe app) that takes 10-15 seconds  
to load,
even longer on a slow laptop, is actually starting up, or should I  
click it

again, or is my computer dead, or what the heck is going on here...?

Splash screens serve a purpose other than advertising.  No program I  
know of
actually delays the load to show the splash screen.  Rather, they  
are a

prettier way of saying loading

I have an application that connects to a SQL server.  The app itself  
isn't a
slow loader, but the connection to the SQL server (often on another  
computer
or on hard drives that may be asleep) can take 5, 10, or more  
seconds to
establish.  The splash screen shows that progress and let's the user  
know

what things are being done.  Far better than a spinning beach ball.


Yes, but the vast majority of applications do not take that long to  
load. It may be a prettier way of saying Loading..., but unless it's  
got an actual progress bar on it it's just aggravating. I'll also  
throw in here that I have seen splash screens that have a higher  
window level than normal. This is just wrong. If you're app takes long  
enough to load to warrant a splash screen, it takes long enough to  
load for the user to get impatient and try to do something else.

___

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

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

Help/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: performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Ken Thomases

On Apr 22, 2009, at 11:13 AM, Torsten Curdt wrote:


Is this supposed to work or not?

 - (void) setActivated:(BOOL)theStatus;

 [view performSelectorOnMainThread:@selector(setActivated:)
withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES];

It does not seem like it works that way.


No, that doesn't work.  It does not convert between NSNumber and BOOL  
for you.




Do I really have to use NSInvocation for this?


If the setActivated: method is one of your own, you can change it to  
take an NSNumber.


Alternatively, you can create a small wrapper method especially for  
use with -performSelector... like so:


- (void) setActivatedWithNumber:(NSNumber*)theNumber
{
[self setActivated:[theNumber boolValue]];
}

Cheers,
Ken

___

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

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

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

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


Re: performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Michael Ash
On Wed, Apr 22, 2009 at 12:13 PM, Torsten Curdt tcu...@vafer.org wrote:
 Hey folks,

 Is this supposed to work or not?

  - (void) setActivated:(BOOL)theStatus;

  [view performSelectorOnMainThread:@selector(setActivated:)
 withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES];

 It does not seem like it works that way.

Is it documented to work that way? No.

 Do I really have to use NSInvocation for this?

Of course not. There are always alternatives. You could, say, write a
-setActivatedWithNSNumber: method that manually unboxes the number.
You could write a higher-order message for main-thread performs.

Mike
___

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

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

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

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


Re: performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Keith Duncan

Is this supposed to work or not?

 - (void) setActivated:(BOOL)theStatus;

 [view performSelectorOnMainThread:@selector(setActivated:)
withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES];


This won't work since the boolean isn't auto-unboxed. Your method  
should accept an NSNumber wrapping a boolean or use another  
interthread messaging method such as distributed objects or an NSProxy  
subclass.


Keith
___

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

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

Help/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: performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Kirk Kerekes
You don't have to use NSInvocation -- you could instead define a  
category on NSView that wrapped setActivated:


( STANDARD COMPOSED IN MAIL WARNING )

- (void) setActivatedWithObjectValue: (id) value
{
[self setActivated: [value boolValue]];
}

OR

- (void) setActivatedWithObjectValue: (id) value
{
[self setValue: value forKey: @activated];
}

OR, in your thread:

[view performSelectorOnMainThread:  
@selector(setValuesForKeysWithDictionary:) withObject: [NSDictionary  
dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES],  
@activated,nil] waitUntilDone: YES];




Hey folks,

Is this supposed to work or not?

 - (void) setActivated:(BOOL)theStatus;

 [view performSelectorOnMainThread:@selector(setActivated:)
withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES];

It does not seem like it works that way.

Do I really have to use NSInvocation for this?

cheers
--
Torsten

___

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

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

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

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


Re: iphone SDK session duration

2009-04-22 Thread Luke the Hiesterman

What's wrong with the NSDate solution below?

Luke

On Apr 21, 2009, at 10:49 PM, Bess Ho wrote:

I couldn't get any working responses from iphone developer forum or  
iphone meetup group. I am hoping that this group with more  
experience cocoa developers with understanding on MVC model, Xcode.


On Tue, Apr 21, 2009 at 6:47 PM, Luke the Hiesterman luket...@apple.com 
 wrote:

Sounds like you've already answered your question.

Luke


On Apr 21, 2009, at 4:00 PM, Bess Ho wrote:

Is this appropriate mailing list to ask iphone SDK questions?

How do you measure session duration on a utility application with 3
ViewControllers?

Use NSDate to mark the starting and ending the session and print the  
time

lapsed on NSLog.

--
Bess Ho
___

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

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

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

This email sent to luket...@apple.com




--
Bess Ho



___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Chris Williams
Below:

 From: Michael Ash michael@gmail.com
 
 I don't really mind splash screens, although I find them to be
 pointless. However, if your splash screen does not go into the
 background when I click on another app while waiting for your app to
 load, then your app goes into the trash instantaneously.

Of course it doesn't demand being on top.

 
 Much better than a splash screen is to *make your app launch faster*.
 Usually the startup tasks that take forever can be deferred until
 after the basics of the app have been set up. For example, your SQL
 connection doesn't need to be set up while the app is launching

Phhfffttt... The app is a database app.  Without the connection, there is no
app.

 Let
 it launch, set up your menu bar and welcome window and whatever else
 you have, *then* establish the connection. Your icon is no longer
 bouncing, your app is started, and you're in a much better
 environment for a long-running task.

It used to do that.  Then the first time you touched anything it hung to 10
seconds, and people thought the app was broken.

You can load my app quickly by disabling the remember where I was last
checkbox.  Then it doesn't have to search the database several times, and
load the disk directory tree, on startup.  But no one does that.

You seem to live in a world where every app is lightweight.  This app has
over a million records in the SQL database, and indexes well over a million
files in an almost 2TB file set.  Things take time.  Letting your users know
what's going on -- above and beyond a bouncing icon or a spinning beach ball
-- is just common sense.

___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Chris Williams
Completely agreed.  That's just arrogant and insulting.

 From: Benjamin Dobson importedfromsp...@googlemail.com

 I have seen splash screens that have a higher
 window level than normal. This is just wrong. If you're app takes long
 enough to load to warrant a splash screen, it takes long enough to
 load for the user to get impatient and try to do something else.

___

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

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

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

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


NSApplication, AppleEvent and CFRunLoop source strange interaction

2009-04-22 Thread Brian Tietz

I'm working on a cross-platform framework, and am trying to finish up a 
parallel but portable message dispatch mechanism in the framework when its main 
thread is running in NSApplication.  To this end, I'm using 
CFRunLoopSourceCreate/CFRunLoopAddSource as the framework message trigger 
because I can safely trigger the source from other threads using that 
mechanism.  It is working nicely, except for the quit sequencing.  In 
Linux/GTK, the analogous mechanism is installing the read end of a pipe using 
g_io_add_watch, writing to the pipe when a message is posted to my framework, 
and it works perfectly.

For the Cocoa implementation, I have implemented an applicationShouldTerminate 
app delegate notification handler which posts a quit request to my framework 
(triggering it by way of the CFRunLoopSource) and returns NSTerminateCancel.  
That last detail is very unfortunate, but if I return NSTerminateLater the app 
goes into a modal state and neglects the CFRunLoop, with my framework's quit 
request not being received as a consequence.

If I use the dock's application menu to issue a quit request, the 
kAEQuitApplication Apple event ends up in applicationShouldTerminate, then 
after returning NSTerminateCancel the framework message is processed by way of 
the run loop source.  If the application decides that it can indeed quit, it 
sends [ns_application stop: ns_application] and the application quits 
successfully, returning through __CFRunRoolRun, ..., _DPSNextEvent, ..., 
-[NSApplication run], back out to NSApplicationMain.  All good...

The problem arises if the application, in the course of doing its thing decides 
to quit where its activity has been recently isolated to my framework through  
the CFRunLoop source.  My custom quit request message is handled in that 
context, and I send [ns_application stop: ns_application], just as if the quit 
request had originated from an Apple event.  Even though the call stack looks 
identical in these two cases (apple event from dock quit menu item or 
internally initiated quit), the run loop doesn't actually quit in the latter 
case.  I tried following sending the stop message with an explicit call to 
CFRunLoopStop, with no luck.  There seems to be something special about the 
context of having received kAEQuitApplication.

Based on these observations, I tried having my framework, upon making a quit 
decision, post kAEQuitApplication to itself.  Unfortunately, AESendMessage 
crashes inside of findPortByPSN - AECSD_LookupAppleEventPortByPSN - mach_msg 
- mach_msg_trap.  I speculate that AESendMessage normally uses two IPC 
transactions, one to get the port and one to post to the port.  Speculating 
again, but because the application is trying to talk to itself, it can't 
respond to its own request for the port and the transaction breaks down.

Does anyone have a suggestion for a better way to solve the won't quit problem, 
or a better (thread safe) mechanism for triggering my framework than a 
CFRunLoop source?

Also, a somewhat off-topic question from an objective-C newcomer.  I see this 
in the successful quit case:

_DPSNextEvent - AEProcessEvent - ... - -[NSApplication _shouldTerminate] - 
-[_docController:shouldTerminate:] - -[NSAppDelegate 
applicationShouldTerminate:]

I wanted to try simply posting (asynchronously) a quit request right in the Mac 
Objective-C framework, specifically to _shouldTerminate, but I don't see how to 
do that.  The only built-in Objective-C asynchronous messaging I found involved 
NSNotificationQueue, and it didn't seem like the right way to go.  I would 
speculate that NSNotificationQueue would have to use a similar triggering 
mechanism to what I'm doing with the CFRunLoop source, and would break in the 
same manner.  Am I wrong about NSNotificationQueue or overlooking a built-in 
Objective-C feature here?  If it exists, it seems like that would also work 
around the modal state neglects run loop source problem I described earlier 
when returning NSTerminateLater from applicationShouldTerminate.

Thanks,
Brian Tietz


  
___

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

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

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

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


non-movable fullscreen window

2009-04-22 Thread Praveen Innamuri
    Initially I created a window with a title-bar (so, I created a
window with border and resizable/movable properties). However,
depending upon a request, the window should be converted into
fullscreen dynamically (without titlebar, non-resizable, non-movable).
I am trying to set the application into FullScreen manually (as the
setFullScreen API changes the NSWindow handle and it is violating the
rules of my application). I could resize the window to frame of the
screen, but I couldn't find any way to change the window as
'borderless' dynamically. Though I set the MenuBar's visibility to
false, it hides the titlebar, but window still moves when it is
dragged. How can I prevent the window (in full-screen) from being
moved ?
    I tried windowWillMove delegate, but is not helpful. Please
suggest any method to prevent window getting moved (when it is being
dragged) ?

    Thanks in advance,
    Praveen.
___

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

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

Help/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: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit

2009-04-22 Thread Iceberg-Dev


On Apr 22, 2009, at 5:50 PM, Corbin Dunn wrote:


Howdy,

On Apr 22, 2009, at 4:37 AM, Iceberg-Dev wrote:

What's the official way to replace _outlineCell and  
_trackingOutlineCell in Cocoa 64-bit?


I do this for 32-bit:

@implementation NSOutlineView (PrivateCells)

- (NSButtonCell *) outlineCell
{
return _outlineCell;
}


Note that what you are doing is not an official way to make things  
work in 32-bit. It is strongly discouraged to access the ivars to  
AppKit classes, and what you are doing may break in the future.


Well, the future is already there. You can't do for 64-bit  
applications what you can do for 32-bit ones.



There is no way to replace the outlinecell


How could one then draw the disclosure triangle in white (and  
correctly centered vertically) instead of black/dark gray (and  
incorrectly centered)?



-- please log a bug requesting the ability to do so.


Will do.


___

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

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

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

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


Re: Time since Login?

2009-04-22 Thread Gwynne Raskind

On Apr 22, 2009, at 12:00 AM, Jeremy W. Sherman wrote:
How about just nice(1)-ing the process doing the intense processing  
to be

lower-priority, and letting the scheduler sort it all out?


It's my understanding that nice() prioritization is effectively  
meaningless on Darwin, at least according to several open-source  
projects who specifically don't bother with nice()-ing when __APPLE__  
is defined. Was the scheduler changed to make this untrue in 10.5?


-- Gwynne, Daughter of the Code
This whole world is an asylum for the incurable.
___

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

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

Help/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: Really big files and encodings

2009-04-22 Thread Greg Guerin

Seth Willits wrote:

In my app, I import data from potentially very large files. In the  
first pass, I simply mmap'd the entire file, created a string using  
CFStringCreateWithBytesNoCopy, and go about my business. This works  
great until it hits the address limit when it's running as a 32-bit  
process, so now in the second pass I want to rework it a bit to  
only mmap a chunk (128 MB) at a time.


Now, if it were simply binary data, I could chop up the file  
however I wanted, but since the file I'm processing is actually a  
huge *text* file, I need to mmap an appropriate range so creating  
the string doesn't fail because a multi-byte character was split  
down the middle.


Change the buffer management.

Add a cushion to your mmap'ed chunk, say 1 MB, so you mmap in 129 MB  
at a time.  When parsing the first 128 MB, everything proceeds  
normally, and there are no worries about splitting a multi-byte  
character.  You can parse bytes after 128 MB because they're safely  
represented in the cushion area.


When the get-next-string starting position moves into the cushion  
area, then you re-mmap the next chunk (advance by 128 MB, i.e. buffer  
minus cushion) and reposition your pointers in the buffer.  Then you  
have about 128 MB of no worries again.


Choose a cushion size suitable for the maximum length of multi-byte  
sequence.  There's no magic to 1 MB, if something smaller suffices.   
And don't forget the combining character forms where multiple multi- 
byte characters should remain together.


  -- GG

___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Michael Ash
On Wed, Apr 22, 2009 at 1:07 PM, Chris Williams ch...@clwill.com wrote:
 Below:

 From: Michael Ash michael@gmail.com

 I don't really mind splash screens, although I find them to be
 pointless. However, if your splash screen does not go into the
 background when I click on another app while waiting for your app to
 load, then your app goes into the trash instantaneously.

 Of course it doesn't demand being on top.

Very good! Most don't, but some are really bad that way.

 Much better than a splash screen is to *make your app launch faster*.
 Usually the startup tasks that take forever can be deferred until
 after the basics of the app have been set up. For example, your SQL
 connection doesn't need to be set up while the app is launching

 Phhfffttt... The app is a database app.  Without the connection, there is no
 app.

 Let
 it launch, set up your menu bar and welcome window and whatever else
 you have, *then* establish the connection. Your icon is no longer
 bouncing, your app is started, and you're in a much better
 environment for a long-running task.

 It used to do that.  Then the first time you touched anything it hung to 10
 seconds, and people thought the app was broken.

I'm not saying that you load it lazily on demand. I'm saying that you
get the app up and running in a minimal fashion, and *then* establish
the connection. Do it immediately, but after you've officially
launched. If you do it modelessly, then the user can still access
whatever features don't rely on the connection. That might just be the
about box, but maybe that's what they're after. If you do it modally
then at least your dock icon stopped bouncing and you can easily
switch to the app to check on its progress and such.

 You can load my app quickly by disabling the remember where I was last
 checkbox.  Then it doesn't have to search the database several times, and
 load the disk directory tree, on startup.  But no one does that.

 You seem to live in a world where every app is lightweight.  This app has
 over a million records in the SQL database, and indexes well over a million
 files in an almost 2TB file set.  Things take time.  Letting your users know
 what's going on -- above and beyond a bouncing icon or a spinning beach ball
 -- is just common sense.

Sure, I'm just saying that there are generally better ways to let them
know than a splash screen.

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


Scaling an entire CGPath?

2009-04-22 Thread Maryanna Rogers
Hi,

I need to take a CGPath (a set of lines, curves, etc.) and scale the
entire thing as a whole. Is there a simple way to do this?

Do I need to use CGPathApply somehow?

~m
___

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

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

Help/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: NSApplication, AppleEvent and CFRunLoop source strange interaction

2009-04-22 Thread Ken Thomases

On Apr 21, 2009, at 9:10 PM, Brian Tietz wrote:

I'm working on a cross-platform framework, and am trying to finish  
up a parallel but portable message dispatch mechanism in the  
framework when its main thread is running in NSApplication.  To this  
end, I'm using CFRunLoopSourceCreate/CFRunLoopAddSource as the  
framework message trigger because I can safely trigger the source  
from other threads using that mechanism.  It is working nicely,  
except for the quit sequencing.  In Linux/GTK, the analogous  
mechanism is installing the read end of a pipe using g_io_add_watch,  
writing to the pipe when a message is posted to my framework, and it  
works perfectly.


For the Cocoa implementation, I have implemented an  
applicationShouldTerminate app delegate notification handler which  
posts a quit request to my framework (triggering it by way of the  
CFRunLoopSource) and returns NSTerminateCancel.  That last detail is  
very unfortunate, but if I return NSTerminateLater the app goes into  
a modal state and neglects the CFRunLoop, with my framework's quit  
request not being received as a consequence.


It's not neglecting the run loop.  It's just running it in a different  
mode.  The documentation for NSTerminateLater says it's running it in  
the NSModalPanelRunLoopMode.  So, just add your run loop source in  
that same mode, in addition to the default mode.  Then, you can use  
NSTerminateLater and all of your headaches vanish.


Cheers,
Ken

___

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

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

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

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


Re: Time since Login?

2009-04-22 Thread Greg Guerin

Trygve Inda wrote:


(b) elapsed time since startup



Boot-time is available from sysctl, name kern.boottime.  There's  
also a function, whose name I forget, that returns microseconds since  
startup.  I wouldn't be surprised if there were additional ways to  
get this info.



My goal is to delay some intense processing until the system is  
fully up and
running as it seems to do a lot of housekeeping at startup. Is  
there also a

way to determine some sort of overall system activity?



If the user has started your program to do something, then why is  
your program trying to second-guess the OS's scheduler?  Maybe you  
should rely on the scheduler to allocate resources, instead of second- 
guessing what a suitable level of inactivity is.



It may be enough for me if I can just delay a few things until 1  
minute

after login.



What is this for: A user-launched app?  An auto-launched app?  A  
daemon/agent?


Again, is the user expecting your program to do something  
immediately, or is the user aware that the action may be delayed?


  -- GG

___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Greg Guerin

Michael Ash wrote:


I'm not saying that you load it lazily on demand. I'm saying that you
get the app up and running in a minimal fashion, and *then* establish
the connection. Do it immediately, but after you've officially
launched. If you do it modelessly, then the user can still access
whatever features don't rely on the connection. That might just be the
about box, but maybe that's what they're after. If you do it modally
then at least your dock icon stopped bouncing and you can easily
switch to the app to check on its progress and such.



I suggest showing the long-running action using the app's normal way  
of showing long-running actions, whatever that might be.


An example of this is Safari, if it has a home page that takes some  
time to load.  There's no splash or loading screen; Safari just  
presents its normal window with its normal connecting and loading  
indicator, exactly the same as if you'd clicked a link to a page that  
takes a long time to load.


If the only possible long-running action for the app occurs at  
launch, then an I'm working splash screen or other window might  
make sense.  But if the app has a normal way of showing the user that  
an action is taking a long time to complete, I recommend using that  
over a specialized launch-only window.


  -- GG
___

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

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

Help/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: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit

2009-04-22 Thread Corbin Dunn


On Apr 22, 2009, at 10:29 AM, Iceberg-Dev wrote:



On Apr 22, 2009, at 5:50 PM, Corbin Dunn wrote:


Howdy,

On Apr 22, 2009, at 4:37 AM, Iceberg-Dev wrote:

What's the official way to replace _outlineCell and  
_trackingOutlineCell in Cocoa 64-bit?


I do this for 32-bit:

@implementation NSOutlineView (PrivateCells)

- (NSButtonCell *) outlineCell
{
return _outlineCell;
}


Note that what you are doing is not an official way to make things  
work in 32-bit. It is strongly discouraged to access the ivars to  
AppKit classes, and what you are doing may break in the future.


Well, the future is already there. You can't do for 64-bit  
applications what you can do for 32-bit ones.


It may break in future releases of your 32-bit applications too. We  
may change how the ivar is used, or decide not to use it at all.





There is no way to replace the outlinecell


How could one then draw the disclosure triangle in white


Leopard has a bug with them looking too dark; that is a known issue,  
and it will be fixed. There is no easy way to make them white, but in  
the -willDisplayOutlineCell method you can replace the image on the  
NSButtonCell.



(and correctly centered vertically) instead of black/dark gray (and  
incorrectly centered)?


Override frameOfOutlineCellAtRow: and place it where you want.





-- please log a bug requesting the ability to do so.


Will do.




thanks!
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: performSelectorOnMainThread primitives for withObject

2009-04-22 Thread Torsten Curdt
 It does not seem like it works that way.

 Is it documented to work that way? No.

I wish it would always be that simple with documentation :)
But seriously - I could have just missed it. Stuff like that do
happens sometimes ;)

 Do I really have to use NSInvocation for this?

 Of course not. There are always alternatives. You could, say, write a
 -setActivatedWithNSNumber: method that manually unboxes the number.

That's what I am doing now. But that makes me feel dirty.

 You could write a higher-order message for main-thread performs.

Just had the idea to add an un-boxed version of
performSelectorOnMainThread to NSObject via Category.

But could you elaborate on the HOM a bit. Not sure I can follow there.

cheers
--
Torsten
___

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

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

Help/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: Scaling an entire CGPath?

2009-04-22 Thread David Duncan

On Apr 22, 2009, at 10:54 AM, Maryanna Rogers wrote:


I need to take a CGPath (a set of lines, curves, etc.) and scale the
entire thing as a whole. Is there a simple way to do this?

Do I need to use CGPathApply somehow?



Typically you would just scale the context that you are drawing the  
path to...

--
David Duncan
Apple DTS Animation and Printing

___

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

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

Help/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: Scaling an entire CGPath?

2009-04-22 Thread Maryanna Rogers
This path will never be drawn.

~m

On Wed, Apr 22, 2009 at 8:23 PM, David Duncan david.dun...@apple.com wrote:
 On Apr 22, 2009, at 10:54 AM, Maryanna Rogers wrote:

 I need to take a CGPath (a set of lines, curves, etc.) and scale the
 entire thing as a whole. Is there a simple way to do this?

 Do I need to use CGPathApply somehow?


 Typically you would just scale the context that you are drawing the path
 to...
 --
 David Duncan
 Apple DTS Animation and Printing


___

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

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

Help/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 make app login window to look like OS X user login window ?

2009-04-22 Thread Shawn Erickson
On Wed, Apr 22, 2009 at 9:06 AM, Chris Williams ch...@clwill.com wrote:

 blah blah... Far better than a spinning beach ball.

If written well an application can launch quickly and then get into UI
that informs the user that a lengthy process is taking place while
ideally letting them do other tasks that aren't blocked by the length
task. A splash screen is generally a bad way to do that on Mac OS X,
as is causing the beach ball to show.

Review... (can't find the blob of text that I recall explicitly
talking about splash screens)

http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGHIDesign/XHIGHIDesign.html#//apple_ref/doc/uid/TP3353-TPXREF106

http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGHIDesign/XHIGHIDesign.html#//apple_ref/doc/uid/TP3353-TPXREF110

-Shawn
___

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

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

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

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


objc_exception_throw prior to launching nib file

2009-04-22 Thread Daniel Child

Hi All,

I have a Core Data app that I am trying to debug.

If I simply run it, the main window loads fine.

If I try to run in debug mode, an exception is thrown before even  
loading the main nib. This problem seems to have started when I tried  
to put manual breakpoints in the code. Now, just hitting debug/run  
causes it to hang, regardless of whether manual breakpoints are  
activated. (objc_exception_throw is symbolic).


Since none of the methods below are things I have written, I'm not  
sure where to go from here. How can I go about finding out what is  
causing this?


Thanks.

Backtrace to follow

#0  0x93192e17 in objc_exception_throw ()
#1  0x92022eeb in +[NSException raise:format:arguments:] ()
#2  0x92022f2a in +[NSException raise:format:] ()
#3  0x95140ff5 in -[_NSManagedProxy _managedObjectContext] ()
#4  0x95141026 in -[_NSManagedProxy _persistentStoreCoordinator] ()
#5  0x951410b4 in -[_NSManagedProxy _entity] ()
#6  0x95141379 in -[_NSManagedProxy  
fetchRequestWithSortDescriptors:limit:] ()
#7  0x94fe38cc in -[NSArrayController(NSManagedController)  
defaultFetchRequest] ()
#8  0x95140a74 in -[NSObjectController(NSManagedController)  
_executeFetch:didCommitSuccessfully:actionSender:] ()

#9  0x9527003e in _NSSendCommitEditingSelector ()
#10 0x95056d54 in -[NSController  
_controllerEditor:didCommit:contextInfo:] ()

#11 0x92028a3d in __invoking___ ()
#12 0x92028428 in -[NSInvocation invoke] ()
#13 0x920284f8 in -[NSInvocation invokeWithTarget:] ()
#14 0x90a4922e in __NSFireDelayedPerform ()
#15 0x91fa9b25 in CFRunLoopRunSpecific ()
#16 0x91fa9cd8 in CFRunLoopRunInMode ()
#17 0x901b62c0 in RunCurrentEventLoopInMode ()
#18 0x901b6012 in ReceiveNextEventCommon ()
#19 0x901b5f4d in BlockUntilNextEventMatchingListInMode ()
#20 0x94c41d7d in _DPSNextEvent ()
#21 0x94c41630 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:] ()

#22 0x94c3a66b in -[NSApplication run] ()
#23 0x94c078a4 in NSApplicationMain ()
#24 0x1d70 in main (argc=1, argv=0xb434) at /Users/../ 
main.m:13


___

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

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

Help/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: Time since Login?

2009-04-22 Thread Sean McBride
On 4/22/09 3:43 AM, Trygve Inda said:

(b) elapsed time since startup

The old TickCount() API returns this.

--

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


___

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

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

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

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


Re: objc_exception_throw prior to launching nib file

2009-04-22 Thread Nick Zitzmann


On Apr 22, 2009, at 12:36 PM, Daniel Child wrote:

Since none of the methods below are things I have written, I'm not  
sure where to go from here. How can I go about finding out what is  
causing this?



Start by printing the exception to the console using the po command  
when the exception is thrown.


Intel 32: po *(int *)($ebp+8)
Intel 64: po $rdi
PPC: po $r3

What does it say?

Nick Zitzmann
http://www.chronosnet.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


-[NSSharedWorkspace openFile:]: Application exits with status 255

2009-04-22 Thread Sidney San Martín
I'm running into an issue that's above my skill level and could really
use some guidance. My application has an SUID-root update utility (I
know that's unusual, but it's an internal application that needs to be
able to update itself even when the logged-in user isn't privileged)
stored inside the application bundle. It downloads the update, sends a
message back to the parent application that it's OK to quit, moves the
new copy into place, and launches it.

That last bit is giving me issues. I'm using -[NSWorkspace openFile:]
to do the actual relaunching. It returns YES, but my application
doesn't launch and com.apple.launchd[152]
([0x0-0xb80b8].com.mycompany.MyApplication[3836]) Exited with exit
code: 255 appears in the Console.

I noticed that at this point, if I use open (on the command line) to
try to launch my (updated) application, it works. However, if I sudo
open, it prints LSOpenFromURLSpec() failed with error -10810 for the
file  -10810 translates to Unexpected internal error.

If I touch the application bundle, open starts working as me and as
root. Following this thread, I tried calling utimes() from my helper
before openFile:, but run into the same condition. I've also tried
LSRegisterURL() with no change. Can anyone give me a hint as to what's
happening here? I'm lost.
___

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

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

Help/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: file extensions and Mime Type

2009-04-22 Thread Sean McBride
On 4/22/09 11:31 AM, rajesh said:

We have listed few mime types which we support and mapped them
accordingly for processing.
How can one retrieve the Mime type for a particular file?

The filesystem does not store a file's mime type nor its UTI as part of
the file's metadata.  The only filesystem metadata available is the file
name extension and HFS type.  Those are what Launch Services consults to
decide the UTI.

--

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


___

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

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

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

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


Re: Scaling an entire CGPath?

2009-04-22 Thread David Duncan

On Apr 22, 2009, at 11:25 AM, Maryanna Rogers wrote:


This path will never be drawn.



Then we probably need to know what you are trying to accomplish to  
give you the best advice.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

Help/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: objc_exception_throw prior to launching nib file

2009-04-22 Thread Daniel Child

It says

Running…
(gdb) po $rdi
Value can't be converted to integer.
(gdb)


On Apr 22, 2009, at 2:56 PM, Nick Zitzmann wrote:



On Apr 22, 2009, at 12:36 PM, Daniel Child wrote:

Since none of the methods below are things I have written, I'm not  
sure where to go from here. How can I go about finding out what is  
causing this?



Start by printing the exception to the console using the po command  
when the exception is thrown.


Intel 32: po *(int *)($ebp+8)
Intel 64: po $rdi
PPC: po $r3

What does it say?

Nick Zitzmann
http://www.chronosnet.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: objc_exception_throw prior to launching nib file

2009-04-22 Thread Nick Zitzmann


On Apr 22, 2009, at 1:28 PM, Daniel Child wrote:


It says

Running…
(gdb) po $rdi
Value can't be converted to integer.
(gdb)



Are you sure your program is running as Intel 64? The $rdi register is  
only available to X86-64 applications. In 32-bit Intel apps, arguments  
to functions are placed on the stack, which is in the $ebp register.


Nick Zitzmann
http://www.chronosnet.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: non-movable fullscreen window

2009-04-22 Thread douglas welton

Hi Praveen,

1)  At present (leopard), you can't dynamically change the windows  
style from bordered to non-bordered.  The style is set at  
initialization and you can't change it after that.  See the Window  
Programming Guide section for Setting a Window's Appearance


2)  When you say you use the setFullScreen API do you mean the old  
Carbon function?  Or do you mean using - 
enterFullScreenMode:WithOptions: on the window's contentView?  This  
later option works quite well and I think it is probably what you are  
looking for.  The documentation has more details


3) In regards to dragging your newly-enlarged window, have you tried  
using NSWindow's -setMovableByWindowBackground: method?  Check the  
documentation, if you still need this method.


regards,

douglas

On Apr 22, 2009, at 9:15 AM, Praveen Innamuri wrote:


Initially I created a window with a title-bar (so, I created a
window with border and resizable/movable properties). However,
depending upon a request, the window should be converted into
fullscreen dynamically (without titlebar, non-resizable, non-movable).
I am trying to set the application into FullScreen manually (as the
setFullScreen API changes the NSWindow handle and it is violating the
rules of my application). I could resize the window to frame of the
screen, but I couldn't find any way to change the window as
'borderless' dynamically. Though I set the MenuBar's visibility to
false, it hides the titlebar, but window still moves when it is
dragged. How can I prevent the window (in full-screen) from being
moved ?
I tried windowWillMove delegate, but is not helpful. Please
suggest any method to prevent window getting moved (when it is being
dragged) ?

Thanks in advance,
Praveen.

___

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

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

Help/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: Scaling an entire CGPath?

2009-04-22 Thread Tobias Zimmerman
Sorry if I am missing the point, but is [CG|NS]AffineTransform what you are
looking for?  I have only used them in at the Cocoa view level
(NSBezierPath, NSAffineTransform), so my information may not be correct for
CGPath.

The Transforms section of the Quartz 2D guide may be helpful:
file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.Cor
eReference.docset/Contents/Resources/Documents/documentation/GraphicsImaging
/Conceptual/drawingwithquartz2d/dq_affine/dq_affine.html
 --
 
 Message: 3
 Date: Wed, 22 Apr 2009 19:54:55 +0200
 From: Maryanna Rogers maryanna.rog...@gmail.com
 Subject: Scaling an entire CGPath?
 To: Cocoa Dev Dev cocoa-dev@lists.apple.com
 Message-ID:
 770943e00904221054h56c04c3fj4029c2aba47b1...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1
 
 Hi,
 
 I need to take a CGPath (a set of lines, curves, etc.) and scale the
 entire thing as a whole. Is there a simple way to do this?
 
 Do I need to use CGPathApply somehow?
 
 ~m
 


___

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

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

Help/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: Opening file with C++ iostream from application bundle

2009-04-22 Thread Scott Ribe
You need to use a full path, not count on the default directory--and others
have provided code to get the path.

-- 
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: Scaling an entire CGPath?

2009-04-22 Thread Henry McGilton (Boulevardier)


On Apr 22, 2009, at 11:25 AM, Maryanna Rogers wrote:


This path will never be drawn.

~m

On Wed, Apr 22, 2009 at 8:23 PM, David Duncan  
david.dun...@apple.com wrote:

On Apr 22, 2009, at 10:54 AM, Maryanna Rogers wrote:


I need to take a CGPath (a set of lines, curves, etc.) and scale the
entire thing as a whole. Is there a simple way to do this?

Do I need to use CGPathApply somehow?



Typically you would just scale the context that you are drawing the  
path

to...


Without further information as to what you're trying to accomplish, we  
can't see

what the real problem is.

Making some assumptions:

1.   If you are constructing the path yourself, surely simple  
multiplication of the
   path coordinates by the scale factor(s) prior to adding the  
specific element

   to the path should do the trick.

2.   If you have been handed a path and need to scale it, you can use  
a Path
  Applier function in conjunction with CGPathApply to play back  
each element
 of the path.See CGPathApply, CGPathApplierFunction, and  
CGPathElement

 for further details.

Cheers,
. . . . . . . .Henry


___

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

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

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

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


NSProgressIndicator

2009-04-22 Thread Livio Isaia
I have a NSProgressIndicator that indicates the progress of a disk 
saving job.

Initially it's hidden so:

[myIndicator setMaxValue:count];
[myIndicator setMinValue:0];
[myIndicator setDoubleValue:0];
[myIndicator setHidden:NO];
[myIndicator displayIfNeeded];

Then I do the job calling:

[myIndicator incrementBy:1];
[myIndicator displayIfNeeded];

And finally:

[myIndicator setHidden:YES];
[myIndicator displayIfNeeded];
[myIndicator setMaxValue:0];
[myIndicator setMinValue:0];
[myIndicator setDoubleValue:0];

The first time all works perfectly, but the second, when I reset the 
indicator, no: the indicator is displayed but remains blank, that is it 
doesn't show any progress. What's going wrong?


Thank you all in advance,
best regards,
livio.
___

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

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

Help/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: objc_exception_throw prior to launching nib file

2009-04-22 Thread Daniel Child

Well, I think so. I thought all Core2 Duos run 64-bit.

The build settings are for Xcode 3.1, OS 10.5. Are there any other  
settings I should be concerned with?


Also, tried the Intel 32-bit, and that also said it couldn't be  
converted to an integer.


On Apr 22, 2009, at 3:31 PM, Nick Zitzmann wrote:



On Apr 22, 2009, at 1:28 PM, Daniel Child wrote:


It says

Running…
(gdb) po $rdi
Value can't be converted to integer.
(gdb)



Are you sure your program is running as Intel 64? The $rdi register  
is only available to X86-64 applications. In 32-bit Intel apps,  
arguments to functions are placed on the stack, which is in the $ebp  
register.


Nick Zitzmann
http://www.chronosnet.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: objc_exception_throw prior to launching nib file

2009-04-22 Thread Nick Zitzmann


On Apr 22, 2009, at 2:13 PM, Daniel Child wrote:


Well, I think so. I thought all Core2 Duos run 64-bit.


Yes, but what is the architecture of your program? Is it i386 or is it  
x86_64? If it's the former, then it is not an Intel 64 program. If you  
don't know, then it's probably i386.


Also, tried the Intel 32-bit, and that also said it couldn't be  
converted to an integer.



Did you try it exactly as I wrote it earlier? And are you running the  
command just after the debugger breaks?


Nick Zitzmann
http://www.chronosnet.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: objc_exception_throw prior to launching nib file

2009-04-22 Thread Daniel Child

You're right.

(gdb) po $rdi
Value can't be converted to integer.
(gdb) po *(int *)($ebp+8)
Cannot access memory at address 0x1
(gdb)

On Apr 22, 2009, at 4:16 PM, Nick Zitzmann wrote:



On Apr 22, 2009, at 2:13 PM, Daniel Child wrote:


Well, I think so. I thought all Core2 Duos run 64-bit.


Yes, but what is the architecture of your program? Is it i386 or is  
it x86_64? If it's the former, then it is not an Intel 64 program.  
If you don't know, then it's probably i386.


Also, tried the Intel 32-bit, and that also said it couldn't be  
converted to an integer.



Did you try it exactly as I wrote it earlier? And are you running  
the command just after the debugger breaks?


Nick Zitzmann
http://www.chronosnet.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: Really big files and encodings

2009-04-22 Thread Seth Willits

On Apr 22, 2009, at 8:09 AM, Michael Ash wrote:


Do your files have regularly occurring newlines like most normal text
files? If so, then you can just scan for a \r or \n and break it up
there. Virtually every encoding you'll encounter today encodes \r and
\n as \r and \n, and will not use those bytes for anything else.


You know what... I should have thought of that. :-)

I remembered we all talked about something very similar on a previous  
thread and I now I remember that I even brought up this same idea  
since I'm doing it elsewhere in this same app, but I totally didn't  
even think of it this time.


Heh. Well shoot. Nevermind. :-)


Thanks,

--
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: objc_exception_throw prior to launching nib file

2009-04-22 Thread Nick Zitzmann


On Apr 22, 2009, at 2:20 PM, Daniel Child wrote:


(gdb) po *(int *)($ebp+8)
Cannot access memory at address 0x1
(gdb)



Something's still not right here. On Intel 32, $ebp+8 points to the  
first argument in a function call, which would be the NSException  
object passed into objc_exception_throw().


Are you sure you are trying this after, and **only** after, the  
debugger hits objc_exception_throw(), but before continuing execution?  
If so, are you sure you are looking at the top of the stack?


If it helps, I always put the following two debugger commands into my  
objc_exception_throw breakpoints:


po *(int *)($ebp+8)
po $rdi

(The latter is for debugging 64-bit apps, since there's apparently no  
way to set debugger commands on a per-architecture basis.)


Nick Zitzmann
http://www.chronosnet.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


Identical Attributes, Only one works

2009-04-22 Thread Walker Argendeli

I realize that this question is very vague, but I'm just baffled but it.

I have an NSLevelIndicator with its value bound to my model's  
myEntity.Selection.Priority attribute.  Priority is a required Float  
with a min value of 0, max of 3, and default of 1.  How it functions  
is that I have a table view, and I want to select an item in a table  
view and modify its priority.  The problem is that if I select an  
item, modify the priority through the level indicator, go to another  
item, and then click back to the original item, the level indicator  
has gone back to its default value.


I had no idea, so I created an attribute called myPriority and made it  
exactly the same as priority.  I then bound the level indicator's  
value to my model's myEntity.Selection.myPriority attribute.  Except  
this time it works.  So I do a project find to find any files that  
mention priority, and I hit on a file.  The level indicator also has  
an IBAction and an IBOutlet, both of which are links to this file.  So  
I thought, it must be this, except all the code in that files is  
commented out.  Right now, all that should be happening is the  
simplest behavior of setting the priority, and yet it works with one  
and doesn't work with another.  Does anyone have any ideas of further  
places to look?


Thanks,
- Walker Argendeli

___

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

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

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

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


Re: Problem implementing keyPathsForvaluesAffectingKey

2009-04-22 Thread Sean McBride
On 4/22/09 3:45 PM, jonat...@mugginsoft.com said:

+ (NSSet *)keyPathsForValuesAffectingCanDelete
{
 return [NSSet setWithObjects:@property1, @property2,
@arrayController.canRemove, nil];
}

I, and others, have never been able to get dependent key paths working
when you traverse a controller like that.  See for example:

http://www.cocoabuilder.com/archive/message/cocoa/2008/6/18/210478

--

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


___

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

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

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

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


Re: non-movable fullscreen window

2009-04-22 Thread Sean McBride
On 4/22/09 6:45 PM, Praveen Innamuri said:

    Initially I created a window with a title-bar (so, I created a
window with border and resizable/movable properties). However,
depending upon a request, the window should be converted into
fullscreen dynamically (without titlebar, non-resizable, non-movable).
I am trying to set the application into FullScreen manually (as the
setFullScreen API changes the NSWindow handle and it is violating the
rules of my application). I could resize the window to frame of the
screen, but I couldn't find any way to change the window as
'borderless' dynamically.

You can't. rdar://6037134

Though I set the MenuBar's visibility to
false, it hides the titlebar, but window still moves when it is
dragged. How can I prevent the window (in full-screen) from being
moved ?
    I tried windowWillMove delegate, but is not helpful. Please
suggest any method to prevent window getting moved (when it is being
dragged) ?

Have you searched the archives for suggestions about implementing full
screen?  This has been discussed many times.

--

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


___

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

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

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

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


Re: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Jean-Daniel Dupas


Le 22 avr. 09 à 20:31, Shawn Erickson a écrit :

On Wed, Apr 22, 2009 at 9:06 AM, Chris Williams ch...@clwill.com  
wrote:



blah blah... Far better than a spinning beach ball.


If written well an application can launch quickly and then get into UI
that informs the user that a lengthy process is taking place while
ideally letting them do other tasks that aren't blocked by the length
task. A splash screen is generally a bad way to do that on Mac OS X,
as is causing the beach ball to show.


And the worst is that  if the long task blocks the event loop, there  
is no way to cancel it…



___

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

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

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

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


Re: objc_exception_throw prior to launching nib file

2009-04-22 Thread Daniel Child

OK, I've set those commands and got this.

Running…
Cannot perform operation without a managed object context
Value can't be converted to integer.
(gdb)

I'm not sure why it thinks it needs one BEFORE I do anything. I  
described things slightly incorrectly.


If I set a breakpoint:

the window (from nib) appears
then gdb comes up

What is strange is that the breakpoint should not be executed I press  
a button in the window. In fact, if I don't set a manual breakpoint  
and run the app, I can in fact press the button and perform an action.  
(The action needs to be debugged, but that is a separate matte.) The  
problem is not being able to debug the portion of code after the  
window appears.


If a managed object context were needed at that point, it should have  
said something when I run without code. No?


On Apr 22, 2009, at 4:28 PM, Nick Zitzmann wrote:



On Apr 22, 2009, at 2:20 PM, Daniel Child wrote:


(gdb) po *(int *)($ebp+8)
Cannot access memory at address 0x1
(gdb)



Something's still not right here. On Intel 32, $ebp+8 points to the  
first argument in a function call, which would be the NSException  
object passed into objc_exception_throw().


Are you sure you are trying this after, and **only** after, the  
debugger hits objc_exception_throw(), but before continuing  
execution? If so, are you sure you are looking at the top of the  
stack?


If it helps, I always put the following two debugger commands into  
my objc_exception_throw breakpoints:


po *(int *)($ebp+8)
po $rdi

(The latter is for debugging 64-bit apps, since there's apparently  
no way to set debugger commands on a per-architecture basis.)


Nick Zitzmann
http://www.chronosnet.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


Removing or ignoring lineWidth property of an NSBezierPath instance

2009-04-22 Thread Tobias Zimmerman
I am trying to find a way to ensure that a series of NSBezierPaths are drawn
using [NSBezierPath defaultLineWidth] value.  However, contrary to
documentation and expectation, my paths seem to automatically assign
themselves the value 1.0 for their own lineWidth property.

First, the documentation for NSBezierPath¹s -(CGFloat)lineWidth method
states that: If no value was set explicitly for the receiver, this method
returns the default line width.  This suggests that a newly created
NSBezierPath should have no value set for lineWidth.


The following custom view class demonstrates the problem:

@interface AppView : NSView {
NSMutableArray*pathsToDraw;
}
@end

@implementation AppView

- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
pathsToDraw = [NSMutableArray array];
[pathsToDraw retain];

//Creates a series of 10 overlapping boxes stored in an array
CGFloat boxWidth = 15.0;
CGFloat boxHeight = 12.0;

for (int i = 0; i  10; i++) {

NSBezierPath *newPath = [NSBezierPath
bezierPathWithRect:NSMakeRect(i * (boxWidth + 1.0), i * (boxHeight + 1.0), i
* boxWidth, i * boxHeight)];
[pathsToDraw addObject:newPath];
//Note, we never call [newPath setLineWidth], so none of the paths should
have its lineWidth property set
}
}
return self;
}

- (void)drawRect:(NSRect)rect {

[[NSColor blackColor] set];

//set default to an arbitrary number other than 1.0  This is the width we
want the paths to be drawn with.
[NSBezierPath setDefaultLineWidth:4.0];

for (NSBezierPath *path in pathsToDraw) {

/* The following line logs the specific and default line widths.  Since we
never set any lineWidth for any of the paths in the array, these values
should be identical, or, at least that¹s what the documentation suggests.
*/

NSLog(@Path width = %0.3f; default width = %0.3f, [path
lineWidth], [NSBezierPath defaultLineWidth]);
[path stroke];
}

// The following line proves that the defaultLineWidth class property of
NSBezierPath is functioning, as the resulting box is drawn at the correct
thickness
[NSBezierPath strokeRect:[self bounds]];
}

@end

The output from the NSLog statement is the following line (10 times):

 2009-04-22 16:30:21.640 BezPathLineWidthTester[7347:10b] Path width = 1.000;
 default width = 4.000

Changing the value passed to [NSBezierPath setDefaultLineWidth:] has no
effect on the boxes drawn out of the array, although it does effect the
³anonymous² path created by the strokeRect command.

So, my question(s): is there a way to remove or ignore an NSBezierPath¹s
individual lineWidth property in favor of the default?  (Note that setting
the individual path¹s lineWidth property to 0.0 will not work because a
lineWidth of 0.0 has a specific meaning to the drawing system.  Since this
property is a float, it can¹t be set to nil).   Is this indeed a bug (either
in NSBezierPath or in the documentation), or am I overlooking something?

(By way of further explanation, the project this arises in involves a set of
bezier paths that are generated in one program and archived for use in a
separate program.  I would like the lineWidth and other drawing specifics
such as line/fill colors to be controlled by the view where the reusable
paths are drawn, rather than a property of the paths themselves).



___

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

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

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

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


NSOpenPanel listing .app's and Mac OS X executables

2009-04-22 Thread Arun
Hi,

Is there any way when a NSOpenPanel is launched, only .app's and Mac OS X
executables are allowed to select and gray out all the other file types?

Thanks
Arun
___

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

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

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

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


Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness

2009-04-22 Thread Melissa J. Turner


On Apr 22, 2009, at 02:12, Mike Abdullah wrote:



On 22 Apr 2009, at 08:48, Ben Trumbull wrote:


Of course, why Apple couldn't have then added automatic support
for in-memory matching as the second step I don't know


Probably because nobody ever cared enough to file an enhancement  
request, and it didn't occur to us that writing 1 line of code to  
call filteredArrayWithPredicate was so troublesome.


Calling -filteredArrayWithPredicate is no hassle, but for a large  
predicate, it has the bad performance of comparing a bunch of the  
persistent properties all over again, despite already knowing  
they'll match the predicate. Since I assume Core Data must do some  
kind of internal splitting up of the predicate in order to perform  
its fetch, I'd have thought it is in a good position to know what  
the remaining transient portion of the predicate is.


You assume incorrectly.

CoreData simply translates the predicate to SQL and passes it down to  
SQLite as a WHERE clause. Hence the lack of support for transient  
properties: SQLite has no idea what to do when you ask it to qualify  
by a column that doesn't exist in its schema.


+Melissa

___

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

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

Help/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: -[NSSharedWorkspace openFile:]: Application exits with status 255

2009-04-22 Thread Kyle Sluder
You would be very well served to read TN2083, Daemons and Agents:
http://developer.apple.com/technotes/tn2005/tn2083.html .  You seem to
be unaware of some of the pretty important architectural
considerations that will affect your implementation.  Notably, some
things changed in Leopard that will have significant effects on your
ability to communicate between applications.

--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: Bindings making NSNumberFormatter strange

2009-04-22 Thread Ulai Beekam

Noone has an idea?


To elaborate, when not using bindings, the default behavior of text fields with 
a number formatter is that when a user tries to enter abc in it, the text 
field refuses to lose focus and makes a beeping sounds.

However, when the text field's value binding has been set, a sheet is shown, 
which I think is a bad user experience.

In fact it would be even better to just disallow entering of invalid characters 
in the first place. But such a method would have to work even if the text 
field's value binding is set.

Thank you,
U



 From: ulaibee...@hotmail.com
 To: cocoa-dev@lists.apple.com
 Date: Wed, 22 Apr 2009 15:26:51 +
 Subject: Bindings making NSNumberFormatter strange


 Hi,

 I have an (editable) NSTextField with an NSNumberFormatter attached to it. 
 The text field is bound to some other numerical property (if you want to test 
 this, you can just make a simple AppController and put the 
 @property(readwrite) int foo; inside it, and bind the text field to 
 AppController's foo).

 My problem is that when I type some invalid stuff in the text field, such as 
 some letters abc, I don't get a beep (which is the normal behaviour and the 
 one I want), but I get some sheet popping up saying Formatting Error. I 
 don't want this sheet. I want the beep like usual. How can I get rid of this 
 sheet behaviour that the bindings is causing? And why is it even causing it?

 Second question: How can I make my text field just disallow entering of 
 invalid characters in the first place (and producing beep when it is tried)? 
 I want, as you probably guessed, a method that is compatible with bindings.

 Thanks very much,
 U



.
_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/___

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

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

Help/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: NSOpenPanel listing .app's and Mac OS X executables

2009-04-22 Thread Dave Keck
- (void)setAllowedFileTypes:(NSArray *)types
___

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

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

Help/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: NSOpenPanel listing .app's and Mac OS X executables

2009-04-22 Thread Kyle Sluder
On Wed, Apr 22, 2009 at 5:59 PM, Dave Keck davek...@gmail.com wrote:
 - (void)setAllowedFileTypes:(NSArray *)types

Note that on Leopard this method takes an array of UTIs, so you might
want to take a look at the list of System-Declared UTIs at
http://developer.apple.com/DOCUMENTATION/Carbon/Conceptual/understanding_utis/utilist/UTIlist.html
and choose the ones you want to specify.

--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: Time since Login?

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 18:31, Gwynne Raskind wrote:


On Apr 22, 2009, at 12:00 AM, Jeremy W. Sherman wrote:
How about just nice(1)-ing the process doing the intense processing  
to be

lower-priority, and letting the scheduler sort it all out?


It's my understanding that nice() prioritization is effectively  
meaningless on Darwin, at least according to several open-source  
projects who specifically don't bother with nice()-ing when  
__APPLE__ is defined. Was the scheduler changed to make this untrue  
in 10.5?


Unless I'm very much mistaken, the last time I used it nice()  
prioritisation seemed to work OK on OS X, so I'm not sure where  
they're getting their information.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: file extensions and Mime Type

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 20:14, Sean McBride wrote:


On 4/22/09 11:31 AM, rajesh said:


We have listed few mime types which we support and mapped them
accordingly for processing.
How can one retrieve the Mime type for a particular file?


The filesystem does not store a file's mime type nor its UTI as part  
of
the file's metadata.  The only filesystem metadata available is the  
file
name extension and HFS type.  Those are what Launch Services  
consults to

decide the UTI.



In the case of a bundle, IIRC it may also consult Info.plist, and  
there's nothing stopping Apple from adding additional mechanisms in  
future.


Anyway, UTIs are the right way to go, generally speaking, which was  
the point.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Removing or ignoring lineWidth property of an NSBezierPath instance

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 22:19, Tobias Zimmerman wrote:


First, the documentation for NSBezierPath’s -(CGFloat)lineWidth method
states that: If no value was set explicitly for the receiver, this  
method

returns the default line width.  This suggests that a newly created
NSBezierPath should have no value set for lineWidth.


I think it means that it behaves exactly how your code demonstrates  
that it does.  By which I mean that when you create an NSBezierPath,  
the initial lineWidth is whatever the default was set to at the time  
of creation.


I don't think any other behaviour is very likely, especially given  
that, as you correctly point out, doing something else would mean  
either reserving some special value or adding an extra flag to every  
NSBezierPath.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: objc_exception_throw prior to launching nib file

2009-04-22 Thread jmunson
You shoul post your code as it is difficult to discern your problem  
with the way you are describing things.


In other words:



Cannot perform operation without a managed object context


What operation is being performed that could require an moc?



If I set a breakpoint:


In what, on what?



the window (from nib) appears
then gdb comes up

What is strange is that the breakpoint should not be executed


What do you mean by this?  Breakpoints aren't executed, the debugger  
stops at that point (hence the term:  break, meaning stop, and point,  
meaning place).  You may then choose to execute the line at the  
breakpoint, or examine it, or whatever.



The problem
is not being able to debug the portion of code after the window appears.



What are you doing that you can't do this?  Is there a delegate  
missing?  Are you certain that routine is even being called at all?



If a managed object context were needed at that point, it should have
said something when I run without code. No?



Again, what do you mean, specficially by, when I run without code?



___

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

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

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

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


Re: -[NSSharedWorkspace openFile:]: Application exits with status 255

2009-04-22 Thread Sidney San Martín
Note: I'm re-sending this to the list. Accidently replied only to the sender.
---
I have read TN2083. Is there anything in particular that sticks out as
bad practice or as the potential cause of my issue?

Note that the application in question is not a daemon and will always
be launched by a console user, and I've been able to reproduce the
issue in 10.4 and 10.5.

On Wed, Apr 22, 2009 at 5:57 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 You would be very well served to read TN2083, Daemons and Agents:
 http://developer.apple.com/technotes/tn2005/tn2083.html .  You seem to
 be unaware of some of the pretty important architectural
 considerations that will affect your implementation.  Notably, some
 things changed in Leopard that will have significant effects on your
 ability to communicate between applications.

 --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: Bindings making NSNumberFormatter strange

2009-04-22 Thread Keary Suska

On Apr 22, 2009, at 3:57 PM, Ulai Beekam wrote:

To elaborate, when not using bindings, the default behavior of text  
fields with a number formatter is that when a user tries to enter  
abc in it, the text field refuses to lose focus and makes a  
beeping sounds.


However, when the text field's value binding has been set, a sheet  
is shown, which I think is a bad user experience.


That's because no one is handling the error. Bindings gives you some  
automatic error support. Otherwise you have to handle the error  
yourself. This is well documented. If you don't like the experience,  
then change it.


In fact it would be even better to just disallow entering of invalid  
characters in the first place. But such a method would have to work  
even if the text field's value binding is set.


I agree with you that having some sort of built-in support for entry  
filters would be great (I would add length limiters as well). I think  
we had this back in the Mac toolbox days, if I am remembering properly.


Anyway, there are two different issue to consider. One is validation,  
and the other is custom editor behavior. They are really two different  
problems, although there is overlap.


My problem is that when I type some invalid stuff in the text  
field, such as some letters abc, I don't get a beep (which is the  
normal behaviour and the one I want), but I get some sheet popping  
up saying Formatting Error. I don't want this sheet. I want the  
beep like usual. How can I get rid of this sheet behaviour that the  
bindings is causing? And why is it even causing it?




Because that's how formatters work. Getting rid of the sheet is  
nontrivial if you allow the formatter or bindings to do validation.  
Also, your formatter (or your model object, using key-value  
validation) can provide a more sensible error message if you choose.


Second question: How can I make my text field just disallow  
entering of invalid characters in the first place (and producing  
beep when it is tried)? I want, as you probably guessed, a method  
that is compatible with bindings.



You can use the formatter to check data on the fly, but you have to  
control the undo manager or you will get exceptions on undo. You can  
also have a custom field editor, for finer grained control. Both of  
these have decent documentation. I would be surprised if no-one has a  
framework that offers some of this behavior.


HTH,

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

___

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

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

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

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


[OT] Re: How to make app login window to look like OS X user login window ?

2009-04-22 Thread Alastair Houghton

On 22 Apr 2009, at 17:06, Chris Williams wrote:

So you'd rather the user sits there wondering if this huge, highly  
complex
application (like any Office or Adobe app) that takes 10-15 seconds  
to load,
even longer on a slow laptop, is actually starting up, or should I  
click it

again, or is my computer dead, or what the heck is going on here...?


If you think Office or any of Adobe's apps really have a good excuse  
for that behaviour, I'm afraid you're sorely mistaken.  The problem  
they're trying to solve is well-known, and has been solved for *years*  
in some other bits of software.  Since we're talking huge apps, a  
reasonable comparison might be Emacs, which, if it tried to load  
everything individually like Adobe's apps appear to, would probably  
take even longer to load.  Yet it appears almost instantaneously.   
(Yes, I know, I know, that's because of a horrible unexec() hack, at  
least on most platforms, though IIRC the OS X implementation is a  
little cleaner than average.)


Another large example is OS X itself; it does an Emacs-like trick with  
device drivers, loading them all in one lump from a cache file  
whenever possible.


I suppose both Adobe and Microsoft would retort that they have a lot  
of historic baggage and that re-implementing the start-up code isn't  
high priority for them.  Maybe even that there genuinely are things  
they need to do that really do take time and can't be avoided (though  
I'm doubtful).  I'm only picking on their apps because you mentioned  
them, and they're easy targets :-)


Splash screens serve a purpose other than advertising.  No program I  
know of

actually delays the load to show the splash screen.


The point is that most of what they do at load time can usually either  
be avoided entirely, optimized somehow or deferred until it's really  
necessary.


I have an application that connects to a SQL server.  The app itself  
isn't a
slow loader, but the connection to the SQL server (often on another  
computer
or on hard drives that may be asleep) can take 5, 10, or more  
seconds to
establish.  The splash screen shows that progress and let's the user  
know

what things are being done.  Far better than a spinning beach ball.


But much better to display the app's main UI and then use the app's  
usual progress indication mechanism.  And then, ideally, to make any  
parts of the UI that *can* start working work as soon as possible.


Of course, we're generalising here, and there is a fine line between  
having a splash screen and having a window that opens that says that  
you're just connecting to your server or fetching essential data.


Incidentally, since you're talking about a database app, it's worth  
contemplating whether there is anything that you don't really need to  
fetch straight away; you *might* find that you don't even need to load  
any data up front, but just need to do some queries to establish the  
structure of the data that you're going to have to load.  I'm sure  
you've thought of all of this already wish such a large volume of  
data, but even if that's true then it might be a useful pointer for  
someone else reading this e-mail.


Anyway, this is getting kind of off-topic, but hopefully it's a useful  
post anyway.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: -[NSSharedWorkspace openFile:]: Application exits with status 255

2009-04-22 Thread Sidney San Martín
I just discovered a new behavior that might be helpful. I'm storing my
helper in MacOS (so that it can be located with [NSBundle
pathForAuxiliaryExecutable:]). The call to openFile: causes both my
application and helper to be executed. My application exits (or so
launchd says, even if I put an NSLog in main(), nothing is printed),
but my helper runs successfully.

This is still a mystery to me. Here's a roundup of situations (best
viewed w/ fixed-width font):

Expected behavior: My app runs normally.
Wrong behavior: Launchd reports that my app exited with status 255, An
NSLog before NSApplicationMain() is not called. A Foundation
executable in my application's MacOS folder runs (passed argument
-psn_0_...) (which should not happen).


pre-touch/utime() behavior   post-touch/utime() behavior
-[NSWorkspace openFile:] from same process (euid 0):Wrong
   Wrong
-[NSWorkspace openFile:] from new process (euid 0): Wrong
  Expected
-[NSWorkspace openFile:] from new process (euid 50x):
Expected  Expected

On Wed, Apr 22, 2009 at 3:04 PM, Sidney San Martín s...@sidneysm.com wrote:
 I'm running into an issue that's above my skill level and could really
 use some guidance. My application has an SUID-root update utility (I
 know that's unusual, but it's an internal application that needs to be
 able to update itself even when the logged-in user isn't privileged)
 stored inside the application bundle. It downloads the update, sends a
 message back to the parent application that it's OK to quit, moves the
 new copy into place, and launches it.

 That last bit is giving me issues. I'm using -[NSWorkspace openFile:]
 to do the actual relaunching. It returns YES, but my application
 doesn't launch and com.apple.launchd[152]
 ([0x0-0xb80b8].com.mycompany.MyApplication[3836]) Exited with exit
 code: 255 appears in the Console.

 I noticed that at this point, if I use open (on the command line) to
 try to launch my (updated) application, it works. However, if I sudo
 open, it prints LSOpenFromURLSpec() failed with error -10810 for the
 file  -10810 translates to Unexpected internal error.

 If I touch the application bundle, open starts working as me and as
 root. Following this thread, I tried calling utimes() from my helper
 before openFile:, but run into the same condition. I've also tried
 LSRegisterURL() with no change. Can anyone give me a hint as to what's
 happening here? I'm lost.

___

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

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

Help/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: many users edit same file at the same time ?

2009-04-22 Thread Mario Kušnjer

Hello everyone !

Again me with another bizarre question

So I am interested how to implement a possibility that many users can  
edit same file (text, XML, sheet, database entry) at the same time ?
Forget the networking part for now and focus on the part of what to  
use for file: txt file, xml file, database ?

Witch one is more appropriate ?
How does that file gets saved when many people edit it at the same  
time ?

How to implement restrictions for some users (privileges) ?

To explain what I'm trying to figure out, is how collaborative editor  
like SubEthaEdit works (with files, file-locking, accessing, saving,  
etc)


Thanks to all in advance.

Mario
___

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

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

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

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


Quick question about adding an NSPanel

2009-04-22 Thread Chris Goedde

Hi,

I have a quick question about adding an NSPanel to an app. I'm  
following Hillegass's book, so I have a separate controller and nib  
for the panel. I added an IBAction (showSettingsPanel:) to my main app  
controller and hooked it up to the Preferences... menu item. Works  
great.


This isn't actually a preference panel, though, and I want the panel  
to open when the app launches so I added the line:


[ self showSettingsPanel: self ];

to the end of the awakeFromNib method of my main controller. Also  
works great, with one tiny exception. In both cases the panel has  
focus (either when opened from the Preferences... menu or at app  
launch). When the panel is opened from awakeFromNib, however, the main  
window has a light title bar, as if it's not frontmost. That's not the  
case when the panel is launched from the Preferences... menu. So my  
questions:


(1) Why does it make a difference how showSettingsPanel: is called?

(2) Is there a better way to do what I want to do?

Code for showSettingsPanel: below (it's very simple, basically  
straight from Hillegass).


Thanks.

Chris

- (IBAction) showSettingsPanel: (id) sender {

NSLog(@In showSettingsPanel.);

if (!settingsController) {

settingsController = [ [ SettingsController alloc ] init ];

}

[ settingsController showWindow: self ];

}


___

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

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

Help/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: Bindings making NSNumberFormatter strange

2009-04-22 Thread Ulai Beekam

So I really must make a custom field editor to accomplish on-the-fly validation 
(i.e. disallowing on-the-fly invalid characters)?

I suppose I could do a custom field editor and override keyDown:, checking for 
characters in [NSCharacterSet decimalDigitCharacterSet], etc. In fact, having 
made some custom field editors in the past I know I would be able to do this. 
However, I consider this to be a somewhat lame hack :( I therefore want to make 
sure with you guys that there is no easier solution to this, e.g. to somehow 
use the number formatter as a basis for automatic on-the-fly validation.

The whole thing just seems strange to me. Because when the text field is not 
bound, on-the-fly validation seems to work just fine! But this great feature 
goes away as soon as the text field is bound. That is, as soon as the text 
field is bound, the validation stops being on-the-fly and goes elsewhere 
instead. Is there no way having the validation ALSO as an on-the-fly thing? 
H.

I'm hoping for some more elaboration on this to gain a bit more understanding. 
But so far, thanks very  much for your reply Keary. Much appreciated!



 CC: cocoa-dev@lists.apple.com
 From: cocoa-...@esoteritech.com
 To: ulaibee...@hotmail.com
 Subject: Re: Bindings making NSNumberFormatter strange
 Date: Wed, 22 Apr 2009 16:46:12 -0600

 On Apr 22, 2009, at 3:57 PM, Ulai Beekam wrote:

 To elaborate, when not using bindings, the default behavior of text
 fields with a number formatter is that when a user tries to enter
 abc in it, the text field refuses to lose focus and makes a
 beeping sounds.

 However, when the text field's value binding has been set, a sheet
 is shown, which I think is a bad user experience.

 That's because no one is handling the error. Bindings gives you some
 automatic error support. Otherwise you have to handle the error
 yourself. This is well documented. If you don't like the experience,
 then change it.

 In fact it would be even better to just disallow entering of invalid
 characters in the first place. But such a method would have to work
 even if the text field's value binding is set.

 I agree with you that having some sort of built-in support for entry
 filters would be great (I would add length limiters as well). I think
 we had this back in the Mac toolbox days, if I am remembering properly.

 Anyway, there are two different issue to consider. One is validation,
 and the other is custom editor behavior. They are really two different
 problems, although there is overlap.

 My problem is that when I type some invalid stuff in the text
 field, such as some letters abc, I don't get a beep (which is the
 normal behaviour and the one I want), but I get some sheet popping
 up saying Formatting Error. I don't want this sheet. I want the
 beep like usual. How can I get rid of this sheet behaviour that the
 bindings is causing? And why is it even causing it?


 Because that's how formatters work. Getting rid of the sheet is
 nontrivial if you allow the formatter or bindings to do validation.
 Also, your formatter (or your model object, using key-value
 validation) can provide a more sensible error message if you choose.

 Second question: How can I make my text field just disallow
 entering of invalid characters in the first place (and producing
 beep when it is tried)? I want, as you probably guessed, a method
 that is compatible with bindings.


 You can use the formatter to check data on the fly, but you have to
 control the undo manager or you will get exceptions on undo. You can
 also have a custom field editor, for finer grained control. Both of
 these have decent documentation. I would be surprised if no-one has a
 framework that offers some of this behavior.

 HTH,

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


_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us___

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

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

Help/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: Removing or ignoring lineWidth property of an NSBezierPath instance

2009-04-22 Thread Graham Cox


On 23/04/2009, at 7:19 AM, Tobias Zimmerman wrote:

(By way of further explanation, the project this arises in involves  
a set of
bezier paths that are generated in one program and archived for use  
in a
separate program.  I would like the lineWidth and other drawing  
specifics
such as line/fill colors to be controlled by the view where the  
reusable

paths are drawn, rather than a property of the paths themselves).



I don't think that's going to work.

My take on what +setDefaultLineWidth: means is that this establishes  
the value for a path's -lineWidth when it is first created. From that  
instant on, the path itself has a defined line width, a copy of the  
default value. If you never set the default I believe it defaults to  
1.0.


When you dearchive the paths the line width of each will be whatever  
is recorded for them, which came from the default on the source  
machine at the time they were created. Changing the default line width  
on your machine will have no effect on these values.


If you want to change the line width when the paths are drawn, you'll  
have to set each one individually prior to drawing.


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


  1   2   >