Error when building a Cocoa-Java app

2008-06-23 Thread Angelo Chen
Hi,

I'm trying out Cocoa-Java application, in the XCode 2.4, I created a new object 
'Cocoa-Java application', then click 'build', and it gives me error:

command /Developer/Private/jam failed with exit code 1

any idea how to fix this? Thanks.

Angelo

___
 YM - 離線訊息
 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
 http://messenger.yahoo.com.hk
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-23 Thread Georg Seifert
Now I found out how panels works in Apple apps: (I did not use them  
often enough to be used to this behavior. I always had the panel from  
Adobe apps in mind )


The panels have the "setBecomesKeyOnlyIfNeeded:YES" set and thats it.  
Than they get closed by "command+W" if they have the focus (normally  
if on control has it) or no other window is open.


The way I would like it is that is does not respond to "command-w" at  
all. I think, I will try to implement my my own close button and  
disable close in IB. Or has anyone a better idea?


Thanks for your help
Georg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Determining startup AppleEvents

2008-06-23 Thread Mike
Is there a way in Cocoa to determine if the application was launched 
with or without an initial AppleEvent?


In particular, I am thinking of the Launch Services option that allows 
an app to be launched with an optional AppleEvent.


I need a convenient way to know an AppleEvent I am receiving came from a 
launch or was sent independently later.


Thanks,

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 [EMAIL PROTECTED]


Code signing and bundle layout

2008-06-23 Thread Trygve Inda
Apple's guide at:

http://developer.apple.com/releasenotes/Security/RN-CodeSigning/

says:

> Do not put helper applications, plugins, and other separately signed code into
> the Resources directory of a bundle. The Resources directory is directly
> sealed to the main executable. Put plugins into the Plug-Ins directory. Put
> helper tools into the executable directory. Put helper applications (with
> their own bundles) into the support directory.

But at:

http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles
/Concepts/BundleAnatomy.html#//apple_ref/doc/uid/20001119-107871-TPXREF6

It says a bundle can contain:

> A Frameworks directory contains any private libraries and frameworks used by
> the executable.
> A PlugIns directory contains loadable bundles that extend the basic features
> of the executable.
> A SharedSupport directory contains additional non-critical resources that do
> not impact the ability of the application to run. For example, this directory
> might include things like document templates, clip art, and tutorials.

I have a prefpane that contains two helper applications (which are
themselves bundles). These are currently in the Resources folder, but it
looks like they should move. Do I create a different folder for these?

NSBundle has methods for builtInPlugInsPath, sharedSupportPath but nothing
else.

I need to be able to code-sign one of my helper app bundles. Where should it
be placed?

Thanks,

Trygve


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Error when building a Cocoa-Java app

2008-06-23 Thread Kyle Sluder
2008/6/23 Angelo Chen <[EMAIL PROTECTED]>:
> any idea how to fix this? Thanks.

Good luck; the Cocoa-Java bridge has been deprecated as of 10.4.

--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 [EMAIL PROTECTED]


iCal server Cocoa API?

2008-06-23 Thread Devraj Mukherjee
Hi everyone,

I wondering if OSX Server components like iCal server or Address Book
server (which I assume is LDAP based) have Cocoa libraries to
populate/query data. I am trying to construct a Cocoa application but
wish to re-use as much of Apple's apps/technologies as I can.

My solution can assume an OSX Server in place.

Thanks for any suggestions.

-- 
"I never look back darling, it distracts from the now", Edna Mode (The
Incredibles)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Assert trigged in -[NSEvent eventNumber]

2008-06-23 Thread Mattias Arrelid
After having tried to debug an error related to mouse tracking (using
MATrackingAreaw, [1]) a few weeks ago, I occasionally saw an error
message from the system in the console log. The error claim that an
assert has failed in -[NSEvent eventNumber] - and each time this
occured, our custom mouse tracking seemed to stop working.

Unfortunately, I do not have access to the log at the moment. What
would be the right™ thing to do here? Since it isn't an exception, I
cannot catch it myself, so I'm fumbling in the dark at the moment.

Any ideas or suggestions are welcome.

[1]. http://mattgemmell.com/files/source/matrackingarea.zip

Regards
Mattias
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Code signing and bundle layout

2008-06-23 Thread Bill Cheeseman
on 2008-06-23 7:02 AM, Trygve Inda at [EMAIL PROTECTED] wrote:

> I have a prefpane that contains two helper applications (which are
> themselves bundles). These are currently in the Resources folder, but it
> looks like they should move. Do I create a different folder for these?

I discussed this issue at length with Apple engineers several months ago.
They made it clear that they were undecided at that time about the best way
to handle this situation, but they strongly indicated that putting the
helper app packages into any subfolder of the Contents folder was
inadvisable. As an interim meaure, they advised me to put the helper app
packages at the root level of my application package's Contents folder. I've
done that, and it seems to work.

I don't know whether their advice would apply to a prefpane, but I suspect
so.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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 [EMAIL PROTECTED]


Re: iCal server Cocoa API?

2008-06-23 Thread Jean-Daniel Dupas


Le 23 juin 08 à 13:37, Devraj Mukherjee a écrit :


Hi everyone,

I wondering if OSX Server components like iCal server or Address Book
server (which I assume is LDAP based) have Cocoa libraries to
populate/query data. I am trying to construct a Cocoa application but
wish to re-use as much of Apple's apps/technologies as I can.

My solution can assume an OSX Server in place.

Thanks for any suggestions.


I'm not aware of any address book server in Leopard and Snow Leopard  
is not goint to use LDAP (there is some public info about it at http://www.apple.com/server/macosx/snowleopard/ 
 )


To get info about the iCal server protocol, have a look at the  
calendarserver site. I'm not aware of any Obj-C client library but  
there is at least a python implementation: http://trac.calendarserver.org/wiki/CalDAVClientLibrary





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Error when building a Cocoa-Java app

2008-06-23 Thread Angelo Chen
Hi,

There is this tutorial:

http://www.informit.com/articles/article.aspx?p=428071&seqNum=3

but no source code included, following the steps turned out not working, I 
think Cocoa-java bridge is quite useful, example, you might like to use 
Hibernate in your Cocoa app, and Objectiv C does not that support, only way is 
to go java.

Angelo

--- 2008年6月23日 星期一,Kyle Sluder <[EMAIL PROTECTED]> 寫道﹕

> 寄件人: Kyle Sluder <[EMAIL PROTECTED]>
> 主題: Re: Error when building a Cocoa-Java app
> 收件人: "Angelo Chen" <[EMAIL PROTECTED]>
> 副本(CC): cocoa-dev@lists.apple.com
> 日期: 2008 6 23 星期一 下午 7:32
> 2008/6/23 Angelo Chen <[EMAIL PROTECTED]>:
> > any idea how to fix this? Thanks.
> 
> Good luck; the Cocoa-Java bridge has been deprecated as of
> 10.4.
> 
> --Kyle Sluder

___
 YM - 離線訊息
 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。
 http://messenger.yahoo.com.hk
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to manage/embed Covert Art from Mp3 Files with Cocoa App?

2008-06-23 Thread Daniel Thorpe

Hello everyone,

I raised this problem on the list in May, although I was unable to  
follow up in timely fashion. I've since had time to look at it again,  
and I see some more people have asked about adding artwork to iTunes.   
As Jens suggests, an ID3 framework http://drewfamily.homemail.com.au/Cocoa_-_ID3Tag_framework.html 
 exists, which although a little out of date does work. Here is what  
I did to write artwork to mp3 files in iTunes. Note you'll need to  
generate the header file for iTunes to use the Scripting Bridge - run  
the following command from Terminal.app : sdef /Applications/ 
iTunes.app | sdp -fh --basename iTunes


First, I used the ScriptingBridge to get a reference to my iTunes  
Music Library:


// Create an iTunes application objeect
iTunesApplication *iTunes = [SBApplication  
applicationWithBundleIdentifier:@"com.apple.iTunes"];

iTunesLibraryPlaylist *library;
for(iTunesSource *source in [iTunes sources]) {
if(source.kind == iTunesESrcLibrary) {
for(iTunesLibraryPlaylist *playlist in [source 
libraryPlaylists]) {
if([playlist.name isEqualToString:@"Library"]) {
library = playlist; 
break;
}
}   
}
}

Using an iTunesLibraryPlaylist allows you to call [library fileTracks]  
which returns an array of iTunesFileTrack references. These are  
necessary (rather than iTunesTrack references) so that you can get the  
location attribute of the files. To get the tracks for a particular  
artist/album I used this method:


- (NSArray *)tracksForAlbum:(Album *)album byArtist:(Artist *)artist {

	NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(artist  
like %@) && (album like %@)", artist.name, album.name];	

SBElementArray *tracks = [library fileTracks];  
NSArray *albumTracks = [tracks filteredArrayUsingPredicate:predicate];  
return albumTracks;
}

The above method is what Apple suggests doing when using the  
ScriptingBridge (), rather than iterating through the whole library, however it still  
crashes iTunes, although my music library has over 40,000 tracks.  
Therefore I'd suggest that before running this, quit iTunes, rename  
your entire iTunes library folder (~/Music/iTunes/) to something else  
(~/Music/iTunes main/) and then start iTunes again, so it'll create an  
empty library - then add the music you want to add artwork to.


