Re: NSTableView and OutineView resizing bugs

2009-08-23 Thread Ernesto Giannotta


On 23/ago/09, at 04:33, Adam R. Maxwell wrote:



On Aug 21, 2009, at 1:45 PM, Ernesto Giannotta wrote:

After a lot of tests I've noticed that this bug is greatly reduced  
if drawsBackground is set to false, but I still can see a white  
line and a ghost right image while enlarging.


Have you seen this?

http://www.cocoabuilder.com/archive/message/cocoa/2009/3/2/231390



Thanks Adam! I've spent days looking for that bit of knowledge...

It worked like charm... but only if you set DrawBackground off ;-)


Cool Runnings,
Erne.

___

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

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

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

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


Problem with unbind:

2009-08-23 Thread Martin Hewitson

Dear list,

I've been trying to do some programmatic bindings because I want to  
change a binding depending on the state of a check box. In more  
detail, I have an NSArrayController whose contents I want to bind to  
either all entities of a particular type in the MOC, or to a subset of  
those. This is a 'show all' check box.


So far I have tried the following code:

- (IBAction)showAllEntries:(id)sender
{
if([showAllCheckButton state]==NSOnState) {
NSLog(@Showing all);

[entryArrayController unbind:@contentSet];

} else {
NSLog(@Showing category entries);

[entryArrayController bind:@contentSet
toObject:categoryArrayController
 withKeyPath:@selection.entries
 options:nil];
}
}

When the app launches, my bound table view shows all entries. When I  
uncheck the check box, the table is emptied because none of the  
entries has any categories assigned, as yet. Re-checking the check- 
box, however, does not yield the full list again. I was hoping that  
unbinding the binding would return the array controller to the state  
it was before I set the binding, and hence the table view would be  
repopulated.


A further detail: the core data model has two entities, an Entry and a  
Category. They have a many-many relationship:


categories - entries

I'm sure I'm going wrong in many ways, and would appreciate any  
pointers to get me on the right track. Essentially what I'm aiming for  
is that entries can belong to none or many categories. So I want to be  
able to show the list of entries that are in one or more categories,  
but also I want to show a full list, independent of the categories  
(the 'show all' feature).


Best wishes,

Martin



Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

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


Re: Problem with unbind:

2009-08-23 Thread Martin Hewitson
I've found what may be considered a workaround. I can unbind the  
Content Set then use a fetch request and setContent: to get back the  
full list. The code looks like:


NSManagedObjectContext *moc = [self managedObjectContext];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@Entry

 
inManagedObjectContext:moc]];
NSError *error = nil;
NSArray *results = [moc executeFetchRequest:request 
error:error];
if (error) {
[NSApp presentError:error];
return;
}

[entryArrayController setContent:results];


Not sure this is the most elegant way to do this, but it seems to work.


On Aug 23, 2009, at 11:30 AM, Martin Hewitson wrote:


Dear list,

I've been trying to do some programmatic bindings because I want to  
change a binding depending on the state of a check box. In more  
detail, I have an NSArrayController whose contents I want to bind to  
either all entities of a particular type in the MOC, or to a subset  
of those. This is a 'show all' check box.


So far I have tried the following code:

- (IBAction)showAllEntries:(id)sender
{
if([showAllCheckButton state]==NSOnState) {
NSLog(@Showing all);

[entryArrayController unbind:@contentSet];

} else {
NSLog(@Showing category entries);

[entryArrayController bind:@contentSet
toObject:categoryArrayController
 withKeyPath:@selection.entries
 options:nil];
}
}

When the app launches, my bound table view shows all entries. When I  
uncheck the check box, the table is emptied because none of the  
entries has any categories assigned, as yet. Re-checking the check- 
box, however, does not yield the full list again. I was hoping that  
unbinding the binding would return the array controller to the state  
it was before I set the binding, and hence the table view would be  
repopulated.


A further detail: the core data model has two entities, an Entry and  
a Category. They have a many-many relationship:


categories - entries

I'm sure I'm going wrong in many ways, and would appreciate any  
pointers to get me on the right track. Essentially what I'm aiming  
for is that entries can belong to none or many categories. So I want  
to be able to show the list of entries that are in one or more  
categories, but also I want to show a full list, independent of the  
categories (the 'show all' feature).


Best wishes,

Martin



Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
   Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de

This email sent to martin.hewit...@aei.mpg.de



Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

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


NSAttributedString and Scripting Bridge

2009-08-23 Thread Graham Cox
I've successfully used Scripting Bridge to pass plain text and  
attachments to Mail for sending, as part of an internal (non public)  
app.


I'd like if possible to send mail as rich text. I have the message as  
an NSAttributedString, and can easily get this as all sorts of  
formats, such as RTF. However, the Scripting Bridge works with  
Applescript's 'text' type (or 'mailText' in this case) which is  
completely different - it's just a tree of paragraphs and attribute  
runs.


Before I embark on a very long-winded conversion to this form, has  
anyone already done it, or knows of a quicker way?


I'm surprised if there's no support for this built-in somewhere.

--Graham


___

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

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

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

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


Re: User interface validation doesn't work, right?

2009-08-23 Thread Houdah - ML Pierre Bernard

Just ran into the same problem and came up with HHValidatedButton:
http://www.bernard-web.com/pierre/blog/index.php?id=6542976061063123843

Pierre Bernard

On Jul 1, 2009, at 11:24 PM, Bill Cheeseman wrote:

For years, the Implementing Validation section of Apple's User  
Interface Validation document has said  the following:


Before it is displayed, a user interface item checks to see if its  
target implements validateUserInterfaceItem:. If it does, then the  
enabled status of the item is determined by the return value of the  
method. You can therefore conditionally enable or disable an item by  
implementing validateUserInterfaceItem: in the target object.


This has never been true. Right?

My custom window controller implements the action method for a  
button, so it is the button's target, and it also implements - 
validateUserInterfaceItem:, all according to the User Interface  
Validation document. But my -validateUserInterfaceItem: method is  
never called.


If I want it to be called automatically, by analogy to - 
validateMenuItem:, I have to override NSWindow's -update method, by  
analogy to -[NSMenu update]. In my override of -update, I have to do  
for myself what the document claims already happens -- or I have to  
observe NSWindow's -NSWindowDidUpdateNotification. Right?



--

Bill Cheeseman
b...@cheeseman.name

___

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

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

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

This email sent to pierre.bern...@lists.houdah.com


___

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

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

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

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