You can iterate over this NSArray and access each track using the ID3  
tag framework, assuming an image to embed for the artwork needs to be  
stored as an NSBitmapImageRep exists:



NSBitmapImageRep *newArtwork; // this needs to exist
TagAPI *id3Tag = [[TagAPI alloc] initWithGenreList:nil];
NSArray *tracks = [self tracksForAlbum:anAlbum byArtist:anArtist];

for(iTunesFileTrack *track in tracks) {
[track get];
[id3Tag examineFile:[track.location path]];

	NSDictionary *dic = [NSDictionary  
dictionaryWithObjectsAndKeys:newArtwork, @"Image",

@"NSTIFFFileType", @"Mime 
Type",
@"Other", @"Picture 
Type",
@"", @"Description", 
nil];  
[id3Tag setImages:[NSMutableArray arrayWithObject:dic]];
if([id3Tag updateFile] == 0) {
NSLog(@"successfully processed %@", [id3Tag getTitle]); 
  
} else {
NSLog(@"failed to process %@", [id3Tag getTitle]);  
  
}
}   

That should embed your artwork into the files - iTunes probably wont  
display the artwork until you select or play the track. This doesn't  
work for .m4a files however. It looks like it might be possible to use  
the - (void)addImage:(NSImage *)image forDuration:(QTTime)duration  
withAttributes:(NSDictionary *)attributes method of QTTrack/QTMovie  
from the QTKit, although I've not implemented it myself yet


Anyway, hope this helps someone, or if anyone has a better method -  
let us all know!


Cheers
Dan


On 11 Jun 2008, at 14:59, Nicolas Goles wrote:

Hi, I want to develop a Cocoa Application to manage an embed Cover  
Art files
to Mp3's. The thing is that I don't know how to achieve this, or  
where to
read about how to do it. I asked in several places / googled a lot  
and ended

up here.
Could anyone help me out a bit ? Link me to some reading would be  
amazing,
but if you get into more detailed explanation, that would be great  
too.


Thanks a lot .

Re: NSPanel should not close on command-W

2008-06-23 Thread Mike Abdullah


On 23 Jun 2008, at 08:35, Georg Seifert wrote:

Now I found out how panels works in Apple apps: (I did not use them  
often enough to be used to this behavior. I always had the panel  
from Adobe apps in mind )


The panels have the "setBecomesKeyOnlyIfNeeded:YES" set and thats  
it. Than they get closed by "command+W" if they have the focus  
(normally if on control has it) or no other window is open.


The way I would like it is that is does not respond to "command-w"  
at all. I think, I will try to implement my my own close button and  
disable close in IB. Or has anyone a better idea?


Thanks for your help
Georg


I think implementing your own close button would be a very bad idea.  
You'd have to get the look exactly right, and account for possible  
changes by future OS's. If you're really desperate to have your own  
custom behaviour, a better route is to intercept the command-w event  
before NSPanel handles it.


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 [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-23 Thread Jim Correia

On Jun 23, 2008, at 3:35 AM, Georg Seifert wrote:

The way I would like it is that is does not respond to "command-w"  
at all. I think, I will try to implement my my own close button and  
disable close in IB. Or has anyone a better idea?


A previous response in this thread told you how to do this. You can  
arrange for the action associated with the Close command (- 
performClose:) to be disabled when your panel is key.


But it is still unclear to me *why* you want to do this. If your panel  
has a close box, and it is the window with keyboard focus, many users  
are going to expect Command-W to close that window. Going out of your  
want to disable that functionality is likely to frustrate these users.


Jim

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-23 Thread Andy Lee

On Jun 23, 2008, at 11:18 AM, Jim Correia wrote:
But it is still unclear to me *why* you want to do this. If your  
panel has a close box, and it is the window with keyboard focus,  
many users are going to expect Command-W to close that window. Going  
out of your want to disable that functionality is likely to  
frustrate these users.


An example of this is in the Finder.  The info window you get with  
Command-I responds to Command-W.  But the info inspector panel that  
you get with Command-Option-I does not, despite having a close button  
and being able to have focus.  This drives me nuts, because I often  
hit Command-W in the latter case and end up closing my Finder file- 
browser window by mistake instead of the info panel.


(In case anyone's wondering: Command-Option-I toggles the info  
inspector, so you can use that instead of Command-W.)


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-23 Thread Georg Seifert
But it is still unclear to me *why* you want to do this. If your panel  
has a close box, and it is the window with keyboard focus, many users  
are going to expect Command-W to close that window. Going out of your  
want to disable that functionality is likely to frustrate these users.


An example of this is in the Finder.  The info window you get with  
Command-I responds to Command-W.  But the info inspector panel that  
you get with Command-Option-I does not, despite having a close  
button and being able to have focus.  This drives me nuts, because I  
often hit Command-W in the latter case and end up closing my Finder  
file-browser window by mistake instead of the info panel.


(In case anyone's wondering: Command-Option-I toggles the info  
inspector, so you can use that instead of Command-W.)


I do a graphic program and most users are used to the behavior of  
adobe apps. There palettes have a close button but do not react on  
command-w.


For me it is more logical that all windows with a "big" title bar  
react on keyboard close commands and all panels with a "small" title  
bar not.


Georg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Newbie seeks code review

2008-06-23 Thread Paul E. Robichaux
I'm a brand-new Cocoa programmer, and I've just finished the first demo-able 
version of my first app: it uploads conversation files from the corporate 
version of Mac Messenger to a user's "Conversation History" folder in their 
Exchange Server mailbox. So, not exactly mass market, but certainly useful for 
folks who are in that boat.

In line with , I'd like to have 
more experienced eyes go over this code. No doubt there are a lot of things 
I've done that aren't in line with Cocoa best practices. If any of you are 
willing to take a look at the code, and are willing to give me constructive 
feedback, (e.g. not just "n00bs suck"), I'll send you a zip of the code.

Thanks in advance- I find the discussion and information on this list super 
valuable even though much of it is over my head.

Cheers,
-Paul
___

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

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

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

This email sent to [EMAIL PROTECTED]


Newbie pulling my hair out regarding a simple xcode issue. Please help :-)

2008-06-23 Thread Papa-Raboon
Hi All,

I have been trying to get my hair around Cocoa programming and have
worked through many a tutorial and it seems to be coming to me slowly.
I wondered if anyone could help me figure out a simple exercise that I
came up with myself to make it clearer how to properly address objects
with each other.

I have a simple interface in interface builder that has two text
fields (NSTextField) and a multi-line NSTextField and a button.
The two text fields are "firstName" & "lastName". The multi-line text
field is "peoplesNames" The push button is "addName".
All I need this to do is allow me to type a first name, last name,
press a button and the name gets added to the multiline text field.
Only issue is I cannot get my head around what connects to what in
Interface Builder.

I guess I need to concatenate the two name fields into a single
NSMutableString (with a space in the middle) then add them to an
NSMutableArray which is looped through to display in the multiline
text field.

This would be an insignificant task for an experienced Cocoa
programmer but would teach newbies like me a thing or two.
Many of the tutorials seem to be far too simple. And others too
complicated. Where's the intermediate ones like this.

Could anyone please help in some way either with a description of what
needs to be done or a link to a similar tutorial.

Cheers

Paul Randall
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie pulling my hair out regarding a simple xcode issue. Please help :-)

2008-06-23 Thread Kyle Sluder
On Mon, Jun 23, 2008 at 12:37 PM, Papa-Raboon
<[EMAIL PROTECTED]> wrote:
> Could anyone please help in some way either with a description of what
> needs to be done or a link to a similar tutorial.

Typically, there isn't a tutorial for this sort of thing because these
situations tend to arise out of a failure to understand the MVC
paradigm.

In other words, you rarely, if ever, connect views to each other in
IB.  Instead, your views get connected to a controller which transfers
data in and out of your model.  So in your case, you would want to
have a model object (NSMutableArray, as you have mentioned, would be a
good choice) that is managed by a controller.  You could whip up a
controller object quite easily, in fact; wire up the action of your
button to an IBAction method in your controller that pulls the values
of the text fields (referenced through outlets, of course),
concatenates them and stuffs the result in the model object.  Then
tell your destination text field to update its value.  Though wouldn't
it make more sense to use an NSTableView for this?

--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 [EMAIL PROTECTED]


Webkit plug-in help

2008-06-23 Thread Matt Mashyna
I'm sorry for posting this here but posting to the webkit list is like  
putting a message in a bottle. Maybe someone here will be able to  
offer a clue.


I'm struggling with a plug-in. I looked at the example plug-ins like  
the movie player. The movie player looks at the source url and uses it  
as a source for the movie. That works fine in simple situations. I'm  
dealing with a situation where there is some redirection of a POST  
before my mime type is delivered to my plug-in. I can't use the movie  
player example because I can't re-post the request -- or I can't get  
it to work properly.


So I looked at what is available to me. When the POST happens,  
Safari's window empties and I see the url that I ultimately want to  
get in the address bar. I am seeing the plug-in start. I use the  
container property to get a pointer to the frame and I see the data it  
has loaded. I see the data I expect but it is not complete. The frame  
doesn't seem to complete loading the resource. In webPlugInStart I  
start a thread to wait until I think the resource load is finished,  
get it and then log it to the console. In every case the data is  
truncated to about 1400 bytes.