Re: Making an NSTableView Display Articles From An RSS Feed.

2009-08-23 Thread Kyle Sluder
On Aug 23, 2009, at 8:04 AM, Joshua Garnham  
joshua.garn...@yahoo.co.uk wrote:



But how exactly would I do this?


It's easy! You just write the code to do it. Simple as that.

Seriously, you need to break down your problem. It involves getting  
the contents of an RSS feed and displaying these contents in an  
NSTableView. Getting the RSS feed involves making an HTTP request and  
parsing the resultant XML. And so on until you get to chunks you can  
attempt yourself.


--Kyle Sluder



___

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

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

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

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


Re: leak in a sound function

2009-08-23 Thread Kyle Sluder

On Aug 23, 2009, at 9:53 AM, Agha Khan agha.k...@me.com wrote:


+ (void) PlaySound:(int) Index


Method names should begin with lowercase letters. Classes really are  
the only things in ObjC that are typically capitalized.


Also you should be using the NSUInteger typedef here.


   NSBundle* bundle = [NSBundle mainBundle];

  …

   [bundle release];


You need to reread the memory management documentation again. You  
didn't get the bundle through alloc, new, or copy, and there you don't  
own it and mustn't release it.


--Kyle Sluder



___

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

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

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

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


Re: How to interact with Web pages using Cocoa?

2009-08-23 Thread Kyle Sluder
On Aug 23, 2009, at 8:04 AM, albert jordan Mobility  
albertjor...@me.com wrote:


I am trying to write a test program that will be entering  
configuration data on a web page and press a button in the web page  
continuously.  Is there a proven method to do this with Objective C?


WebKit.

--Kyle Sluder



___

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

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

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

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


Re: leak in a sound function

2009-08-23 Thread Agha Khan

Thank you All.
I came from Windows and this is my first project with Objective-C.

I am looking Mac provided file SoundEngine.cpp about line 770
OSStatus LoadTrack(const char* inFilePath, Boolean inAddToQueue,  
Boolean inLoadAtOnce)


I realized we are creating pointer to BG_FileInfo pointer and never  
released when we again allocating same pointer. That is a leak. So I  
changed from

BG_FileInfo *fileInfo = new BG_FileInfo;
to
static BG_FileInfo *fileInfo = NULL;

if (fileInfo != NULL)
{
delete fileInfo;
fileInfo = NULL;
}

fileInfo = new BG_FileInfo;

Now there is no leak. :-)

I also tried NSBundle* bundle = [[NSBundle mainBundle] retain];

but leak was still there.

All comment are appreciated.

Need more comments what I did is correct.

Best regards
Agha




On Aug 23, 2009, at 11:17 AM, Kyle Sluder wrote:


On Aug 23, 2009, at 9:53 AM, Agha Khan agha.k...@me.com wrote:


+ (void) PlaySound:(int) Index


Method names should begin with lowercase letters. Classes really are  
the only things in ObjC that are typically capitalized.


Also you should be using the NSUInteger typedef here.


  NSBundle* bundle = [NSBundle mainBundle];

 …

  [bundle release];


You need to reread the memory management documentation again. You  
didn't get the bundle through alloc, new, or copy, and there you  
don't own it and mustn't release it.


--Kyle Sluder




___

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

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

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

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


Re: Making an NSTableView Display Articles From An RSS Feed.

2009-08-23 Thread PCWiz
Saw this same question on stackoverflow.com, not sure if that's a  
coincidence. But yeah, you would have to set up a data source for your  
table view and then parse the XML (Look up NSXMLDocument and  
NSXMLParser). This might help: http://weblog.bignerdranch.com/?p=48


On 2009-08-23, at 9:04 AM, Joshua Garnham wrote:


How would I make an NSTableView display an RSS Feed (just one)?
I think it would have something to do with NSURL and Setting the  
Table Views Data Source.

But how exactly would I do this?

Cheers,
Josh.




___

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

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

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

This email sent to pcwiz.supp...@gmail.com


___

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

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

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

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


Re: leak in a sound function

2009-08-23 Thread Agha Khan

Now there was no need to create static either.

if (fileInfo)
  delete fileInfo;
Just add before returning that function.
That is a bug in Mac files.
Best regards
Agha

On Aug 23, 2009, at 11:37 AM, Agha Khan wrote:


Thank you All.
I came from Windows and this is my first project with Objective-C.

I am looking Mac provided file SoundEngine.cpp about line 770
OSStatus LoadTrack(const char* inFilePath, Boolean inAddToQueue,  
Boolean inLoadAtOnce)


I realized we are creating pointer to BG_FileInfo pointer and never  
released when we again allocating same pointer. That is a leak. So I  
changed from

BG_FileInfo *fileInfo = new BG_FileInfo;
to
static BG_FileInfo *fileInfo = NULL;

if (fileInfo != NULL)
{
delete fileInfo;
fileInfo = NULL;
}

fileInfo = new BG_FileInfo;

Now there is no leak. :-)

I also tried NSBundle* bundle = [[NSBundle mainBundle] retain];

but leak was still there.

All comment are appreciated.

Need more comments what I did is correct.

Best regards
Agha




On Aug 23, 2009, at 11:17 AM, Kyle Sluder wrote:


On Aug 23, 2009, at 9:53 AM, Agha Khan agha.k...@me.com wrote:


+ (void) PlaySound:(int) Index


Method names should begin with lowercase letters. Classes really  
are the only things in ObjC that are typically capitalized.


Also you should be using the NSUInteger typedef here.


 NSBundle* bundle = [NSBundle mainBundle];

…

 [bundle release];


You need to reread the memory management documentation again. You  
didn't get the bundle through alloc, new, or copy, and there you  
don't own it and mustn't release it.


--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/agha.khan%40me.com

This email sent to agha.k...@me.com


___

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

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

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

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


Re: Running shell scripts as root.

2009-08-23 Thread I. Savant

On Aug 23, 2009, at 2:31 PM, PCWiz wrote:

Basically I need to run the chown/chmod utilities and probably cp/mv/ 
mkdir as well using root privileges. What would be the best way to  
do this?


  http://developer.apple.com/referencelibrary/GettingStarted/GS_Security/

  Pay particular attention to anything regarding Authorization  
Services.


--
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 arch...@mail-archive.com


Re: Making an NSTableView Display Articles From An RSS Feed.

2009-08-23 Thread Nathan Kinsinger

On Aug 23, 2009, at 12:48 PM, PCWiz wrote:

Saw this same question on stackoverflow.com, not sure if that's a  
coincidence. But yeah, you would have to set up a data source for  
your table view and then parse the XML (Look up NSXMLDocument and  
NSXMLParser). This might help: http://weblog.bignerdranch.com/?p=48


On 2009-08-23, at 9:04 AM, Joshua Garnham wrote:


How would I make an NSTableView display an RSS Feed (just one)?
I think it would have something to do with NSURL and Setting the  
Table Views Data Source.

But how exactly would I do this?

Cheers,
Josh.


For reading the RSS check out the PubSub framework:
http://developer.apple.com/documentation/InternetWeb/Conceptual/PubSub/Introduction/Introduction.html 



--Nathan

BOINCMenubar 2
http://brotherbard.com/boinc/



___

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

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

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

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


Re: leak in a sound function

2009-08-23 Thread Mohsan Khan

On 2009-08-23, at 20:37, Agha Khan wrote:


I also tried NSBundle* bundle = [[NSBundle mainBundle] retain];



Why are you trying to retain?
The documentation says + (NSBundle *)mainBundle - its static and you  
didn't create (alloc, new) the *bundle instance, therefor you don't  
own it, and therefor should not release it either.



That is a bug in Mac files.



Don't just assume that there are alot of bugs in Mac, rather there  
is a bug in your code/architecture.



If you really don't know what you are doing, please read the docs  
first - this might help you save alot of time when developing your  
app. Instead of the trial and error approach = $$$


Where did you find the Mac provided file SoundEngine.cpp?
And how old is this file i.e. when was this code written?
I searched my entire disk and didn't find this file, therefor it can't  
really be Mac provided...



/MK
___

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

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

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

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


Re: Core Animation + Garbage Collection

2009-08-23 Thread Kevin Cathey

Have you enabled wants layer for the view?

Kevin

--
Kevin Cathey


On 22 Aug 2009, at 22:21, Evan M wrote:

So, it isn't Garbage Collection + Core Animation that is breaking  
the transition, I just refactored my entire project to remove GC  
support (big pain) and the animation hasn't changed at all.


Now I'm looking at my custom NSView that is being animated and I'm  
wondering now if that is the problem.


Is there anything special I need to do in a custom NSView to enable  
Core Animation support?


--
Evan


On Aug 19, 2009, at 3:30 PM, Bill Bumgarner wrote:


On Aug 19, 2009, at 10:54 AM, Evan Moseman wrote:

I've been trying to get a fairly simple and well documented  
transition: CIPageCurlTransition to work in my app, but the  
results are awful.  Non filter transitions like kCATransitionFade  
work fine, but when I try to use a CAFilter for the transition the  
best I get is dome chopped up image with the wrong geometry and it  
just looks completely broken.  I've  been trying to figure out  
what the cause is, and the only real difference between my app and  
a few example applications, as far as this code is concerned, is  
that mine has garbage collection enabled, not required though.  I  
ran into this post with a quick google search:

http://blog.fadingred.com/post/80877304/core-animation-and-garbage-collection
Further searches in the Core Animation documentation haven't yet  
revealed a known incompatibility between Core Animation libraries  
and Garbage Collection.

Am I missing something obvious or documented?


It should work.   File a bug via http://bugreport.apple.com and  
send me the bug # directly.


thanks,
b.bum



___

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

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

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

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


___

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

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

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

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


Re: Core Animation + Garbage Collection

2009-08-23 Thread Kyle Sluder

On Aug 23, 2009, at 1:00 PM, Kevin Cathey cat...@apple.com wrote:


Have you enabled wants layer for the view?


And if you have, have you made sure to provide a custom layer *before*  
calling -setWantsLayer:? The default AppKit provided layer is Not  
Yours to touch.


--Kyle Sluder



___

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

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

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

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


Re: Making an NSTableView Display Articles From An RSS Feed.

2009-08-23 Thread I. Savant


On 2009-08-23, at 9:04 AM, Joshua Garnham wrote:


How would I make an NSTableView display an RSS Feed (just one)?
I think it would have something to do with NSURL and Setting the  
Table Views Data Source.

But how exactly would I do this?

Cheers,
Josh.


  Start here:

http://developer.apple.com/documentation/InternetWeb/Conceptual/PubSub/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004945-CH1-DontLinkElementID_24

  Then continue here:

http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/TableView.html

  When you get stuck, ask specific questions, not how do I write  
this whole app. The former shows you're thinking and doing for  
yourself. The latter makes people want to ignore a lazy post.


  Good luck.

--
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 arch...@mail-archive.com


Confusion over erratic behavior in Xcode debugging

2009-08-23 Thread Chase Meadors
This issue has been bothering me. I'm experience some weird behavior  
when debugging with Xcode with breakpoints. Basically, the highlighted  
current code line seems to jump around erratically. It's almost like  
it has to go through a declaration/initialization twice to actually  
register it.


Secondly, when this kind of behavior appears, I get these messages  
when attempting to print items to the console (through right-click  
print description to console)


Printing description of bytes:
The program being debugged was signaled while in a function called  
from GDB.

GDB has restored the context to what it was before the call.
To change this behavior use set unwindonsignal off
Evaluation of the expression containing the function (CFShow) will be  
abandoned.
The program being debugged was signaled while in a function called  
from GDB.

GDB has restored the context to what it was before the call.
To change this behavior use set unwindonsignal off
Evaluation of the expression containing the function (CFShow) will be  
abandoned.


Printing description of bytes:
A syntax error in expression, near `value)'.
A syntax error in expression, near `value)'.

Maybe I'm doing something wrong. Any ideas what causes this behavior?

-Thanks, Chase
___

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

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

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

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


Re: Confusion over erratic behavior in Xcode debugging

2009-08-23 Thread I. Savant

On Aug 23, 2009, at 4:45 PM, Chase Meadors wrote:

This issue has been bothering me. I'm experience some weird behavior  
when debugging with Xcode with breakpoints.


  This is not Cocoa-related. It belongs on the xcode-users list, not  
cocoa-dev.


--
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 arch...@mail-archive.com


Re: Running shell scripts as root.

2009-08-23 Thread Jerry Krinock


On 2009 Aug 23, at 11:57, I. Savant wrote:


On Aug 23, 2009, at 2:31 PM, PCWiz wrote:

Basically I need to run the chown/chmod utilities and probably cp/ 
mv/mkdir as well using root privileges. What would be the best way  
to do this?


 http://developer.apple.com/referencelibrary/GettingStarted/GS_Security/

 Pay particular attention to anything regarding Authorization  