I can't seem to force it to finish loading. What can I do to get all  
the data I should be getting ?


Here's my data slurping method:


- (void)waitUntilDownloadIsFinished
{
NSAutoreleasePool*  pool = [[NSAutoreleasePool alloc] init];

id  container = [_arguments objectForKey: 
WebPlugInContainerKey];
WebFrame*   frame = [container webFrame];

	while([frame provisionalDataSource])	// if it's provisional then I  
need to wait

[NSThread sleepUntilDate:[NSDate 
dateWithTimeIntervalSinceNow:0.1]];

WebDataSource*  source = [frame dataSource];

	while([source isLoading])	// if it's not done loading then I need to  
wait

[NSThread sleepUntilDate:[NSDate 
dateWithTimeIntervalSinceNow:0.1]];

NSData* data = [source data];
	NSString* xmlStuff = [[NSString alloc] initWithData:data  
encoding:NSMacOSRomanStringEncoding];

NSLog(xmlStuff);

[xmlStuff release];

[pool release];
} // waitUntilDownloadIsFinished

___

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

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

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

This email sent to [EMAIL PROTECTED]


OT: code signing

2008-06-23 Thread Trygve Inda
Where/how can I get a code-signing certificate for 10.5 apps?

Verisign says I need a Windows browser to order a Authenticode certificate,
but that they really don't support Macs.

Thawte claims to support only Mac OS 9

RSA has little info about code signing.

http://developer.apple.com/documentation/Security/Conceptual/CodeSigningGuid
e/Procedures/chapter_3_section_2.html#//apple_ref/doc/uid/TP40005929-CH4-SW1

says:

You can obtain a signing identity from a certificate authority, such as
VeriSign, RSA, or Thawte

So how does one do this?

I have an Authenticode certificate for our VC++ Windows-based app, but it
does not seem to work on 10.5's code signing system.

Trygve


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Determining startup AppleEvents

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 1:04 AM, Mike wrote:

Is there a way in Cocoa to determine if the application was launched  
with or without an initial AppleEvent?


That's what -applicationDidFinishLaunching: is for. It's called after  
any initial AppleEvents are dispatched. So if you reach that method,  
and you haven't been informed of any AppleEvents (via NSApplication  
delegate methods or NSAppleEvent callbacks), you know that none were  
sent.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie pulling my hair out regarding a simple xcode issue. Please help :-)

2008-06-23 Thread Matt Mashyna
You need to think in terms of MVC - Model, View, Controller. You have  
the view now you need to think of the model and controller. Make an  
object in Xcode called something like MyController. For this simple  
example you could combine the model and controller. Add an NSMutable  
Array for your multiline.


In Xcode:
Create an IBOutlet for each of your NSTextFields (maybe firstname,  
lastname, and multiline)


Create an IBAction method that you want to have called when you click  
the button. Inside this function you'll do your handling of the views  
-- more on that in a minute.


Save your files in Xcode and the go back to IB. In IB you need to  
connect your outlets and actions. From the Library window drag a  
generic object (blue cube) to your MainMenu.nib window. Using the  
inspector, change the class to the one you just created in Xcode.


Control-click this new object and drag the mouse to one of the  
NSTextfields. The pop up menu will let you choose from the outlets you  
defined in Xcode. Hook up both fields to their respective outlets.  
Then, control click from the button to your controller object's blue  
cube to connect it's action.


Now you have everything hooked up and you can go back to Xcode and  
finish your action method. You can refer to the text fields by the  
outlet names you defined. Get the contents of line one like this  
(WARNING typed without compiling):


-(IBAction)myClickAction:(id)sender
{
NSString* name = [NSString stringWithFormat:@"%@ %@", [firstname  
stringValue], [lastname stringValue]];	// gets a reference to it's value

[namesArray addObject: name];   // adds it to the array

NSString*   newMultiLineValue = @"";  // start empty
NSEnumerator*   e = [namesArray objectEnumerator];
NSString*   singleName;

// loop through the names in the array to make a composite string
while(singleName = [e nextObject])
	newMultiLineValue = [newMultiLineValue stringByAppendingFormat:@"%@ 
\n", singleName];


[line2 setStringValue: newMultiLineValue];  // sets this field
[line1 setStringValue:@""];   // clears this 
field

}

Ideally you want to have separate model and controller objects but  
this should give you the idea of how to hook IB items to a controller.


On Jun 23, 2008, at 12:37 PM, Papa-Raboon wrote:


Hi All,

I have been trying to get my hair around Cocoa programming and have
worked through many a tutorial and it seems to be coming to me slowly.
I wondered if anyone could help me figure out a simple exercise that I
came up with myself to make it clearer how to properly address objects
with each other.

I have a simple interface in interface builder that has two text
fields (NSTextField) and a multi-line NSTextField and a button.
The two text fields are "firstName" & "lastName". The multi-line text
field is "peoplesNames" The push button is "addName".
All I need this to do is allow me to type a first name, last name,
press a button and the name gets added to the multiline text field.
Only issue is I cannot get my head around what connects to what in
Interface Builder.

I guess I need to concatenate the two name fields into a single
NSMutableString (with a space in the middle) then add them to an
NSMutableArray which is looped through to display in the multiline
text field.

This would be an insignificant task for an experienced Cocoa
programmer but would teach newbies like me a thing or two.
Many of the tutorials seem to be far too simple. And others too
complicated. Where's the intermediate ones like this.

Could anyone please help in some way either with a description of what
needs to be done or a link to a similar tutorial.

Cheers

Paul Randall
___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Assert trigged in -[NSEvent eventNumber]

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 5:21 AM, Mattias Arrelid wrote:


 The error claim that an
assert has failed in -[NSEvent eventNumber] - and each time this
occured, our custom mouse tracking seemed to stop working.
Unfortunately, I do not have access to the log at the moment. What
would be the right™ thing to do here? Since it isn't an exception, I
cannot catch it myself, so I'm fumbling in the dark at the moment.


Assertion failures *are* NSExceptions, and you can use an @catch block  
to intercept them.


However, they also indicate an error in your code, so of course you  
should try to fix the bug instead of just ignoring the exception. The  
best thing to do is to use Xcode's breakpoints window to add a  
breakpoint at "objc_exception_throw" (on Leopard) or  
"NSRaiseError" (Tiger), and run your code with breakpoints on until  
you can get the exception to occur. Then you can look at the stack and  
your variables to figure out what's wrong.


If it's one of those unpleasant bugs that only manifests when no one's  
looking for it, you can build some debugging features into the app. My  
MYUtilities library[1] has a module called ExceptionUtils[2] for use  
in displaying backtraces of exceptions. You can use this to have any  
uncaught exception pop up an alert panel containing the full backtrace.


—Jens

[1] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/ ... use the  
"zip" link at the top to download

[2] 
http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/file/tip/ExceptionUtils.h___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iCal server Cocoa API?

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 4:37 AM, Devraj Mukherjee wrote:


I wondering if OSX Server components like iCal server or Address Book
server (which I assume is LDAP based) have Cocoa libraries to
populate/query data. I am trying to construct a Cocoa application but
wish to re-use as much of Apple's apps/technologies as I can.


There's a DirectoryServices API for working with shared directories  
like LDAP and OpenDirectory, which is what Mac OS X Server uses.


For accessing the calendar you can use the iCal framework. If the user  
has configured iCal to sync with a calendar server, you'll be able to  
access that data from the framework's API.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: OT: code signing

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 9:59 AM, Trygve Inda wrote:

I have an Authenticode certificate for our VC++ Windows-based app,  
but it

does not seem to work on 10.5's code signing system.


I haven't tried to do any code signing yet, but my naïve impression is  
that any valid X.509 cert plus private key should do the job. Maybe  
the problem is the way you've transferred the data to the Mac. What  
data format did you use to export it from Windows, and how did you  
import it into the Mac?


(You should follow up to the poorly-named apple-cdsa list, which  
happens to be the right forum for all security/crypto/authentication  
questions.)


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: OT: code signing

2008-06-23 Thread Trygve Inda
> 
> On 23 Jun '08, at 9:59 AM, Trygve Inda wrote:
> 
>> I have an Authenticode certificate for our VC++ Windows-based app,
>> but it
>> does not seem to work on 10.5's code signing system.
> 
> I haven't tried to do any code signing yet, but my naïve impression is
> that any valid X.509 cert plus private key should do the job. Maybe
> the problem is the way you've transferred the data to the Mac. What
> data format did you use to export it from Windows, and how did you
> import it into the Mac?
> 
> (You should follow up to the poorly-named apple-cdsa list, which
> happens to be the right forum for all security/crypto/authentication
> questions.)

Ah! Thanks for the note for the right list... I'd have never guessed that
one.

Cheers,

T.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPanel should not close on command-W

2008-06-23 Thread Quincey Morris


On Jun 23, 2008, at 09:01, Georg Seifert wrote:

I do a graphic program and most users are used to the behavior of  
adobe apps. There palettes have a close button but do not react on  
command-w.


For me it is more logical that all windows with a "big" title bar  
react on keyboard close commands and all panels with a "small" title  
bar not.


Well, keep in mind that there's a lot of criticism of Adobe for going  
their own way with interface design. But if you want to tie your canoe  
to Adobe's ship ... :)


A change of your terms of reference might solve things without a lot  
of hacky code.


You have a program that has palettes (not "windows", from the user  
perspective) that the user wants to be able to hide or show (not  
"close" or "open", from the user perspective).


So, use a NSPanel, but turn off all three of the close/maximize/ 
minimize buttons in IB so that they don't even show up in the title  
bar. On a suitable menu (e.g. View), add a Hide/Show XXX item for each  
of your different palettes, connected to a ToggleXXXVisible action for  
each palette.


If it turns out that disabling the standard close button *doesn't*  
prevent the palettes from responding to the standard performClose:  
action (which is sent by File | Close and Command-W), implement an  
override for each palette's window controller that forwards the action  
to the current main window (if there is one) or discards it (if there  
is no main window).


Seems to me that's simple to implement and clear in the interface, and  
not in conflict with standard behavior in any reprehensible way.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
I just finished my first simple Core Data Document Based Application.   
Four entities with multiple relationships.  Now I want to recreate the  
same thing using just SQLite.  I don't know SQLite, and I know very  
little Unix.  I had read it was possible to study SQLite using Core  
Data, but I am making no progress.  The closest I could get to opening  
my core data sqlite document with sqlite3 was to try mycoredatadoc >  
sqlite3 in the Terminal, but permission was denied.


Any suggestions?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Code signing and bundle layout

2008-06-23 Thread Jeff Johnson

On Jun 23, 2008, at 7:49 AM, Bill Cheeseman wrote:


on 2008-06-23 7:02 AM, Trygve Inda at [EMAIL PROTECTED] wrote:


I have a prefpane that contains two helper applications (which are
themselves bundles). These are currently in the Resources folder,  
but it
looks like they should move. Do I create a different folder for  
these?


I discussed this issue at length with Apple engineers several  
months ago.
They made it clear that they were undecided at that time about the  
best way

to handle this situation, but they strongly indicated that putting the
helper app packages into any subfolder of the Contents folder was
inadvisable. As an interim meaure, they advised me to put the  
helper app
packages at the root level of my application package's Contents  
folder. I've

done that, and it seems to work.



Bill, thanks for the information. Did they say why putting a helper  
app in a subfolder (e.g., MacOS) was inadvisable?


-Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Ilan Volow
The best way to learn SQLite is to learn SQLite and ignore Core Data  
completely. While Core Data technically uses SQLite, it does  
undocumented voodoo with SQLite, which is subject to change with any  
Apple whim at any particular moment (except on thursdays). For all  
intents and purposes, Core Data + SQLite should basically be  
considered a proprietary format.


If you want to learn SQLite, get a book or two on it, or go to their  
website. If you want a Cocoa framework that does a bit of what Core  
Data does, check out QuickLite http://www.webbotech.com/


You might also want to pick up a copy of Martin Fowler's Patterns Of  
Enterprise Application Architecture if you'd like to understand more  
about how to store and retrieve objects using relational databases http://tinyurl.com/4rvlaj


-- Ilan



On Jun 23, 2008, at 2:06 PM, David Carlisle wrote:

I just finished my first simple Core Data Document Based  
Application.  Four entities with multiple relationships.  Now I want  
to recreate the same thing using just SQLite.  I don't know SQLite,  
and I know very little Unix.  I had read it was possible to study  
SQLite using Core Data, but I am making no progress.  The closest I  
could get to opening my core data sqlite document with sqlite3 was  
to try mycoredatadoc > sqlite3 in the Terminal, but permission was  
denied.


Any suggestions?
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread I. Savant
> Now I want to recreate the same thing using just SQLite.

  Pick up a good introductory book on relational (SQL) databases.
What's good for one is *mostly* good for the others in terms of
general design.

> I don't know SQLite, and I know very little Unix.

  If you know SQL and you know enough "Unix" to get into the SQLite
CLI, you're most of the way there. You lack only knowledge of a)
relational database concepts and b) SQLite's specific quirks.

  If you don't know SQL, I don't see how you think it's even remotely