Services.


Yes, you'll need a privileged helper tool.  We had a discussion of  
this over on apple-c...@lists.apple.com a couple months ago and I was  
convinced that it made more sense to temporarily chmod them and then  
cp/mv/mkdir/whatever. [1]  Anyhow, I added two new tools,  
HelperToolTaskDoSetPermissions and HelperToolTaskDoCopyFiles, to my  
BetterAuthorizationSample wrapper. [2]   Even if you can use my tool  
and framework it's still quite messy, though -- privileges have a high  
price.


A better place to discuss this further would be apple-c...@lists.apple.com 
.


Jerry

1.  http://lists.apple.com/archives/Apple-cdsa/2009/May/msg2.html
2.  http://sheepsystems.com/sourceCode/authTasksCocoa.html  Note: The  
new tools, HelperToolTaskDoCopyFiles and HelperToolTaskDoCopyFiles,  
are not demonstrated in the demo app.



___

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

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

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

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


Re: Running shell scripts as root.

2009-08-23 Thread I. Savant

On Aug 23, 2009, at 5:33 PM, Jerry Krinock wrote:

Anyhow, I added two new tools, HelperToolTaskDoSetPermissions and  
HelperToolTaskDoCopyFiles, to my BetterAuthorizationSample wrapper.


  Awesome, Jerry, thanks for that! Looks to be quite useful. I admit  
I have limited experience with this, so I've dutifully bookmarked your  
examples for future reference.


--
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 arch...@mail-archive.com


Solution: Dynamically creating an image with transparent portions.

2009-08-23 Thread Jay Reynolds Freeman
About a month ago I asked a question here that had to do with  
dynamically creating -- at run time -- new instances of NSImage with  
portions that were partially or wholly transparent.  Thanks to the  
help received, I solved my problem by another means, but I eventually  
did find out that there appears to be a documented way to do what I  
wanted, well hidden in a tech note.  (Not so much well hidden as that  
I did not happen to use search terms that might have found it.)  I  
thought I ought to mention it.


The note in question is this one:

http://developer.apple.com/releasenotes/Cocoa/AppKitOlderNotes.html

Within it, scan for NSView Drawing Redirection API (Section added  
since WWDC).


I haven't tried it yet, but it looks like exactly what I was asking  
for in the first place.


--  Jay Reynolds Freeman
-
jay_reynolds_free...@mac.com
http://web.mac.com/jay_reynolds_freeman (personal web site)


___

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

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

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

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


Re: User interface validation doesn't work, right?

2009-08-23 Thread Bill Cheeseman


On Aug 23, 2009, at 9:39 AM, Houdah - ML Pierre Bernard wrote:


Just ran into the same problem and came up with HHValidatedButton:
http://www.bernard-web.com/pierre/blog/index.php? 
id=6542976061063123843


I actually came up with the answer after this thread died (only  
waiting for you to bring it back to life!).


It's way too complicated to spell it out here but, basically, - 
validateUserInterfaceItem: has replaced the old -validateMenuItem:  
method in Leopard and newer for menu items and it works the same way.  
But for user controls like buttons you have to declare your own  
protocol methods. It only takes half a dozen lines of code and it's  
real easy to do -- and it works perfectly. The only problem is that it  
isn't documented adequately, so you have to spend days find out how to  
do something that takes 20 seconds once you know how. Same old same old.



--

Bill Cheeseman
b...@cheeseman.name

___

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

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

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

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


Re: Core Animation + Garbage Collection

2009-08-23 Thread Rob Keniger


On 24/08/2009, at 6:24 AM, Kyle Sluder wrote:


Have you enabled wants layer for the view?


And if you have, have you made sure to provide a custom layer  
*before* calling -setWantsLayer:? The default AppKit provided layer  
is Not Yours to touch.



Why's that? It seems to work fine in all my testing.

--
Rob Keniger



___

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

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

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

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


Sound files needed

2009-08-23 Thread DKJ
I just need one more thing to finish my application: five .aiff sound  
files. Each of them needs to have three properties:


(1) Be one second in duration.
(2) Play a 3-pulse Morse code sequence (DAH-dit-DAH etc.).

And here's the tricky bit:

(3) Play at a frequency of 19,000 Hertz.

I've managed to create files with properties (1) and (2), but I'm  
stuck at (3).


I've downloaded the Audacity application, but the best I can get from  
it seems to be 12,000 Hertz. Other programmes I've tried (demo  
versions mostly) won't let me set an absolute frequency.


Any suggestions?

dkj

P.S. Yes, I know most people won't be able to hear a sound at a  
frequency of 19KHz; but that's a feature, not a bug!

___

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

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

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

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


[OT] Re: Sound files needed

2009-08-23 Thread I. Savant

On Aug 23, 2009, at 7:53 PM, DKJ wrote:

I've downloaded the Audacity application, but the best I can get  
from it seems to be 12,000 Hertz. Other programmes I've tried (demo  
versions mostly) won't let me set an absolute frequency.



  Your question has nothing at all to do with Cocoa development. This  
is the cocoa-dev list, not the how-do-I-use-any-software-at-all-as- 
long-as-I'm-using-it-to-create-my-application list. To find the  
latter, I suggest Google.


--
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 arch...@mail-archive.com


Confusion about custom UITableViewCell

2009-08-23 Thread Chris Idou
I'm trying to make a custom UITableViewCell, but the way I'm doing it, all the 
drawing of the table seems to be screwed up. The view seems to be working in 
some sense, because I can see the data, but only one row at the bottom can be 
seen and things are generally screwed up when scrolling. This is what I'm doing:

1) Create new Navigation based app.
2) Add a Table View Cell to the RootViewController.xib
3) Edit the TableViewCell in IB, add some Labels onto it.
4) Connect TableViewCell and Labels to outlets in RootViewController.h
5) modify tableView:cellForRowAtIndexPath: so that it sets data in the UILabels 
and returns the TableViewCell from the Nib outlet.

Is there some reason this shouldn't work?


  
__
Find local businesses and services in your area with Yahoo!7 Local.
Get started: http://local.yahoo.com.au
___

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

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

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

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


Re: Syntax Coloring?

2009-08-23 Thread BareFeet

Hi Keita,


Hello, I'm writing a code editor and so far, i've been using Flex for
regex-matching the whole document every time the text is changed and
coloring appropriately...


How are you doing this? How did you incorporate Flex or regex-matching?

I approached it using regex to parse the quoted and commented strings  
into single objects, then parse using regex for the language, then  
reinsert the quoted and commented strings. But this was using perl and  
scripting, whereas I now need to port to Cocoa.


I managed to get regex working in Cocoa using RegexKiteLite, but now  
need to move across the rest of my method.


I got this idea from some CocoaBuilders or CocoaDev forum/mailing  
list awhile ago


Do you have a link to the article?

but it's terribly inefficient and slow, especially with large  
documents.


I would hope that there's come Cocoa class for parsing source text  
into tokens etc, but don't know of anything.


Tom

___

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

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

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

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


Re: Core Animation + Garbage Collection

2009-08-23 Thread Kyle Sluder

On Aug 23, 2009, at 4:34 PM, Rob Keniger r...@menumachine.com wrote:


Why's that? It seems to work fine in all my testing.


There are cases where it breaks.

Providing your own layer is the defining difference between a layer- 
backed and a layer-hosting view. AppKit makes certain assumptions  
about the underlying layer in a layer-backed view.


You want a layer-hosting view, play by the rules. It's just one line  
of code.


--Kyle Sluder



___

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

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

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

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


Re: Bindings Reverting Properties

2009-08-23 Thread Dave Keck
For the archives...

The cleanest way I've found to get around my problem is best illustrated
with some example code:

=

- (void)setHappy: (BOOL)newHappy
{
   BOOL oldHappy = happy;

   happy = newHappy;

   if (![self save])
   {   // Do the revert now
   happy = oldHappy;

   // Update the UI later
   [self performSelector: @selector(updateUI)
  withObject: nil
  afterDelay: 0.0];
   }
}

- (void)updateUI
{
   [self willChangeValueForKey: @happy];
   [self didChangeValueForKey: @happy];
}

=

In the above example, I do the actual revert in the current iteration of the
run loop, and save the updating of the UI for the next iteration. I also
thought about scheduling the entire revert task for the next iteration, but
found this wasn't as good an option. The reason it's not as good is because
before the revert happens, the preferences will temporarily reflect a state
that hasn't (and won't) be saved to disk. So if someone asks for the value
of happy during the _current_ iteration of the run loop, it will erroneously
return the temporary value before the revert happens. Therefore, it's a
better idea to simply do the revert now, and update the UI later.

Perhaps someone, somewhere will find that information useful.
___

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

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

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

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


Re: Core Animation + Garbage Collection

2009-08-23 Thread Evan M

Kevin,

Yes, wantsLayer is enabled.

--
Evan


On Aug 23, 2009, at 4:00 PM, Kevin Cathey wrote:


Have you enabled wants layer for the view?

Kevin

--
Kevin Cathey


On 22 Aug 2009, at 22:21, Evan M wrote:

So, it isn't Garbage Collection + Core Animation that is breaking  
the transition, I just refactored my entire project to remove GC  
support (big pain) and the animation hasn't changed at all.


Now I'm looking at my custom NSView that is being animated and I'm  
wondering now if that is the problem.


Is there anything special I need to do in a custom NSView to enable  
Core Animation support?


--
Evan


On Aug 19, 2009, at 3:30 PM, Bill Bumgarner wrote:


On Aug 19, 2009, at 10:54 AM, Evan Moseman wrote:

I've been trying to get a fairly simple and well documented  
transition: CIPageCurlTransition to work in my app, but the  
results are awful.  Non filter transitions like kCATransitionFade  
work fine, but when I try to use a CAFilter for the transition  
the best I get is dome chopped up image with the wrong geometry  
and it just looks completely broken.  I've  been trying to figure  
out what the cause is, and the only real difference between my  
app and a few example applications, as far as this code is  
concerned, is that mine has garbage collection enabled, not  
required though.  I ran into this post with a quick google search:

http://blog.fadingred.com/post/80877304/core-animation-and-garbage-collection
Further searches in the Core Animation documentation haven't yet  
revealed a known incompatibility between Core Animation libraries  
and Garbage Collection.

Am I missing something obvious or documented?


It should work.   File a bug via http://bugreport.apple.com and  
send me the bug # directly.


thanks,
b.bum



___

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

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

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

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




___

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

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

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

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


Re: Core Animation + Garbage Collection

2009-08-23 Thread Evan M

Kyle,

I don't have a custom layer, I'm animating the transition between two  
NSViews.


--
Evan

On Aug 23, 2009, at 4:24 PM, Kyle Sluder wrote:


On Aug 23, 2009, at 1:00 PM, Kevin Cathey cat...@apple.com wrote:


Have you enabled wants layer for the view?


And if you have, have you made sure to provide a custom layer  
*before* calling -setWantsLayer:? The default AppKit provided layer  
is Not Yours to touch.


--Kyle Sluder




___

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

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

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

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


I am not sure which message I have to trust?

2009-08-23 Thread Agha Khan

Hi:
When I am using emulator there is no leak, but when I run on device,  
it looks like there is a leak. I am unable to figure out why it so   
nor I was able to find the source.


Thanks in advance.

Agha
___

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

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

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

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


readInBackgroundAndNotify not working?

2009-08-23 Thread PCWiz

Hi,

I'm using this code to get a notification when a file has been updated:

- (void)startReading
{
	NSString *logPath = [NSHomeDirectory()  
stringByAppendingPathComponent:@Library/Logs/MyTestApp.log];

NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:logPath];
	NSNotificationCenter *notificationCenter = [NSNotificationCenter  
defaultCenter];

[notificationCenter addObserver:self

 selector:@selector(getData:)
  
   name:@NSFileHandleReadCompletionNotification

   object:fh];
[fh readInBackgroundAndNotify];
}

- (void) getData: (NSNotification *)aNotification
{
NSLog(@hai);
}

I know for sure that the file is being updated (MyTestApp.log),  
however the selector method (getData:) is never being called. Is there  
something I'm doing wrong?


Thanks
___

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

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

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

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


Re: readInBackgroundAndNotify not working?

2009-08-23 Thread Kyle Sluder

On Aug 23, 2009, at 7:42 PM, PCWiz pcwiz.supp...@gmail.com wrote:

  name:@NSFileHandleReadCompletionNotification


NSFileHandleReadCompletionNotification is the name of a constant, not  
necessarily its value.


In general, there are very few cases where notification names,  
dictionary keys, and other known constants don't have symbolic names.  
In that case the documentation will list them in @ form; otherwise  
the names listed are the actual const variables themselves.