reasonable to learn how to use SQLite (or SQL) by looking at the table
structure in a Core Data SQLite file.

> I had read it was possible to study SQLite using Core Data, but I am making 
> no progress.

  Study? I suppose (in the same way one pins a dead butterfly to a
board to 'study' it with a magnifying glass). Other than that, the
notion is asinine. It's no wonder you're not making any progress: it's
not obvious a) what SQL code was used to generate the
structure/schema, b) why that particular schema is used due to the
Core Data model and its relationships, and c) when and how it's safe
to deviate from that design or even whether that's the *best* design.


>  The closest I could get to opening my core data sqlite document
> with sqlite3 was to try mycoredatadoc > sqlite3 in the Terminal, but
> permission was denied.

  How about (without quotes): "sqlite3 /path/to/mycoredata.doc"  ...?

> Any suggestions?

  Yes, several:

1 - Stop it. ;-)
2 - Learn relational database concepts in general - there's a plethora
of books (introductory to advanced) out there. I'm sure the material
freely available on the 'net would even suffice if you're a quick
study.
3 - Same for SQL. It is not "a database" any more than all databases
"are SQL". If you learn SQL well enough to at least create some
tables, add, modify, and delete records, etc. you're getting close.
This should be done in tandem with RDBMS concepts.
4 - Either make an effort to learn your way around the command line or
get yourself a good GUI app to manage SQLite databases. There are a
few free and paid apps out there.
5 - Learn the specific quirks of SQLite. It's (as the name suggests) a
SQL-based database system, but it's fundamentally different from most
in that it's not meant to be a 'server'. I also *think* (from memory)
that it does not fully implement the SQL language, so those
differences can bite you too.
6 - When trying to reverse-engineer something, you really need to know
your stuff (the fundamentals). In your case, you're trying to
reverse-engineer your favorite MP3 player without any knowledge of
electronics or design, assuming knowing how to use the product very
well is sufficient. Not so.

  I hope this is helpful. I had to guess at what you do and don't
know, so take that into consideration if I'm off-base.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
In a 2005 entry on the Big Nerd Ranch Weblog titled "Life with  
SQLite", it says:


"If you are curious about how Core Data structures the file, sqlite3  
is a great way to explore it."


So I'm starting with just being curious about what Core Data did with  
my sqlite file, and I'm trying to work out the right Terminal command  
to do it.


On Jun 23, 2008, at 1:05 PM, I. Savant wrote:


 I hope this is helpful. I had to guess at what you do and don't
know, so take that into consideration if I'm off-base.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Hamish Allan
On Mon, Jun 23, 2008 at 7:06 PM, David Carlisle
<[EMAIL PROTECTED]> wrote:

> I had read it was possible to study SQLite using Core Data

On Mon, Jun 23, 2008 at 8:19 PM, David Carlisle
<[EMAIL PROTECTED]> wrote:

> In a 2005 entry on the Big Nerd Ranch Weblog titled "Life with SQLite", it
> says:
>
> "If you are curious about how Core Data structures the file, sqlite3 is a
> great way to explore it."

"Learn about Core Data structures using SQLite" != "Learn about SQLite
by examining Core Data structures".

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread I. Savant
> In a 2005 entry on the Big Nerd Ranch Weblog titled "Life with SQLite", it
> says:
>
> "If you are curious about how Core Data structures the file, sqlite3 is a
> great way to explore it."

  That doesn't quite mean Core Data files are a good way to learn
SQLite as you seemed to originally imply. The statement you quoted
seems to imply that you already know how SQLite works and want to
learn how Core Data goes about doing things specifically. The two are
definitely not equal.

> So I'm starting with just being curious about what Core Data did with my
> sqlite file, and I'm trying to work out the right Terminal command to do it.

  ... then this topic belongs on another mailing list, though I
already answered this above. If you're already in the SQLite CLI tool
and wanting to learn to use it, then yeah, this is definitely
off-topic for the cocoa-dev list.

  Specifically: A unix users list for the "how to get to things with
the command line", and a SQLite users list for using SQLite.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread I. Savant
> "Learn about Core Data structures using SQLite" != "Learn about SQLite
> by examining Core Data structures".

  More succinct == better. :-)

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Custom mouse cursor in NSTextView

2008-06-23 Thread Douglas Davidson


On Jun 13, 2008, at 8:58 AM, Todd Ransom wrote:

I have a fullscreen text view in my app that allows the user to set  
a foreground and background color. Problem is, for some  
configurations the default I-beam mouse cursor does not show up very  
well so I want to provide a custom I-beam cursor in the same color  
as the text.


I put together a bezier path to draw the I-beam and overrode  
resetCursorRects like this:


- (void)resetCursorRects
{
	[self addCursorRect: [self visibleRect] cursor: [self  
bigIBeamCursor]];

}


This works great as long as I use it in an NSView subclass. But as  
soon as I change my class to inherit from NSTextView it stops  
working. resetCursorRects is still called, but the text view is  
doing some kind of magic to change the cursor itself. I have also  
tried overriding - (void)addCursorRect:(NSRect)aRect cursor: 
(NSCursor *)aCursor to replace the generic ibeam with my own, but  
that only seems to get called if I override resetCursorRects and it  
does not affect the cursor appearance in the text view either.


Has anyone else out there successfully changed the mouse cursor on a  
text view? What did you need to do?


NSTextView sets the cursor over itself dynamically, based on  
considerations including the text under the cursor.  It does so in - 
mouseEntered:, -mouseMoved:, and -cursorUpdate:, so those would be  
points to consider overriding.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