No idea if this is your issue. Often the constant values are the same  
as their names, and code like that which you've posted just seems to  
work fine.


--Kyle Sluder
___

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

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

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

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


Re: readInBackgroundAndNotify not working?

2009-08-23 Thread Kyle Sluder

On Aug 23, 2009, at 7:42 PM, PCWiz pcwiz.supp...@gmail.com wrote:

   NSString *logPath = [NSHomeDirectory()  
stringByAppendingPathComponent:@Library/Logs/MyTestApp.log];


Also don't do this. Use NSSearchPathForDirectoriesInDomains.  
Hardcoding paths is bad form.


--Kyle Sluder
___

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

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

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

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


Re: DOMNode problems getting info out...

2009-08-23 Thread jon
ok,  this seems mighty round about,   but this works   let me know  
if you think there is a simpler way...  i found atleast two sets of  
documentation on this from developer/Apple on DomNodes or  
DOMObjects  neither had the same info... but combining the two,  i  
think i figured it out...



DOMDocument *myDOMDocument = [[myWebView mainFrame] DOMDocument];
DOMNodeList *allParas = [myDOMDocument getElementsByTagName:@p];

DOMNode *node = [allParas item:0];

DOMNodeList *nodeList = [node childNodes];


DOMHTMLLinkElement* link = (DOMHTMLLinkElement*)[nodeList  
item:1];


NSString* href = [link href];

NSString *top = [node textContent];


now href conatins a string with the link in it,  and top contains the  
rest of the text within the paragraph...

this is the paragraph example again:

p Aug 19 - a href=http://whatever/sys/1331140637.html;Two 1GB  
Apple matched pair RAM from a MacBook - $30 -/afont size=-1  
(Louisville )/font/p


Jon.





On Aug 23, 2009, at 8:06 AM, jon wrote:

I have found that there is extremely limited documentation dealing  
with DOMNodeLists and DOMNode...


for instance i found by pure accident  that textContent works on a  
node,  and found no documentation on it...  and lots references to  
getAttribute or getElementID  but can not get them to work...


so here is what i'm trying to do with code and maybe someone has  
figured this out...


thanks in advance..

here is some data in some HTML that I would like to parse,   i've  
found how to get the text out,   but i can't get this URL out


p Aug 19 - a href=http://whatever/sys/1331140637.html;Two 1GB  
Apple matched pair RAM from a MacBook - $30 -/afont size=-1  
(Louisville )/font/p



here is the code i'm using to parse it   most of it works,   
including the textContent,   last two lines don't work...trying to  
get this http://whatever/sys/1331140637.html;  into a NSString, or  
NSURL is failing me...



DOMDocument *myDOMDocument = [[myWebView mainFrame] DOMDocument];
DOMNodeList *allParas = [myDOMDocument getElementsByTagName:@p];

DOMNode *node = [allParas item:0];

NSString *top = [node textContent];


	NSString *top2 = [node getAttribute:@href]; // this is way  
off, just trying to find methods,  but i expected getAttribute to  
atleast be acknowledged as a method
	NSString *top4 = [node getElementById:@href];   // this is way  
off,  but i expected getElementById to atleast be acknowledged as a  
method



any help would be great...
thanks,
Jon.


___

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

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

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

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


Drawing over a transparent background

2009-08-23 Thread Ron Fleckner

Hi,

I asked about this on quartz-dev but go no reply after a few days so  
I'm asking here.


My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of the  
original drawing in the subview.  I don't want that ghost image!


The app is a resizeable analog clock.  (Yes, I'm a dilettante  
recreational coder.)


I've tried various -display methods, but none of them, so far, have  
fixed the problem.  So -setNeedsDisplay:, -setNeedsDisplayInRect:, - 
displayRect, -displayRectIgnoringOpacity and others don't affect the  
ghosting problem.


Here's an image of what I'm seeing:

http://members.ozemail.com.au/~ronfleckner/DrawingWithTransProb.png

If the background is a solid colour, the drawing looks fine.  It only  
appears when the background has opacity  1.0  The opacity and colours  
of the window are set in the interface by the user.


Thanks for any help

Ron

___

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

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

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

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


Using Core Data NSManagedObject subclasses outside of a managed object context

2009-08-23 Thread Dieterich Lawson
Hey all,

I have objects that I use with core data that were automatically generated
for me by xcode and represent entities in my data store. They all subclass
NSManagedObject, and do not have instance variables, but instead use the
@dynamic setting for their properties, pretty standard. My understanding is
that this allows the NSManagedObject superclass to generate the
getters/setters at runtime and store data in it's own, more efficient, Core
Data friendly way.

What this means for me, however, is that I can't just call [[Entity alloc]
init] and then get/set Entity's properties, because it won't properly
initialize unless it is given a managed object context. I need to be able to
use my objects in places that they won't be persisted, as just transient
objects, but this prevents that. The only way I know to initialize them is
by calling [NSEntityDescription insertNewObjectForEntityForName:name
inManagedObjectContext:managedObjectContext] . But, when creating objects
this way, they will be persisted on the next save call.

Does anyone know of a way to modify the objects so that I can use them
wherever I want without having to insert them into a managed object context?
I've read different places that you shouldn't do what I'm trying to do, but
if Core Data doesn't allow you to use its objects without persisting them,
then that would be a major shortcoming for me. Are there architectural
changes I can make that would overcome this?
Just so you know, I'm making a feed reader that has the option to save
selected stories from the feed for later, offline, browsing. I want to be
able to download the feed XML and create 'story' objects from that without
having to persist every story I fetch.
___

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

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

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

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


Simple array controller master-detail binding problem

2009-08-23 Thread Leon Starr

Well, simple for you guys I hope!

I apologize in advance for this monstrosity of a question, but I've  
had a tough time narrowing this thing down so I'm laying out all the  
details to keep the thread short in hopes that someone will spot an  
obvious mistake right away.  Any help greatly appreciated!


I've been trying to build a simplified implementation of the  
combatants example in the Cocoa Bindings Programming Topics doc to  
prove that I really understand Array Controllers and Binding.   
Apparently, I do not!


My goal is to get two array controllers (master/detail) working  
together in a simple non-doc cocoa app.
How hard could that be?  Versions I am working with  [10.5.8 / Xcode  
3.1.3]


I have the master ac bound to its model class (Combatant) creating and  
deleting entries no problem.  All the trouble started when I created  
the detail ac for (Weapon) and tried to bind it to the master ac.  The  
app starts up without any errors or warnings at first.


I create two combatants, Vlad and Atilla in the master table, no  
problem.  Now I cursor up and select Vlad in the first row and BAM  
stack trace.  What!  Unbind the detail ac in the XIB and the master  
table works perfectly adding/deleting/selecting/name changing.  To  
further simplify, I have not yet attached a gui element to the detail  
ac.


I can't make a lot of sense out of the stack trace, but it does end  
with:

0 objc_msgSend
1 objc_getProperty
2 -[Combatant weapons]
3 -[NSObject(NSKeyValueCoding) valueForKey:]
4- [NSObject(NSKeyValueCoding) valueForKeyPath:]
leading me to wonder if I did something wrong with my accessors.   
Please pardon the newbie confusion!


Data elements and settings for the ac's follow:

Classes:
App Controller
NSMutableArray *combatants
Combatant
NSString *name
NSMutableArray *weapons
Weapon
NSString *name
(code further below if you want to see it all)

Array Controllers:

Master Combatants
Attributes panel
Mode:Class, Class Name: Combatant, Key:name, weapons
Bindings panel
Content Array
		Bind to: App Controller, Controller Key empty, Model Key Path:  
combatants
(and I do have an App Controller object in the MainMenu.xib with the  
AppController name set in the identity panel)


Detail Weapons
Attributes panel
Mode:Class, Class Name: Weapon, Key:name
Bindings Panel
Content Array
		Bind to: Master Combatants, Controller Key: selection, Model Key  
Path: weapons


The intention is to bind a Popup or even just a Table with a name  
column to the Detail Weapons ac once I eliminate the runtime error.


Honestly, I wouldn't be posting all this if I hadn't been banging my  
head against the wall, googling, reading tutorials, trying dozens of  
variations before getting so desperate I actually ask for help!  I'm  
going to feel so stupid when you point out what I did wrong.


- Leon

 THE CODE

// AppController

@interface AppController : NSObject {
NSMutableArray *combatants;
}
@property (readwrite, retain) NSMutableArray *combatants;
@end

@implementation AppController
@synthesize combatants;
- (id)init{
[super init];
combatants = [[NSMutableArray alloc] init];
return self;
}
- (void) dealloc{
[combatants release];
[super dealloc];
}
@end

// Combatant
@interface Combatant : NSObject {
NSString *name;
NSMutableArray *weapons;
}
@property (readwrite, copy) NSString *name;
@property (readwrite, retain) NSMutableArray *weapons;

@end

@implementation Combatant
@synthesize name;
@synthesize weapons;
- (id)init{
[super init];
	weapons = [NSMutableArray arrayWithObjects:@Dagger, @Sword,  
@Pike, nil];

return self;
}
@end

// Weapon
@interface Weapon : NSObject {
NSString *name;
}
@property (readwrite, copy) NSString *name;
@end

@implementation Weapon
@synthesize name;
@end



___

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

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

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

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


Re: readInBackgroundAndNotify not working?

2009-08-23 Thread Adam R. Maxwell


On Aug 23, 2009, at 8:01 PM, Kyle Sluder wrote:


On Aug 23, 2009, at 7:42 PM, PCWiz pcwiz.supp...@gmail.com wrote:

 name:@NSFileHandleReadCompletionNotification


NSFileHandleReadCompletionNotification is the name of a constant,  
not necessarily its value.


Right, and that was my first thought, too!  I've never used  
NSFileHandle for this purpose, either, so wrote a quick test app to  
see what would happen.  It turns out that the value is the same as the  
constant in this case, though, and my code below seems to work if I do


date  /tmp/testfile.txt

in Terminal.

However, if I open the file with vi and edit/save, the notifications  
stop coming in.  My guess is that vi does an atomic write, so watching  
the file descriptor breaks when a new file is written instead of just  
appending to the old one.  I've run into problems like that  
previously, and IIRC you can catch that case with kqueue.  Maybe  
CFFileDescriptor would work also, but I haven't used it yet.  You may  
find that none of the above will work on certain filesystems (e.g.,  
NFS), in which case you probably have to poll the filesystem.



#import Foundation/Foundation.h

@interface Reader : NSObject
@end

@implementation Reader

- (void)dataAvailable:(NSNotification *)aNote
{
NSLog(@%@, aNote);
[[aNote object] readInBackgroundAndNotify];
}

@end

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

system(/usr/bin/touch /tmp/testfile.txt);

Reader *reader = [Reader new];
NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:@/ 
tmp/testfile.txt];
[[NSNotificationCenter defaultCenter] addObserver:reader  
selector:@selector(dataAvailable:)  
name:NSFileHandleReadCompletionNotification object:fh];

[fh readInBackgroundAndNotify];

[[NSRunLoop currentRunLoop] addPort:[NSPort port]  
forMode:NSDefaultRunLoopMode];

[[NSRunLoop currentRunLoop] run];

[pool drain];
return 0;
}

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

DOMNode problems getting info out...

2009-08-23 Thread jon
I have found that there is extremely limited documentation dealing  
with DOMNodeLists and DOMNode...


for instance i found by pure accident  that textContent works on a  
node,  and found no documentation on it...  and lots references to  
getAttribute or getElementID  but can not get them to work...


so here is what i'm trying to do with code and maybe someone has  
figured this out...


thanks in advance..

here is some data in some HTML that I would like to parse,   i've  
found how to get the text out,   but i can't get this URL out


p Aug 19 - a href=http://whatever/sys/1331140637.html;Two 1GB  
Apple matched pair RAM from a MacBook - $30 -/afont size=-1  
(Louisville )/font/p



here is the code i'm using to parse it   most of it works,   
including the textContent,   last two lines don't work...trying to get  
this http://whatever/sys/1331140637.html;  into a NSString, or NSURL  
is failing me...



DOMDocument *myDOMDocument = [[myWebView mainFrame] DOMDocument];
DOMNodeList *allParas = [myDOMDocument getElementsByTagName:@p];

DOMNode *node = [allParas item:0];

NSString *top = [node textContent];


	NSString *top2 = [node getAttribute:@href]; // this is way off,  
just trying to find methods,  but i expected getAttribute to atleast  
be acknowledged as a method
	NSString *top4 = [node getElementById:@href];   // this is way  
off,  but i expected getElementById to atleast be acknowledged as a  
method



any help would be great...
thanks,
Jon.
___

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

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

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

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


Re: Syntax Coloring?

2009-08-23 Thread Rob Keniger

On 24/08/2009, at 10:32 AM, BareFeet wrote:

I approached it using regex to parse the quoted and commented  
strings into single objects, then parse using regex for the  
language, then reinsert the quoted and commented strings. But this  
was using perl and scripting, whereas I now need to port to Cocoa.


I implemented basic syntax coloring for HTML documents without too  
much difficulty. You need to set an object as the delegate of your  
NSTextView's NSTextStorage object.


In this delegate, implement - textStorageDidProcessEditing: which is  
called when the text changes, and do your syntax coloring in that  
method.


I use NSScanner to do the tokenizing.

For large documents you'd probably want to keep track of which parts  
of the text change and only re-color the modified sections.


--
Rob Keniger



___

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

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

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

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


Re: Drawing over a transparent background

2009-08-23 Thread Rob Keniger


On 24/08/2009, at 9:33 AM, Ron Fleckner wrote:

My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of the  
original drawing in the subview.  I don't want that ghost image!



What are you returning for the -isOpaque method of your custom view?  
If your view has any parts that have an alpha less than 1.0 then you  
must return NO from this method.


--
Rob Keniger



___

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

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

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

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


Re: Simple array controller master-detail binding problem

2009-08-23 Thread Quincey Morris

On Aug 23, 2009, at 19:58, Leon Starr wrote:

I can't make a lot of sense out of the stack trace, but it does end  
with:

0 objc_msgSend
1 objc_getProperty
2 -[Combatant weapons]
3 -[NSObject(NSKeyValueCoding) valueForKey:]
4- [NSObject(NSKeyValueCoding) valueForKeyPath:]


You left out the vital piece of information: the error message that  
was logged when this occurred. Look in the debugger console window.  
(However, if this is an exception, sometimes the exception is thrown  
before the error is logged. You may have to continue until the error  
message appears.)


According to your stack trace, something is attempting to retrieve the  
weapons property of a Combatant, which seems perfectly reasonable,  
and all your bindings appear reasonable at first glance. The most  
likely cause of your problem is a memory management error in your code  
-- the Combatant object with name Vlad has likely been over- 
released. Chances are, when you see the error message, it will tell  
you that weapons was sent to an object of the wrong class, and that  
would pretty much confirm it. (That is, the memory that was previously  
a Combatant object has been reused for a different class of object.)



___

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

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

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

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


Re: Using Core Data NSManagedObject subclasses outside of a managed object context

2009-08-23 Thread Jerry Krinock


On 2009 Aug 23, at 17:32, Dieterich Lawson wrote:


Does anyone know of a way to modify the objects so that I can use them
wherever I want without having to insert them into a managed object  
context?


No, you can't to that.  But you're asking the wrong question.  The  
problem is not the managed objects, it's the managed object context  
that you're inserting them into.  What you apparently haven't realized  
yet is that you can create your own managed object contexts.  Typical  
Core Data applications have several of them.  Create a managed object  
context with an in-memory (non-persistent) store, and insert your  
transient objects into it.


All this is explained in the Core Data Programming Guide.

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html





___

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

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

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

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


Re: Drawing over a transparent background

2009-08-23 Thread Kyle Sluder
On Aug 23, 2009, at 4:33 PM, Ron Fleckner ronfleck...@ozemail.com.au  
wrote:


My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of the  
original drawing in the subview.  I don't want that ghost image!


Have you remembered to override -isOpaque to return NO?

--Kyle Sluder
___

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

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

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

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


Re: Using Core Data NSManagedObject subclasses outside of a managed object context

2009-08-23 Thread Quincey Morris

On Aug 23, 2009, at 17:32, Dieterich Lawson wrote:

I have objects that I use with core data that were automatically  
generated
for me by xcode and represent entities in my data store. They all  
subclass
NSManagedObject, and do not have instance variables, but instead use  
the
@dynamic setting for their properties, pretty standard. My  
understanding is

that this allows the NSManagedObject superclass to generate the
getters/setters at runtime and store data in it's own, more  
efficient, Core

Data friendly way.


Actually, although the internally-generated accessors are more  
efficient than the ones you could write, the data is stored in the  
same way.


What this means for me, however, is that I can't just call [[Entity  
alloc]

init] and then get/set Entity's properties, because it won't properly
initialize unless it is given a managed object context. I need to be  
able to
use my objects in places that they won't be persisted, as just  
transient
objects, but this prevents that. The only way I know to initialize  
them is

by calling [NSEntityDescription insertNewObjectForEntityForName:name
inManagedObjectContext:managedObjectContext] . But, when creating  
objects

this way, they will be persisted on the next save call.


If all such objects are transient (not to be saved), then use a  
transient property.


If only some of the objects are transient, create them in the managed  
context using insertNewObjectForEntityForName:inManagedObjectContext:,  
then immediately delete them. The documentation perhaps doesn't spell  
this out, but the inserting and deleting have reference to the  
persistent store, not the managed object context. That is, deleting  
a managed object doesn't cause the in-memory object to be deallocated,  
it causes it to be removed from the store at the next save. (Or, in  
this case, not ever to be saved.)


Deleted objects survive as long as they are owned by something.  
Since managed object contexts by default do not retain managed objects  
(except inserted or updated ones), that means the deleted objects will  
survive as long as your code maintains ownership (i.e. retains them).



Just so you know, I'm making a feed reader that has the option to save
selected stories from the feed for later, offline, browsing. I want  
to be
able to download the feed XML and create 'story' objects from that  
without

having to persist every story I fetch.


Personally, I'd use a transient property to hold *all* the downloaded  
story objects, plus a non-transient property to hold the ones that  
need to be saved. Obviously you'd need a feed entity (or something  
along that line) for these to be properties of.


HTH


___

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

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

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

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


authorization services

2009-08-23 Thread Rick C.
hello,

what i need for my project is a simple authorization from time to time if for 
example a file is being moved and i don't have access.  i'm just starting to 
learn about authorization services and maybe this is what i need to do although 
it looks a bit complex for my needs.  what i have found in the archives and 
what actually works for me is using NSApplescript with a shell script and 
administrator privileges flag and it prompts for a password when needed.  the 
only issue is it doesn't remember the time stamp and will ask for a password 
multiple times within 5 minutes.  if only i can control that time stamp or if i 
can use NSTask it could work too, but i'm not sure there's a way to get the 
typical authentication window by using NSTask.  i definitely don't need to do 
something like run my project as root or anything like that.  hope this makes 
sense and any pointers are much appreciated.  thank you for your time,

rick


  
___

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

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

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

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