caching NSCollectionView

2008-06-23 Thread Georg Seifert

Hello again,

I have an other question:
Does anybody got saving the item views working. I filed a but at apple  
about this but i was curios if anyone found a workaround.


the problem is, that the stored NSCollectionViewItem does not retains  
the view:


in my NSCollectionView subclass:

- (NSCollectionViewItem *)newItemForRepresentedObject_:(id)object {
myCollectionViewItem* item = [(myClass*)object item];

if (item == nil) {
		item = (myCollectionViewItem*)[super  
newItemForRepresentedObject:object];

[(myClass*)object setItem:item];
[(myClass*)object setItemView:(myView*)item.view];


} else {
[item retain];
[item setRepresentedObject:object];
[item setView:[object itemView]];

}
	NSLog(@"newItemForRepresentedObject:%@ layoutView: %@", item, [item  
layoutView]);

return item;
}

in the log I get something like this:

{represented object: (null), view:  
(null) (frame {{-1.99813, 2.29293e-39}, {4.2039e-45, 3.36312e-44}}),  
selected: NO}


Does anyone has an idea?

Thanks for all your help.

Georg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: caching NSCollectionView

2008-06-23 Thread I. Savant
> Does anybody got saving the item views working. I filed a but at apple about
> this but i was curios if anyone found a workaround.

  The answer to this question depends entirely on what you're trying
to accomplish (and how you have things wired). Unless you have a very
good reason, however, you're probably going about this the wrong way.
That is, the views should be dictated by the objects they represent.

  If you store all the states (sort order, etc.) in the model objects
you represent with the collection view and its items, all you need to
do is restore those model objects (assuming they're wired up to your
collection view) and they should be working just fine (and with no
effort once everything's set up if you're using Core Data and
Bindings).

  So ... why are you trying to save the views?

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Learning SQLite by watching Core Data?

2008-06-23 Thread Ben Trumbull

David,

I highly recommend these two books:





Now I want to recreate the same thing using just SQLite.  I don't 
know SQLite, and I know very little Unix.


Why do you want to use SQLite directly ?  I don't think it's 
currently a good fit for your self described skill level.  If you're 
simply interested in learning, pick up those books, and maybe one or 
two on UNIX, and hack at it.

--

-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 [EMAIL PROTECTED]


Re: caching NSCollectionView

2008-06-23 Thread Georg Seifert
Does anybody got saving the item views working. I filed a but at  
apple about

this but i was curios if anyone found a workaround.


 The answer to this question depends entirely on what you're trying
to accomplish (and how you have things wired). Unless you have a very
good reason, however, you're probably going about this the wrong way.
That is, the views should be dictated by the objects they represent.

 If you store all the states (sort order, etc.) in the model objects
you represent with the collection view and its items, all you need to
do is restore those model objects (assuming they're wired up to your
collection view) and they should be working just fine (and with no
effort once everything's set up if you're using Core Data and
Bindings).

 So ... why are you trying to save the views?


the NSColletionView is bound to an array of 300-2000 instances of  
myClass. If I filter this array (setting a predicate on the  
ArrayController) and than change back to see all Elements, the  
CollectionView regenerates all the item views for the elements I did  
not saw during filtering. This takes several second (on my Powerbook).


To save the viewItems for a later use would solve the speed issue.

Are there better approches speeding things up??

Thanks
Georg


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Ben Trumbull
While Core Data technically uses SQLite, it does undocumented voodoo 
with SQLite,


Core Data only use public SQLite API.

For all intents and purposes, Core Data + SQLite should basically be 
considered a proprietary format.


It's the same SQLite file format as on any other platform.

The layout and naming of the tables and columns is undocumented 
because we do not support applications accessing our persistent 
stores out from underneath us.  We cannot condone violating the 
encapsulation of our APIs.


It should be self evident there's no way to ensure the API contract 
we provide if the data is mutated by a third party.  The only way for 
validation or delete rules to work correctly is if you actually use 
them.


As well, SQLite itself continues to evolve, and we use new features 
on new versions of OSX.  The data files themselves are backwards 
compatible, but you may not be able to replicate the interaction 
between Core Data and SQLite on older releases. e.g. the 10.5 version 
of Core Data expects the 10.5 version of SQLite.  Copying the SQL we 
send and then pasting it on 10.4 is not supported.


Guaranteeing we only use SQLite in a certain fashion would limit the 
improvements and features we could add in the future.  To date, this 
constraint has been mostly requested by people wanting to write 
Windows software.


I notice you have never filed a bug against Core Data.  Perhaps you 
should submit your feature request.


You might also want to pick up a copy of Martin Fowler's Patterns Of 
Enterprise Application Architecture if you'd like to understand more

about how to store and retrieve objects using relational databases


Martin Fowler has some interesting tidbits, but on the whole this 
book is not appropriate for desktop application development.  It has 
little to do with how databases actually work, and is focused on 
enterprise Java server applications.

--

-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 [EMAIL PROTECTED]


Re: CoreData local and on server sync

2008-06-23 Thread Ben Trumbull
The way that I did before was, creating my own local database, en then 
when there was a change, replicate the changed data, using DO, to the 
server.


But then I have to keep things in memory.

I was hoping for new ideas or that In the Snow version  was something 
new.
I guess the way to go is, use a local SQL store with CoreData, and 
replicate the changed data from local to the server using DO.

The server will also have coredata using SQL.


People have done that.


But what should I do?

1. The server should have multiply network entries/connections, but
only one entry to the coredata > SQL


This is a lot simpler, and probably what you want to start with.

2. The server should have multiply network entries/connections, and 
equal multiply entries to the coredata > SQL <- will coredata keep the 
data uptodate from different read/write requests ( entries) of the
same data? If f.e one connection do a request for data A and change 
something of data A, that a second connection who want also read Data

A get the update data?


On 10.5 that's possible, but tricky.  It requires attention to a lot 
of details, like staleness intervals, merge policies, and refreshing 
objects.

--

-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 [EMAIL PROTECTED]


NSDateFormatter -- accepting different formats at runtime

2008-06-23 Thread Daniel Richman

Hello All,

I have an NSDateFormatter in an NSTableView. I would like the user to be 
able to enter dates in different ways, e.g.


1/2/07
January 17, 2008

I know it is possible to set how the date is formatted at compile time 
via IB, but is there any way to accept multiple formats at runtime?


Thanks,
Daniel
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 11:06 AM, David Carlisle wrote:

 just finished my first simple Core Data Document Based  
Application.  Four entities with multiple relationships.  Now I want  
to recreate the same thing using just SQLite.  I don't know SQLite,  
and I know very little Unix.


This isn't something I'd advise unless you're extremely curious, or  
have a strong need to do a database-based app that goes beyond what  
CoreData can do. The basics of SQL aren't hard, but the learning curve  
gets steeper if you want to do enough for a real app; and integrating  
raw database APIs into object-oriented apps can be very difficult  
because they're two very different approaches to managing data. (Trust  
me, I did exactly this in my last project, and it was a ton of work.)


If you do want to learn sqlite, I highly recommend Michael Owens's  
"The Definitive Guide To SQLite" from Apress . It has a good introduction to SQL and to the sqlite API.


In addition to QuickLite, another good set of Cocoa sqlite wrappers is  
Gus Mueller's FMDB .


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDateFormatter -- accepting different formats at runtime

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 2:24 PM, Daniel Richman wrote:

I know it is possible to set how the date is formatted at compile  
time via IB, but is there any way to accept multiple formats at  
runtime?


The only real way to do this is to create a number of  
NSDateFormatters, each with a different format string, and try to  
parse your date string with each one in turn. (That's what Apple's RSS- 
parsing frameworks had to do, to support all the 'creative' misuses of  
date formats in real-world news feeds.)


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
I am studying an application design by implementing it with Core Data,  
then studying how I would move it to a platform where only sqlite is  
available.


I appreciate the book recommendations.  I found where the Definitive  
Guide to SQLite is available as an ebook, so I might go that route.   
Otherwise it is listed for 2-5 weeks.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document name  
to make it work, so that answered that question.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


I think poking around with sqlite3 and browsing the sqlite header file  
suggests questions for when I buy the book.


DC

On Jun 23, 2008, at 2:14 PM, Ben Trumbull wrote:


David,

I highly recommend these two books:







Now I want to recreate the same thing using just SQLite.  I don't  
know SQLite, and I know very little Unix.


Why do you want to use SQLite directly ?  I don't think it's  
currently a good fit for your self described skill level.  If you're  
simply interested in learning, pick up those books, and maybe one or  
two on UNIX, and hack at it.

--

-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 [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 2:35 PM, David Carlisle wrote:

I am studying an application design by implementing it with Core  
Data, then studying how I would move it to a platform where only  
sqlite is available.


Whew. If you want to implement an app the same way on a no-CoreData  
platform, you're talking about basically re-implementing CoreData.  
That would be a terrifyingly large and difficult task. Keep in mind  
that CoreData has been in development in one form or another for about  
15 years (it does back to NeXT's Enterprise Object Framework.) A lot  
of the magic inside NSManagedObject relies on very sophisticated  
manipulation of the Objective-C runtime.


If you want to write an app that's portable between CoreData and non- 
CoreData platforms, I would suggest using one of the existing wrappers  
(QuickLite or FMDB) instead of CoreData.  They're not as powerful, but  
you'll be able to use them on both platforms without having to change  
your code.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document  
name to make it work, so that answered that question.


SQLite doesn't care what the filename extension is, so that couldn't  
have been the issue.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


And that statement was immediately denied by a CoreData engineer. I  
have never heard of CoreData using any undocumented sqlite features.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle

Your comments noted below are not encouraging.

I'll likely get the Definitive Guide, and perhaps study one of the  
Cocoa sqlite wrappers.


On Jun 23, 2008, at 3:27 PM, Jens Alfke wrote:

integrating raw database APIs into object-oriented apps can be very  
difficult because they're two very different approaches to managing  
data. (Trust me, I did exactly this in my last project, and it was a  
ton of work.)


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: PDFKit guidance

2008-06-23 Thread John Calhoun

On Jun 21, 2008, at 6:34 PM, Adam R. Maxwell wrote:
I appreciated Antonio's (and your) reminder :).  If I understand  
correctly, the OP could create a PDF context with  
kCGPDFXDestinationOutputProfile set to a grayscale profile


QuartzFilters make all that a lot simpler. You would create a  
QuartzFilter that does grayscale (look at ColorSync Utility for  
examples and how to create them).  The load the QuartzFilter with:


 + (QuartzFilter*) quartzFilterWithURL:(NSURL*) aURL;

You can then either apply it to a context (in your PDFPage subclass)  
with:


 - (BOOL) applyToContext:(CGContextRef) aContext;

Or better still, pass it in the options dictionary to one of  
PDFDocument's save routines (key == @"QuartzFilter"):


 - (BOOL) writeToFile: (NSString *) path withOptions:  
(NSDictionary *) options;


Subclassing PDFPage apparently requires 10.5, also, unless I'm  
missing something.


Not strictly speaking.  You can subclass PDFPage in 10.4 but you will  
not be able to get PDFDocument to create instances of your subclass  
when handed a PDF file (i.e. through -[PDFDocument initWithURL:]).   
You can however still create an empty PDFDocument on 10.4 and - 
insertPage your subclassed PDFPage.


QuartzFilters though were only introduced in 10.5

John Calhoun—___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
I'm just studying the issues so far.  The sqlite version doesn't have  
to work just like the Core Data version, except on the surface.  I'm  
only beginning to get a grasp of how deep the implementation  
differences would need to be.


As far as the filename extension, if I don't use the .sqlite  
extension, then sqlite3 creates an empty textfile with the same name  
as the database:


Last login: Mon Jun 23 14:19:24 on ttys000
10:~ idev$ sqlite3 SQLiteStudy1
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .dump
BEGIN TRANSACTION;
COMMIT;
sqlite> .exit
10:~ idev$ sqlite3 SQLiteStudy1.sqlite
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE ...  the data structures are dumped as expected here

On Jun 23, 2008, at 3:44 PM, Jens Alfke wrote:



On 23 Jun '08, at 2:35 PM, David Carlisle wrote:

I am studying an application design by implementing it with Core  
Data, then studying how I would move it to a platform where only  
sqlite is available.


Whew. If you want to implement an app the same way on a no-CoreData  
platform, you're talking about basically re-implementing CoreData.  
That would be a terrifyingly large and difficult task. Keep in mind  
that CoreData has been in development in one form or another for  
about 15 years (it does back to NeXT's Enterprise Object Framework.)  
A lot of the magic inside NSManagedObject relies on very  
sophisticated manipulation of the Objective-C runtime.


If you want to write an app that's portable between CoreData and non- 
CoreData platforms, I would suggest using one of the existing  
wrappers (QuickLite or FMDB) instead of CoreData.  They're not as  
powerful, but you'll be able to use them on both platforms without  
having to change your code.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document  
name to make it work, so that answered that question.


SQLite doesn't care what the filename extension is, so that couldn't  
have been the issue.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


And that statement was immediately denied by a CoreData engineer. I  
have never heard of CoreData using any undocumented sqlite features.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Steven W Riggins


On Jun 23, 2008, at 2:52 PM, David Carlisle wrote:


Your comments noted below are not encouraging.


Sometimes the truth is discouraging :)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Cocoa Text System: How to determine the caret position?

2008-06-23 Thread Yung-Luen Lan
Hi,

I'm writing my own text view because I need laying out text along
arbitrary path and vertical text.

Rendering text is good with Core Text. However, I don't know how to
decide where should I draw the caret. The problem is, character and
glyph is not 1-1 mapping. For example, two characters "fi" will be
treat as one ligature glyph. Using Core Text, I can only retreive the
position information of "glyph", not "character." Hence I don't know
how to get the caret position when caret is right in the middle of "f"
and "i".

Is there any way to obtain the position information based on
character, not glyph?

Regards,
yllan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 3:13 PM, David Carlisle wrote:

As far as the filename extension, if I don't use the .sqlite  
extension, then sqlite3 creates an empty textfile with the same name  
as the database:


That's what the sqlite3 tool does if you give it a filename that  
doesn't yet exist. This implies that the existing CoreData database  
file you're trying to inspect is named "SQLiteStudy1.sqlite".


So yes, to open an existing file you have to give sqlite3 the exact  
filename including extension; all Unix tools work that way. But  
sqlite3 doesn't care what that filename or extension is.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


NIB Help

2008-06-23 Thread J. Todd Slack

Hi All,

Are there any examples of loading a NIB, accessing a tab view in a  
window of the NIB I just loaded?


I was trying to accomplish via AppleScript originally, but nothing  
seems to be working.


Does anyone have any examples?

Thanks,

-Jason

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Andy Lee

On Jun 23, 2008, at 6:13 PM, David Carlisle wrote:
I'm just studying the issues so far.  The sqlite version doesn't  
have to work just like the Core Data version, except on the  
surface.  I'm only beginning to get a grasp of how deep the  
implementation differences would need to be.


Assuming the data model in your Core Data app wasn't too complicated,  
a simple SQLite version could have four tables and four classes, one  
for each entity.  You could use FMDB, which Jens mentioned and which I  
also like, to do simple reads and writes to the four tables -- a very  
naive approach which would work fine in a simple application.


To get an idea of what Core Data adds on top of that, first consider  
that it manages object *graphs*, not just simple flat records.  As if  
that alone wouldn't be a daunting thing to reproduce, consider this  
list from the docs:





[...]
* Built-in management of undo and redo beyond basic text editing
* Automatic validation of property values to ensure that  
individual values lie within acceptable ranges and that combinations  
of values make sense
* Change propagation, including maintaining the consistency of  
relationships among objects
* Grouping, filtering, and organizing data in memory and in the  
user interface
* Automatic support for storing objects in external data  
repositories
* Optional integration with Cocoa bindings to support automatic  
user interface synchronization

[...]


I believe Core Data also does sophisticated caching.

--Andy





As far as the filename extension, if I don't use the .sqlite  
extension, then sqlite3 creates an empty textfile with the same name  
as the database:


Last login: Mon Jun 23 14:19:24 on ttys000
10:~ idev$ sqlite3 SQLiteStudy1
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .dump
BEGIN TRANSACTION;
COMMIT;
sqlite> .exit
10:~ idev$ sqlite3 SQLiteStudy1.sqlite
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE ...  the data structures are dumped as expected here

On Jun 23, 2008, at 3:44 PM, Jens Alfke wrote:



On 23 Jun '08, at 2:35 PM, David Carlisle wrote:

I am studying an application design by implementing it with Core  
Data, then studying how I would move it to a platform where only  
sqlite is available.


Whew. If you want to implement an app the same way on a no-CoreData  
platform, you're talking about basically re-implementing CoreData.  
That would be a terrifyingly large and difficult task. Keep in mind  
that CoreData has been in development in one form or another for  
about 15 years (it does back to NeXT's Enterprise Object  
Framework.) A lot of the magic inside NSManagedObject relies on  
very sophisticated manipulation of the Objective-C runtime.


If you want to write an app that's portable between CoreData and  
non-CoreData platforms, I would suggest using one of the existing  
wrappers (QuickLite or FMDB) instead of CoreData.  They're not as  
powerful, but you'll be able to use them on both platforms without  
having to change your code.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document  
name to make it work, so that answered that question.


SQLite doesn't care what the filename extension is, so that  
couldn't have been the issue.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


And that statement was immediately denied by a CoreData engineer. I  
have never heard of CoreData using any undocumented sqlite features.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NIB Help

2008-06-23 Thread Daniel Richman
What do you mean, loading a NIB? Do you mean in Interface Builder, or at 
runtime?


Daniel


J. Todd Slack wrote:

Hi All,

Are there any examples of loading a NIB, accessing a tab view in a 
window of the NIB I just loaded?


I was trying to accomplish via AppleScript originally, but nothing 
seems to be working.


Does anyone have any examples?

Thanks,

-Jason

___

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

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

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



This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Creating Installer Package from Cocoa

2008-06-23 Thread Ryan Harter

Hey all-

I have a helper program that essentially only needs to create a plist  
for a different gui-less program.  This can be done manually, but I  
want a gui to aid users.  What I would like, is for the user to open  
this setup program, set some custom strings and other preferences, and  
have the setup program make a pkg including the plist that can then be  
deployed to all the macs.


Any thoughts,

Ryan
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTreeController filter contents

2008-06-23 Thread Michael Hanna
How do I filter-out the contents of an NSTreeController? I saw an
example with NSArrayController by overriding the [NSArrayController
-arrangeObjects] method, but NSTreeController doesn't have this
method.

So if a non-leaf or leaf node has a certain attributes set, like
-isEnabled, I'd like to simply not have the NSTreeController display
the node(and it's children).

I want to avoid putting view information in my model, so that is why I
need to use a filter. 10.4 or higher is my requirement.

best regards,
Michael
___

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

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

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

This email sent to [EMAIL PROTECTED]


CoteData pagination

2008-06-23 Thread Ian

Hi all,

I know this has been asked before... I've been searching and searching  
and RTFMing so I've seen the paper-trail of askees over the years...


Anyway, is there any way to query CoreData in chunks? I have a very  
large CoreData SQl store (>1 million) of managed objects and it's  
taking for ever (well, tens of minutes) to load it all in, never mind  
to search through it all.


NSFetchRequest has a very handy setFetchLimit selector but it's fairly  
useless (to my particular problem anyhow) without being able to  
specify an offset.


Being able to say "give me the first 1 rows" is cool and all, but  
not being able to say "give me the NEXT 1 rows" is a real pain.


I know CoreData is supposed to be able to handle billions (citation: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html 
 [search page text for "billions"]) of rows, but seriously, I'm not  
getting these results. Any more than a few tens of thousands of  
results and it's slow down city.


I think I have a solution... I'm about to embark on a testing run with  
using multiple stores... if I hit more than umpteen thousand records,  
I'll just create a new store and stick the new rows in there... this  
way, when the user performs a search, I can query the first store,  
present the results, then append the results of searching subsequent  
stores as they become available. At least in this way the user has  
something to be looking at while the rest of the search is performed.


I know this way of doing things is tantamount to spinning plates, but  
it's gotta be worth a shot right?


So, my question is... does any bright soul have any light to shed, any  
experiences to share, etc etc, with manipulating very large data sets  
in CoreData?


Yours, extremely grateful for any advice,
Ian



___

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

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

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

This email sent to [EMAIL PROTECTED]


CoreData pagination [was: CoteData pagination]

2008-06-23 Thread Ian

LOL - CoreData, not CoteData, you knew what I meant I'm sure!

On 24 Jun 2008, at 01:11, Ian wrote:


Hi all,

I know this has been asked before... I've been searching and  
searching and RTFMing so I've seen the paper-trail of askees over  
the years...


Anyway, is there any way to query CoreData in chunks? I have a very  
large CoreData SQl store (>1 million) of managed objects and it's  
taking for ever (well, tens of minutes) to load it all in, never  
mind to search through it all.


NSFetchRequest has a very handy setFetchLimit selector but it's  
fairly useless (to my particular problem anyhow) without being able  
to specify an offset.


Being able to say "give me the first 1 rows" is cool and all,  
but not being able to say "give me the NEXT 1 rows" is a real  
pain.


I know CoreData is supposed to be able to handle billions (citation: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html 
 [search page text for "billions"]) of rows, but seriously, I'm not  
getting these results. Any more than a few tens of thousands of  
results and it's slow down city.


I think I have a solution... I'm about to embark on a testing run  
with using multiple stores... if I hit more than umpteen thousand  
records, I'll just create a new store and stick the new rows in  
there... this way, when the user performs a search, I can query the  
first store, present the results, then append the results of  
searching subsequent stores as they become available. At least in  
this way the user has something to be looking at while the rest of  
the search is performed.


I know this way of doing things is tantamount to spinning plates,  
but it's gotta be worth a shot right?


So, my question is... does any bright soul have any light to shed,  
any experiences to share, etc etc, with manipulating very large data  
sets in CoreData?


Yours, extremely grateful for any advice,
Ian



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData pagination

2008-06-23 Thread Jim Correia

On Jun 23, 2008, at 8:11 PM, Ian wrote:

I know this has been asked before... I've been searching and  
searching and RTFMing so I've seen the paper-trail of askees over  
the years...


Anyway, is there any way to query CoreData in chunks? I have a very  
large CoreData SQl store (>1 million) of managed objects and it's  
taking for ever (well, tens of minutes) to load it all in, never  
mind to search through it all.


That sounds like 2 separate problems. You should be able to specify a  
fetch request such that the data is searched/filtered in the database;  
you'll only have to pay for loading the results.


Also, unless your working set is so large that you are paging,  
breaking the work into chunks is may not affect positively affect the  
aggregate time required. (But will keep the high water mark for  
resource usage down.)


So, my question is... does any bright soul have any light to shed,  
any experiences to share, etc etc, with manipulating very large data  
sets in CoreData?


The way I deal with this on 10.5 is to use request that the fetch  
request return object IDs instead of fully realized objects, then  
fault them in in batches.


Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa Text System: How to determine the caret position?

2008-06-23 Thread Graham Cox

[NSLayoutManager_inst characterIndexForGlyphAtIndex:ig];

[NSLayoutManager_inst locationForGlyphAtIndex:ig];



On 24 Jun 2008, at 8:25 am, Yung-Luen Lan wrote:


Is there any way to obtain the position information based on
character, not glyph?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa Text System: How to determine the caret position?

2008-06-23 Thread Douglas Davidson


On Jun 23, 2008, at 5:33 PM, Graham Cox wrote:


[NSLayoutManager_inst characterIndexForGlyphAtIndex:ig];

[NSLayoutManager_inst locationForGlyphAtIndex:ig];



On 24 Jun 2008, at 8:25 am, Yung-Luen Lan wrote:


Is there any way to obtain the position information based on
character, not glyph?




Graham, you're reducing the problem too far.  Converting the character  
index to a glyph index, then getting the location for that glyph  
index, is probably what the OP is already doing, and as he notes, it  
won't return an insertion point position within a glyph.  In general  
insertion point positions are not necessarily identical to glyph  
locations.


The Cocoa text system has a couple of solutions for this:  first, you  
can use  
rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount 
: with a zero-length range to obtain a single insertion point  
location; second, you can use  
getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes 
: to obtain insertion points in bulk for an entire line (useful for  
movement and so on).


However, the OP in the body of the message seems to say that he's  
using CoreText, while the subject refers to the Cocoa text system.   
It's not clear which one is intended.  In CoreText, I believe the  
relevant call would be CTLineGetOffsetForStringIndex(), where the  
index in question is a character index.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData pagination

2008-06-23 Thread Quincey Morris


On Jun 23, 2008, at 17:11, Ian wrote:


Hi all,

Anyway, is there any way to query CoreData in chunks? I have a very  
large CoreData SQl store (>1 million) of managed objects and it's  
taking for ever (well, tens of minutes) to load it all in, never  
mind to search through it all.


NSFetchRequest has a very handy setFetchLimit selector but it's  
fairly useless (to my particular problem anyhow) without being able  
to specify an offset.


Being able to say "give me the first 1 rows" is cool and all,  
but not being able to say "give me the NEXT 1 rows" is a real  
pain.


I know CoreData is supposed to be able to handle billions (citation: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html 
 [search page text for "billions"]) of rows, but seriously, I'm not  
getting these results. Any more than a few tens of thousands of  
results and it's slow down city.


The problem is that Core Data doesn't use rows -- it doesn't have any  
intrinsic ordering of objects (that's why unsorted results are always  
sets, not arrays). There's no general concept of the "next" 1  
objects.


To query in chunks, you need to implement your own concept of ordering  
(which may or may not be easy, depending on your requirements). For  
example, if you can allocate each object a sequence number (as a  
permanent attribute), you could use a sequence number range as part of  
each potentially large fetch. If you turn on indexing for the  
attribute, there should be no significant performance degradation  
dependent on which range you fetch.


Obviously, a simple sequence number is not a good solution if many  
objects can be randomly deleted. There's likely no good *general*  
solution for all applications, which is (AFAIK) the reason Core Data  
doesn't yet offer intrinsic ordering of objects. Another possibly  
workable attribute might be date/time of object creation, date/time of  
object modification, or a random hash of something like the object UID.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData pagination

2008-06-23 Thread Jim Correia

On Jun 23, 2008, at 8:53 PM, Quincey Morris wrote:

The problem is that Core Data doesn't use rows -- it doesn't have  
any intrinsic ordering of objects (that's why unsorted results are  
always sets, not arrays). There's no general concept of the "next"  
1 objects.


To query in chunks, you need to implement your own concept of  
ordering (which may or may not be easy, depending on your  
requirements).


Relationships are intrinsically unordered.

When fetching objects though, the order can be as deterministic as you  
need it to be; set an appropriate sortDescriptor on the fetch request.


Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTreeController filter contents

2008-06-23 Thread Jens Alfke


On 23 Jun '08, at 5:10 PM, Michael Hanna wrote:


How do I filter-out the contents of an NSTreeController? I saw an
example with NSArrayController by overriding the [NSArrayController
-arrangeObjects] method, but NSTreeController doesn't have this
method.


I asked about this a month or two ago, and the consensus seemed to be  
that there isn't any built-in way to filter the contents of the tree.


I've ended up doing the filtering myself. If we call my regular tree  
model class Item, then I've created a class FilteredItem. This acts as  
a proxy for an Item, but its -children method filters out the children  
I don't want to display, and returns FilteredItem proxies for those I  
do.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData pagination

2008-06-23 Thread Ben Trumbull
Anyway, is there any way to query CoreData in chunks? I have a very 
large CoreData SQl store (>1 million) of managed objects and it's 
taking for ever (well, tens of minutes) to load it all in, never mind

to search through it all.


(1) Why do you want to load it all in ?
(2) Why won't you let Core Data search it with a fetch request+predicate ?
(3) What are you trying to accomplish ?  Why do you want to show the 
user millions of records simultaneously ?

(4)

2008-06-23 18:34:41.098 CoreDataFetchTool[459:10b] CoreData: 
annotation: sql connection fetch time: 0.7982s
2008-06-23 18:34:41.493 CoreDataFetchTool[459:10b] CoreData: 
annotation: total fetch execution time: 1.2037s for 100 rows.

Fetched 100 items at 789505 rows per second.
Total test time: 1.2666s

So, you're running 3+ orders of magnitude off the lower bound.  You 
should try looking at things with Shark and Instruments.


(5) As Jim suggests, you can get back just the object IDs with:

[request setResultType:NSManagedObjectIDResultType];
[request setIncludesPropertyValues:NO];

then I get:

2008-06-23 18:36:58.495 CoreDataFetchTool[521:10b] CoreData: 
annotation: sql connection fetch time: 0.2418s
2008-06-23 18:36:58.505 CoreDataFetchTool[521:10b] CoreData: 
annotation: total fetch execution time: 0.2575s for 100 rows.

Fetched 100 items at 3608102 rows per second.
Total test time: 0.2772s

Then you can use an IN predicate with a sliding window of objectIDs. 
Perhaps in batches of a thousand.



Any more than a few tens of thousands of results and it's slow down city.


I can get 10,000 items back 3 times per user event (100ms).

You're probably thrashing the VM system.  That's the easiest way to 
burn a few orders of magnitude in performance.


In addition to the above, you should consider your model (schema) and 
break up your primary entity so ancillary attributes are not a part 
of this large fetch.



I'm about to embark on a testing run with using multiple stores


You should use Shark and Instruments to fix the current problems 
first.  It sounds like you're memory bound.  Use less of it.


While multiple stores can be useful, they also prevent us from 
leveraging the maximal number of optimizations.  Results may need to 
be sorted in memory (since none of the databases have all of them), 
and various other issues.

--

-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 [EMAIL PROTECTED]


Re: Cocoa Text System: How to determine the caret position?

2008-06-23 Thread Graham Cox
Yes, fair enough the problem is more complicated than I realised - I  
guess I assumed that insertion points were always in between glyphs  
but of course with ligatures etc. that isn't the case.


Going back to the OP's original reason for this, My feeling is that  
he's going about it the wrong way. Core Text isn't a text editing  
framework, it's a text layout framework. I thought that using Cocoa's  
text system you can get text editing as well as layout for arbitrary  
text containers including text on a path or vertical text. However  
it's one thing to say it's possible and another to suggest how to do  
it, and I don't have the expertise to do that. But reinventing your  
own text editor from scratch seems like a lot of unnecessary work.


cheers, Graham


On 24 Jun 2008, at 10:52 am, Douglas Davidson wrote:



On Jun 23, 2008, at 5:33 PM, Graham Cox wrote:


[NSLayoutManager_inst characterIndexForGlyphAtIndex:ig];

[NSLayoutManager_inst locationForGlyphAtIndex:ig];



On 24 Jun 2008, at 8:25 am, Yung-Luen Lan wrote:


Is there any way to obtain the position information based on
character, not glyph?




Graham, you're reducing the problem too far.  Converting the  
character index to a glyph index, then getting the location for that  
glyph index, is probably what the OP is already doing, and as he  
notes, it won't return an insertion point position within a glyph.   
In general insertion point positions are not necessarily identical  
to glyph locations.


The Cocoa text system has a couple of solutions for this:  first,  
you can use  
rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount 
: with a zero-length range to obtain a single insertion point  
location; second, you can use  
getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes 
: to obtain insertion points in bulk for an entire line (useful for  
movement and so on).


However, the OP in the body of the message seems to say that he's  
using CoreText, while the subject refers to the Cocoa text system.   
It's not clear which one is intended.  In CoreText, I believe the  
relevant call would be CTLineGetOffsetForStringIndex(), where the  
index in question is a character index.


Douglas Davidson



___

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

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

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

This email sent to [EMAIL PROTECTED]


How to get a message when RETURN is pressed in a NSTextField

2008-06-23 Thread Markus Spoettl

Hello List,

  this is almost too embarrassing to ask but I can't for the life of  
me figure out how to get notified (on a NSWindowController class) when  
RETURN was pressed in a certain NSTextField sitting in on the window  
of that controller.


I get -insertNewLine: when return is pressed on anything but the text  
field. For the text field it's not invoked, so there must be another  
message. Which? keyDown or keyUp is not called.


I'm using Xcode 3.0 on OS X 10.5.3

Thanks for your help!

Regards
Markus
--
__
Markus Spoettl

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get a message when RETURN is pressed in a NSTextField

2008-06-23 Thread Kenny Leung

Hi Markus.

NSTextField is a single-line entry control, so it wants to end editing  
when you hit return. In order to be notified, you should wire up its  
target outlet to be your controller and wire up its action to be an  
action method in your controller. If you are not familiar with target- 
action, you should read about it in the dev docs:


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_5.html

-Kenny


On Jun 23, 2008, at 8:38 PM, Markus Spoettl wrote:


Hello List,

 this is almost too embarrassing to ask but I can't for the life of  
me figure out how to get notified (on a NSWindowController class)  
when RETURN was pressed in a certain NSTextField sitting in on the  
window of that controller.


I get -insertNewLine: when return is pressed on anything but the  
text field. For the text field it's not invoked, so there must be  
another message. Which? keyDown or keyUp is not called.


I'm using Xcode 3.0 on OS X 10.5.3

Thanks for your help!

Regards
Markus
--
__
Markus Spoettl

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get a message when RETURN is pressed in a NSTextField

2008-06-23 Thread Markus Spoettl

Hi Kenny,

On Jun 23, 2008, at 9:39 PM, Kenny Leung wrote:
NSTextField is a single-line entry control, so it wants to end  
editing when you hit return. In order to be notified, you should  
wire up its target outlet to be your controller and wire up its  
action to be an action method in your controller. If you are not  
familiar with target-action, you should read about it in the dev docs:



Thanks for your suggestion. Unfortunately that doesn't work because I  
cannot differentiate between the multiple possibilities of what makes  
the action fire. The NSTextField action is sent not only for pressing  
enter but also when the control looses firstResponder status.


Sure, I could workaround this by checking if the text field is still  
firstResponder and then assume it was enter that caused the event.


However, I was hoping that there is a definitive way to actually know  
that RETURN has been pressed on the text field.


Regards
Markus
--
__
Markus Spoettl

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Assert trigged in -[NSEvent eventNumber]

2008-06-23 Thread Mattias Arrelid
On Mon, Jun 23, 2008 at 7:24 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:
>
> On 23 Jun '08, at 5:21 AM, Mattias Arrelid wrote:
>
>>  The error claim that an
>> assert has failed in -[NSEvent eventNumber] - and each time this
>> occured, our custom mouse tracking seemed to stop working.
>> Unfortunately, I do not have access to the log at the moment. What
>> would be the right™ thing to do here? Since it isn't an exception, I
>> cannot catch it myself, so I'm fumbling in the dark at the moment.
>
> Assertion failures *are* NSExceptions, and you can use an @catch block to
> intercept them.

Ah! I did fail to read up on NSAssert - I was stuck on simple C
asserts so I didn't think that long. Thanks for pointing this out.

> However, they also indicate an error in your code, so of course you should
> try to fix the bug instead of just ignoring the exception. The best thing to
> do is to use Xcode's breakpoints window to add a breakpoint at
> "objc_exception_throw" (on Leopard) or "NSRaiseError" (Tiger), and run your
> code with breakpoints on until you can get the exception to occur. Then you
> can look at the stack and your variables to figure out what's wrong.
>
> If it's one of those unpleasant bugs that only manifests when no one's
> looking for it, you can build some debugging features into the app. My
> MYUtilities library[1] has a module called ExceptionUtils[2] for use in
> displaying backtraces of exceptions. You can use this to have any uncaught
> exception pop up an alert panel containing the full backtrace.

With the above fresh in my mind, I looked through the logs and found this:
*** Assertion failure in -[NSEvent eventNumber],
/SourceCache/AppKit/AppKit-949.33/AppKit.subproj/NSEvent.m:787
Invalid message sent to event "NSEvent: type=SysDefined loc=(333,548)
time=183243.9 flags=0x100 win=0x0 winNum=0 ctxt=0xf8db subtype=7
data1=1 data2=0"

Looking at the parameters, it looks like I'm trying to do something
with a custom NSEvent that Apple doesn't approve. Turning on the
"objc_exception_throw" breakpoint and then running the application for
a few hours (phew!) caught the above mentioned exception - and much to
my delight, the debugger clearly showed me why the assert was
triggered; I was trying to pass the custom event to NSWindow's
dragImage:at:offset:event:pasteboard:source:slideBack:.

Many thank Jens!

/ Mattias
___

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

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

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

This email sent to [EMAIL PROTECTED]