Re: MainMenu.nib won't load

2010-04-11 Thread Ulf Dunkel

Hi Peter.

Thank you for your reply. Is there any logical reason which could 
explain that - even if our code would call NSDocumentController directly 
- this works on every user's Mac but not this single user's one?


We will of course check and track everything. Thank you again for your 
advice.


- - - - -

Am 11.04.2010 06:38, Peter Ammon wrote:

Hi Ulf,

The first instance of NSDocumentController (or a subclass) becomes the shared 
instance.  It sounds like some code is instantiating an instance of 
NSDocumentController before your class, so the shared instance is of the base 
class instead of your subclass.  I don't know what would be causing that, but 
you might look in your code for direct messages to NSDocumentController, 
instead of your subclass.

Good luck tracking it down,
-Peter

On Apr 10, 2010, at 2:43 AM, Ulf Dunkel wrote:


I am kind of stuck with a support question which I cannot explain myself. If 
someone in this list can give me a hint, I would be more than happy. If this 
list is the wrong place to ask for this issue, please excuse (and point me to 
the right place, if possible).

One of our customers cannot use our pure Cocoa app Barcody properly. He 
complains that several menu items cannot be used. (And of course he is the 
first and only one who complains about this.)

Console.app tells us this (on his Mac OS X 10.6.3 machine):

- snip -
4/7/10 8:44:12 AM   Barcody[83923]  Could not connect the action 
showPreferences: to target of class NSDocumentController
4/7/10 8:44:12 AM   Barcody[83923]  Could not connect the action 
showCreditsWindow: to target of class NSDocumentController
4/7/10 8:44:12 AM   Barcody[83923]  Could not connect the action gotoToReg: 
to target of class NSDocumentController
4/7/10 8:44:12 AM   Barcody[83923]  Could not connect the action visitURL: 
to target of class NSDocumentController
4/7/10 8:44:12 AM   Barcody[83923]  Could not connect the action 
stopModalDialog: to target of class NSDocumentController
- snap -

So it looks like the MainMenu.nib won't load properly on his machine. Although 
he is the only one who has this issue, I would be able to understand WHY this 
can happen.

Could we have done something wrong using the MainMenu.nib? Are there any known 
issues with Snowy and NSDocumentController?

If you want to check the Barcody Resources, just grab the multi-lingual app 
from here:

http://www.dsd.net/prod/mac/barcody.php?lan=enpmode=download

(And yes, it happens whatever language and country he sets in his System Prefs.)

Clueless,
Ulf Dunkel

___

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

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

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

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


Re: ObjC question

2010-04-11 Thread Aaron Burghardt

On Apr 10, 2010, at 9:11 PM, Seth Willits wrote:

 On Apr 10, 2010, at 5:11 PM, Tony Romano wrote:
 
 When you create the file system event, you can pass a void * via the 
 structure which is accessible in the event callback.  In this pointer, I 
 want to pass my Volume object so I know which volume the event was for.  I 
 could have easily passed the volume object pointer in when I create the 
 FileSystemEvent object but I always like to stretch my thinking.
 
 
 I'm not sure how this relates to your previous question. I think you may have 
 misspoken/left something out above.
 
 I'm guessing you meant that when you setup the FSEvent callback, you're 
 passing in the FileSystemEvent object instead of the Volume object? In the 
 callback, in order to use the Volume, the FileSystemEvent would need a 
 reference to the Volume. Otherwise you'd need to pass the volume to the 
 callback and get the FileSystemEvent object from the Volume.
 
 Additionally, you could also create a struct which separately contains 
 references to both the FileSystemEvent and the Volume if for some reason you 
 don't have and don't want a reference to the Volume in the FileSystemEvent.
 

Assuming Seth described your intentions correctly and your goal is to 
encapsulate the FSEvent functions within an object, perhaps you want to 
consider a delegate pattern.  

1. Add an property to FileSystemEvent named delegate.

2. When Volume creates a FileSystemEvent, it sets itself as the 
delegate.

3. In the FSEvent callback function, get the delegate from the 
FileSystemEvent and send it the appropriate message(s).

That way, your usage of FSEvent functions is contained within the 
FileSystemEvent class, and you have a design pattern that follows Cocoa 
conventions.  Conceptually, it also illustrates that FileSystemEvent may have 
other uses outside of the Volume class.  This is essentially a rephrasing of 
the initWithContainer: sample code that Kevin suggested.

Aaron

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Static Libary which links against Foundation

2010-04-11 Thread Christian Ziegler
Hi all!

I have written a dynamic library which uses Foundation and defines an public 
interface in C. To test this I added a C-Shell-Tool target which includes the 
public header and uses both C APIs. Everything works fine. Since the future 
user of this library will have to write a wrapper in a different programming 
language, it makes sense to convert this library to a static library. I did 
that and stumbled upon the problem that my test app (C-Shell-Toll) now has to 
link against Foundation. I would like to avoid that since the library should 
encapsulate everything which is Objective-C. Is that even possible?

Regards,
Chris
___

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

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

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

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


Re: QCRenderer.... how do you do that?: solved

2010-04-11 Thread Eric Smith
All,

I had tried to create this attached to an OpenGLContext, but apparently didn't 
do it right.  I found the answer at: http://developer.casgrain.com/?p=4

Problem solved.

Eric

On Apr 10, 2010, at 6:56 PM, Eric Smith wrote:

 I'm trying to use a Quartz Composer filter in a cocoa app.  I've published 
 inputs and outputs: one image input, one image output.  I can successfully 
 set the input image, but when I try to get the output image, I get 0x0 no 
 error messages, just a null pointer.
 
 Here's my code:
 
 QCComposition* myComp = [QCComposition 
 compositionWithFile:@/Users/esmith/Desktop/Simple.qtz];
 QCRenderer* myRenderer = [[QCRenderer alloc] initWithComposition:myComp 
 colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)];
 
 NSBitmapImageRep* theRep = [[[NSBitmapImageRep alloc] 
 initWithCIImage:[ciImageRep CIImage]] autorelease];
   
 BOOL isSet = [myRenderer setValue:theRep forInputKey:@InputImage];
 NSBitmapImageRep* theOutput = [myRenderer valueForOutputKey:@OutputImage 
 ofType:@Image];
 
 Am I missing a step where I tell the renderer to render?  (PS, I've tried 
 renderattime:0, but it doesn't help).
 
 Ideas?
 
 Thanks,
 Eric
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/eric_h_smith%40mac.com
 
 This email sent to eric_h_sm...@mac.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


Cocoa scripting support - background helper app

2010-04-11 Thread jonat...@mugginsoft.com
My Cocoa app consists of GUI component and an agent foundation component in a 
conventional bundle.

The agent can execute without the GUI to provide a network accessible service.

I would like AppleScripts run by the foundation tool to be able to target a 
scriptable helper app.
I would prefer NOT to target my app as this would expose the GUI.

I don't want to load additional AppleScript objects (via AS load script) or 
write a scripting addition.

Thus I need to target another app, let's call it the Helper app.
The Image Events application in /system/library/coreservices comes to mind here.

My questions are:

1. Presumably I have to target a fully fledged application bundle and cannot 
somehow route my AE requests to the foundation tool itself.

2. Can I embed the helper app in the main app bundle and engineer some way for 
AppleScript to be able to target it?
I seem to remember reading something about app bundles enclosed with other apps 
but cannot recall it.
I don't really want to have two external app bundles.

3.When configuring a Cocoa app to behave like Image events.app is it sufficient 
just to declare  LSBackgroundOnly = 1 in the info.plist? 

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com







___

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

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

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

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


Re: Cocoa scripting support - background helper app

2010-04-11 Thread Bill Cheeseman

On Apr 11, 2010, at 10:14 AM, jonat...@mugginsoft.com wrote:

 My questions are:
 
 1. Presumably I have to target a fully fledged application bundle and cannot 
 somehow route my AE requests to the foundation tool itself.
 
 2. Can I embed the helper app in the main app bundle and engineer some way 
 for AppleScript to be able to target it?
 I seem to remember reading something about app bundles enclosed with other 
 apps but cannot recall it.
 I don't really want to have two external app bundles.
 
 3.When configuring a Cocoa app to behave like Image events.app is it 
 sufficient just to declare  LSBackgroundOnly = 1 in the info.plist?


My PreFab UI Actions product consists of a standard application with a 
full-fledged GUI, plus a scriptable faceless background application (FBA). 
The FBA acts somewhat like a traditional scripting addition (OSAX), but it is 
actually a standard Cocoa application package with LSUIElement = 1. Because the 
FBA serves the same overall purpose as a scripting addition, my main 
application installs it in the user or local ScriptingAdditions folder. The 
main application gives the user an option to launch the FBA every time the 
computer starts up, and of course the FBA is automatically launched any time an 
AppleScript 'tell' command is directed to it.

I use LSUIElement = 1 to keep the FBA out of the Dock, etc. I do NOT use 
LSBackgroundOnly = 1, because I want the FBA to be able to present an alert 
from time to time, and when I do that I bring it to the front for easy user 
input.

This is a fairly common pattern.

--

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: Cocoa scripting support - background helper app

2010-04-11 Thread jonat...@mugginsoft.com

On 11 Apr 2010, at 15:52, Bill Cheeseman wrote:

 
 On Apr 11, 2010, at 10:14 AM, jonat...@mugginsoft.com wrote:
 
 My questions are:
 
 1. Presumably I have to target a fully fledged application bundle and cannot 
 somehow route my AE requests to the foundation tool itself.
 
 2. Can I embed the helper app in the main app bundle and engineer some way 
 for AppleScript to be able to target it?
 I seem to remember reading something about app bundles enclosed with other 
 apps but cannot recall it.
 I don't really want to have two external app bundles.
 
 3.When configuring a Cocoa app to behave like Image events.app is it 
 sufficient just to declare  LSBackgroundOnly = 1 in the info.plist?
 
 
 My PreFab UI Actions product consists of a standard application with a 
 full-fledged GUI, plus a scriptable faceless background application (FBA). 
 The FBA acts somewhat like a traditional scripting addition (OSAX), but it is 
 actually a standard Cocoa application package with LSUIElement = 1. Because 
 the FBA serves the same overall purpose as a scripting addition, my main 
 application installs it in the user or local ScriptingAdditions folder. The 
 main application gives the user an option to launch the FBA every time the 
 computer starts up, and of course the FBA is automatically launched any time 
 an AppleScript 'tell' command is directed to it.
 
 I use LSUIElement = 1 to keep the FBA out of the Dock, etc. I do NOT use 
 LSBackgroundOnly = 1, because I want the FBA to be able to present an alert 
 from time to time, and when I do that I bring it to the front for easy user 
 input.
 
 This is a fairly common pattern.
 
Thanks Bill.

This explains the presence of Keychain Scripting.app in 
/system/library/scripting additions.

I presume that your FBA is included in your main app bundle as a resource and 
exported to ~/library/scripting additions as necessary.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com___

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

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

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

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


nstableview in drawer resetting custom cursor

2010-04-11 Thread Nestor Cardozo
I am adding objects to the content array of a NSArrayController by clicking in 
an NSView. When doing this, the mouse cursor is set to a cross-hair cursor.

The contents of the NSArrayController are displayed in a NSTableView in an 
NSDrawer (the columns of the NSTableView are bound to the contents of the 
NSArrayController).

So every time I click, a new row is added to the NSTableView in the NSDrawer.

This works fine. The problem is that when an object is added to the content 
array (a new row is added to the NSTableView), the mouse cursor is reset to the 
default arrow cursor. Even though, the cursor when the mouse is inside the 
NSView is set to a cross-hair cursor. Actually, when moving the mouse outside 
the NSView and back to the NSView the mouse cursor returns to the cross-hair 
cursor, which is how is supposed to be.

So there is something in the NSTableView or in the enveloping NSScrollView that 
is resetting the mouse. I have tried avoiding this behavior by disabling the 
cursor rects (disableCursorRects) before adding the object and enabling them 
(enableCursorRects) afterwards. But that does not work. The closest I got to a 
solution was by invalidating the cursor rectangles in the drawer, something 
like this:

[[theDrawer parentWindow] invalidateCursorRectsForView:[theDrawer contentView]];

But that, gives an erratic behavior. Sometimes the mouse is rest to the custom 
arrow, sometimes is not.

So, how do I stop the AppKit resetting the mouse cursor to the default?

Regards

Nestor Cardozo

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 reading an NSPipe-NSFileHandle to end

2010-04-11 Thread Rasmus Skaarup

Hi,

I'm trying to execute a task in the background and parsing the output from the 
task along the way. However I get the NSTaskDidTerminateNotification before all 
the output from the task has been delivered by 
NSFileHandleReadCompletionNotification - and I am not able to squeeze much more 
(but in some cases a little, but never all the way to the end) out of the 
filehandle after the task exits.

Code is what we all want to look at, so here are the interesting bits.

code start
App.h:

NSTask *myTask;
NSFileHandle *myFileHandle;

App.m:

- (id) init {
[super init];

[[NSNotificationCenter defaultCenter] addObserver:self 

selector:@selector(threadPipeReader:) 

name:NSFileHandleReadCompletionNotification 

object:nil]; 

[[NSNotificationCenter defaultCenter] addObserver:self

 selector:@selector(threadTaskStopped:)

 name:NSTaskDidTerminateNotification

 object:nil];

return self;
}

-(void)startMyTask {

NSPipe *pipe = [[NSPipe alloc] init];

myFileHandle = [pipe fileHandleForReading];

[myFileHandle readInBackgroundAndNotify];

myTask = [[NSTask alloc] init];
[myTask setLaunchPath:launchPath];
[myTask setCurrentDirectoryPath:homeDirectory];
[myTask setStandardOutput: pipe];
[myTask setStandardError: pipe];
[myTask setArguments:arguments];

[myTask launch];
}

-(void)threadPipeReader:(NSNotification *)notification {
NSData *data;

data = [[notification userInfo] 
objectForKey:NSFileHandleNotificationDataItem];

[ ... do something with data ... ]

[[notification object] readInBackgroundAndNotify];

}

-(void)threadTaskStopped:(NSNotification *)notification {

NSData *data = [myFileHandle availableData];

while ([data length]  0) {
NSLog(@got some more: %@, [[NSString alloc] 
initWithData:data encoding:NSUTF8StringEncoding]);
NSLog(@output size: %d, [data length]);   
data = [myFileHandle availableData];
}

}
code end

I never got the full output in threadPipeReader, but then I tried to fetch the 
data in threadTaskStopped - but that only gives some output. Not all the way to 
the end either.

I then tried to specify how much data I wanted from myFileHandle in 
threadTaskStopped, by doing:

NSData *data = [myFilehandle readDataOfLength:262144];

And then got the output:

got some more: about 262144 characters of data
output size: 262144

But then the while-loop exited because myFileHandle was zero length the next 
time it got polled. When I don't specify a size, but just asks for 
availableData, I get sizes of exactly 16K (16384) multiple times. But never an 
odd size - and I can definetely see that the output gets chopped off (sometimes 
mid-line) - so I am never able to get the last output from the task.

Can someone help me with this?


Best regards
Rasmus Skaarup


___

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

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

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

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


Table with cells as dragging destination?

2010-04-11 Thread Izak van Langevelde
What I need is a table where some columns show images as data.
It should be possible to drag images and image files onto these cells.

I implemented the table as an NSTableView with NSImageCells, I know about the 
standard drag and drop for table rows.
However, I am clueless about how to use cells as dragging destination.
Am I supposed to subclass NSTableView, and implement drag and drop, including 
all gory details? Are there any examples available?
Is there another view more suitable for what I'm trying to achieve?

Thanks,
Izak
---
Grinnikend door het leven...

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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:Changing the drag image on the fly

2010-04-11 Thread Iain Delaney
If I understand your requirements correctly, this blog posting should be of 
help: http://joshua.nozzi.name/2009/10/jlndrageffectmanager/
It discusses changing the drag image based on the underlying view, and provides 
sample code for the effect.

Iain Delaney
iain.dela...@gmail.com
www.lucernesys.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: Using a SOAP Web Service from iPhone

2010-04-11 Thread Jens Alfke

On Apr 9, 2010, at 8:52 AM, Dru Satori wrote:

 [soapRequestXml appendFormat:@\t\t\t%@%@/%@\n, paramName, paramValue, 
 paramName];

Minor note: I hope none of your parameter values contain any XML metacharacters 
like quotes or angle-brackets, or you’re going to at minimum generate invalid 
XML, and at worst (if the values might come from an untrusted source) open 
yourself up to XML injection attacks.

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


Drag and drop (NSCollectionView)?

2010-04-11 Thread Alex Fererro
Hi Experts,
Am trying to implement drag and drop for a NSCollectionView (similar to
icon view in Finder), although on starting the drag I get following
callbacks:

– collectionView:writeItemsAtIndexes:toPasteboard:
and
– collectionView:draggingImageForItemsAtIndexes:withEvent:offset:

*but none of the following callbacks on dropping:*
– collectionView:validateDrop:proposedIndex:dropOperation:
and
– collectionView:acceptDrop:index:dropOperation:

Any idea on what am missing here?

TIA,
Alex
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Cant read second table from same sqlite database iphone

2010-04-11 Thread Jens Alfke

On Apr 10, 2010, at 6:02 PM, charisse napeÿf1as wrote:

 I get nothing

You get result codes from each sqlite API call at least. What are they? 
What happens if you run the second piece of code without having run the first 
one? Experiment.

At a higher level, consider using an existing, already-working Cocoa SQLite 
wrapper (FMDB, QuickLite) instead of building your own.

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


Re: Static Libary which links against Foundation

2010-04-11 Thread Jens Alfke

On Apr 11, 2010, at 5:07 AM, Christian Ziegler wrote:

  it makes sense to convert this library to a static library. I did that and 
 stumbled upon the problem that my test app (C-Shell-Toll) now has to link 
 against Foundation. I would like to avoid that since the library should 
 encapsulate everything which is Objective-C. Is that even possible?

Not really. Any binary that contains calls into a framework has to link against 
that framework. If you include a static library in your app, it becomes part of 
the app binary, by definition.

There shouldn’t be any problem with having the app link against Foundation.

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


Re: Cocoa scripting support - background helper app

2010-04-11 Thread Bill Cheeseman

On Apr 11, 2010, at 11:20 AM, jonat...@mugginsoft.com wrote:

 This explains the presence of Keychain Scripting.app in 
 /system/library/scripting additions.

Correct. Faceless Background Applications (FBAs) are often preferred over 
scripting additions (OSAXen) for a number of reasons, including avoiding 
polluting the AppleScript namespace.

 I presume that your FBA is included in your main app bundle as a resource and 
 exported to ~/library/scripting additions as necessary

Right again. It is zipped in the main app bundle and expanded using the ditto 
tool during installation.

--

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: Cant read second table from same sqlite database iphone

2010-04-11 Thread Ben Trumbull
I'm afraid I can't be much more help if you don't have the return codes from 
each of the SQLite statements.  I do note in the second method, you're asking 
for column values out of order, which is pretty unusual.

- Ben

On Apr 10, 2010, at 6:42 PM, charisse napeÿf1as wrote:

 I was able to successfully retrieve data on the first table. But I can't seem 
 to retrieve from the second table. I know it has data inside it because I 
 used an SQLite Browser to view the data. I also tried performing queries 
 there and it worked fine. Only when I used the queries in the code that it 
 doesn't work. 
 
 Below is the code writing the database in the Users/Documents folder for 
 Iphone
 
 - (void) createDatabaseIfNeeded
 {
 NSError * error;
 
 //gets access to the file system
 NSFileManager * fileManager = [NSFileManager defaultManager];
 
 // gets the complete users document directory path
 NSArray * paths = 
 NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, 
 YES);
 
 // gets the first path in the array
 NSString * documentsDirectory = [paths objectAtIndex:0];
 
 // create the complete path for the database file
 NSString * databasePath = [documentsDirectory 
 stringByAppendingString:@/Database.sql];
 
 DebugLog(databasePath = %s\n,[databasePath UTF8String]);
 
 // check if file exists or not
 BOOL success = [fileManager fileExistsAtPath:databasePath];
 
 if (success) return;
 
 // the database does not exist so copy it in the users documents directory
 NSString * dbPath = [[[NSBundle mainBundle] resourcePath] 
 stringByAppendingPathComponent:@/Database.sql];
 
 DebugLog(dbpath is %s\n,[dbPath UTF8String]);
 
 //copy the database file to ther users docuement directory
 
 success = [fileManager copyItemAtPath:dbPath toPath:databasePath 
 error:error];
 
 if (!success)
 NSAssert(0,@Failed to copy Database!\n);
 }
 
 
 From: Ben Trumbull trumb...@apple.com
 To: cnape...@yahoo.com
 Cc: Cocoa dev cocoa-dev@lists.apple.com
 Sent: Sunday, April 11, 2010 9:27:46
 Subject: re: Cant read second table from same sqlite database iphone
 
  Hello All,
  
  I am having trouble reading the second table from my database because it 
  returns nothing even if there is data inside it.
 
 How do you know it has data inside it ?  A common mistake is to try to write 
 to databases in the read only part of an application's sandbox on the iphone. 
  Where in the sandbox is the database ?
 
  - (NSMutableArray*) getProvinces
  {
 NSMutableArray * data = [[NSMutableArray alloc] init];
 const char * sql = SELECT * FROM Provinces;
 sqlite3_stmt * statement;
  
 //prepare the select statement
 int returnValue = sqlite3_prepare_v2(mDatabase, sql, -1, statement, 
  NULL);
  
 DebugLog(return value = %d\n,returnValue);
  
 if (returnValue == SQLITE_OK)
 {
 //sqlite3_bind_int(statement, 1, regionID);
 //loop all the rows returned by the query
 while (sqlite3_step(statement) == SQLITE_ROW)
 {
 
 
 You don't check the return codes here properly.  sqlite3_prepare_v2() can 
 return SQLITE_BUSY, or SQLITE_SCHEMA, or SQLITE_MISUSE.  More importantly, 
 you don't check if sqlite3_step() returns SQLITE_DONE which would indicate 
 that you have 0 rows in this table.
 
 - Ben
 
 
 
 
 New Email names for you! 
 Get the Email name you've always wanted on the new @ymail and @rocketmail.
 Hurry before someone else does!


- Ben



___

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

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

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

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


Re: nstableview in drawer resetting custom cursor

2010-04-11 Thread Quincey Morris
On Apr 8, 2010, at 00:27, Nestor Cardozo wrote:

 This works fine. The problem is that when an object is added to the content 
 array (a new row is added to the NSTableView), the mouse cursor is reset to 
 the default arrow cursor. Even though, the cursor when the mouse is inside 
 the NSView is set to a cross-hair cursor. Actually, when moving the mouse 
 outside the NSView and back to the NSView the mouse cursor returns to the 
 cross-hair cursor, which is how is supposed to be.
 
 So there is something in the NSTableView or in the enveloping NSScrollView 
 that is resetting the mouse.

Take a look at -[NSScrollView setDocumentCursor:]. The scroll view has a nasty 
habit of resetting the cursor to this one when the relationship between the 
clip view and the content changes (as when you add rows).


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Changing the drag image on the fly

2010-04-11 Thread Seth Willits
On Apr 8, 2010, at 8:14 PM, Iain Delaney wrote:

 If I understand your requirements correctly, this blog posting should be of 
 help: http://joshua.nozzi.name/2009/10/jlndrageffectmanager/
 It discusses changing the drag image based on the underlying view, and 
 provides sample code for the effect.


Awesome link. Thanks!



--
Seth Willits



___

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

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

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

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


Re: Problem with reading an NSPipe-NSFileHandle to end

2010-04-11 Thread Ken Thomases
On Apr 8, 2010, at 9:57 AM, Rasmus Skaarup wrote:

 I'm trying to execute a task in the background and parsing the output from 
 the task along the way. However I get the NSTaskDidTerminateNotification 
 before all the output from the task has been delivered by 
 NSFileHandleReadCompletionNotification

This is completely ordinary.  There are two independent inter-process 
communication mechanisms at work, and there's no guarantee that all of the 
output data will arrive at your process and be delivered in a notification 
before the task termination notification is delivered.

 - and I am not able to squeeze much more (but in some cases a little, but 
 never all the way to the end) out of the filehandle after the task exits.

From what you say below, I'm not sure that's accurate.

 - (id) init {
   [super init];

You should be assigning the result from [super init] to self.  You should also 
be checking if it's nil.

   [[NSNotificationCenter defaultCenter] addObserver:self 
   
 selector:@selector(threadPipeReader:) 
   
 name:NSFileHandleReadCompletionNotification 
   
 object:nil]; 
 
   [[NSNotificationCenter defaultCenter] addObserver:self
   
  selector:@selector(threadTaskStopped:)
   
  name:NSTaskDidTerminateNotification
   
  object:nil];

The above lines register to for those notifications on _all_ tasks and file 
handles in the whole process.  This is probably not what you want.  You should 
register for those notifications after you've created the pipe (and its file 
handle) and the task, and you should register on those objects specifically.

   return self;
 }
 
 -(void)startMyTask {
 
   NSPipe *pipe = [[NSPipe alloc] init];
 
   myFileHandle = [pipe fileHandleForReading];
 
   [myFileHandle readInBackgroundAndNotify];
 
   myTask = [[NSTask alloc] init];
   [myTask setLaunchPath:launchPath];
   [myTask setCurrentDirectoryPath:homeDirectory];
   [myTask setStandardOutput: pipe];
   [myTask setStandardError: pipe];
   [myTask setArguments:arguments];
   
   [myTask launch];

Are you using garbage collection?  If not, then the above code leaks the pipe.

 }
 
 -(void)threadPipeReader:(NSNotification *)notification {
   [... snipped ...]
 }

That looks reasonable, to the extent that you showed.

 -(void)threadTaskStopped:(NSNotification *)notification {
 
   NSData *data = [myFileHandle availableData];
   
   while ([data length]  0) {
   NSLog(@got some more: %@, [[NSString alloc] 
 initWithData:data encoding:NSUTF8StringEncoding]);
   NSLog(@output size: %d, [data length]);   
   data = [myFileHandle availableData];
   }
 
 }
 code end
 
 I never got the full output in threadPipeReader, but then I tried to fetch 
 the data in threadTaskStopped - but that only gives some output. Not all the 
 way to the end either.

What you need to do is just mark some internal state so you know the task has 
exited in threadTaskStopped:.  Then, return to the run loop so that you can 
continue to receive the notifications from the background reads.  Eventually, 
you'll receive the end-of-file marker (a zero-length data).  After you've 
received both the end-of-file and the task termination notification, then you 
can proceed to make final use of the data and clean up the task (and your 
registrations with the notification center).

The issue you're encountering is probably because there's both a background 
read in progress and your attempt to synchronously read in the foreground.  The 
background read has probably obtained the missing data that you're never 
seeing from the foreground read.  You will never see it if you don't allow the 
run loop to fire -- for example, if you terminate the thread after getting the 
task termination notification.  Even if you did see it, you'd get it out of 
order with respect to the synchronous foreground read you're doing.  There's no 
telling which read operation would get any particular chunk of data.

Abandon the foreground reading and the assumption that all data will have 
arrived by the time you get the task termination notification.  Use only 
background reading and keep running the run loop until you get both end-of-file 
and task-terminated indicators.

If you still aren't getting all of the output you expect, then your task is 
probably exiting early, perhaps crashing.

Regards,
Ken


Re: Automator Actions and CFBundleExecutable key

2010-04-11 Thread Scott Ribe
 There are no other warnings tossed out during either compilation
 Any thoughts?

Compare the build transcripts for debug vs release for clues as to why debug
is not producing an executable.

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


___

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

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

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

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


Re: Drag and drop (NSCollectionView)?

2010-04-11 Thread Nick Zitzmann

On Apr 9, 2010, at 2:06 PM, Alex Fererro wrote:

 *but none of the following callbacks on dropping:*
 – collectionView:validateDrop:proposedIndex:dropOperation:
 and
 – collectionView:acceptDrop:index:dropOperation:
 
 Any idea on what am missing here?

Did you remember to register the view's drag types?

Nick Zitzmann
http://www.chronosnet.com/



___

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

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

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

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


Re: Cant read second table from same sqlite database iphone

2010-04-11 Thread Andrew Farmer
On 10 Apr 2010, at 18:02, charisse napeÿf1as wrote:
//get the name and the score
int  iDen = sqlite3_column_int(statement, 0);
NSString* name = [NSString stringWithUTF8String:(char 
 *)sqlite3_column_text(statement, 0)];

Surely column 0 cannot be both an integer and text. Which one is 
it?___

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

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

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

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


Re: Problem with reading an NSPipe-NSFileHandle to end

2010-04-11 Thread Rasmus Skaarup

On 11/04/2010, at 21.17, Ken Thomases wrote:

 On Apr 8, 2010, at 9:57 AM, Rasmus Skaarup wrote:

  [[NSNotificationCenter defaultCenter] addObserver:self 
  
 selector:@selector(threadPipeReader:) 
  
 name:NSFileHandleReadCompletionNotification 
  
 object:nil]; 
 
  [[NSNotificationCenter defaultCenter] addObserver:self
  
  selector:@selector(threadTaskStopped:)
  
  name:NSTaskDidTerminateNotification
  
  object:nil];
 
 The above lines register to for those notifications on _all_ tasks and file 
 handles in the whole process.  This is probably not what you want.  You 
 should register for those notifications after you've created the pipe (and 
 its file handle) and the task, and you should register on those objects 
 specifically.

I launch multiple processes, and I do a check to see which one is the one I'm 
getting notified for by doing this in threadPipeReader:

if ( [notification object] == myFileHandle ) 

(and of course I have more NSTasks and NSFileHandles than myTask and 
myFileHandle than my example shows).

So unless you strongly discourage this method, it works out pretty well and I 
am able to distinguish which process is notifying me. The method you suggests 
forces me to create seperate sub-routines for each invokation.

My programs sole purpose is to launch processes and look at their output.

 -(void)startMyTask {
 
  NSPipe *pipe = [[NSPipe alloc] init];
 
  myFileHandle = [pipe fileHandleForReading];
 
  [myFileHandle readInBackgroundAndNotify];
 
  myTask = [[NSTask alloc] init];
  [myTask setLaunchPath:launchPath];
  [myTask setCurrentDirectoryPath:homeDirectory];
  [myTask setStandardOutput: pipe];
  [myTask setStandardError: pipe];
  [myTask setArguments:arguments];
  
  [myTask launch];
 
 Are you using garbage collection?  If not, then the above code leaks the pipe.

I'm doing garbage collection.

 -(void)threadPipeReader:(NSNotification *)notification {
  [... snipped ...]
 }
 
 That looks reasonable, to the extent that you showed.

Only issue here is that threadPipeReader: does not get called after 
threadTaskStopped: has been called. Even though output is clearly missing.

 -(void)threadTaskStopped:(NSNotification *)notification {
 
  NSData *data = [myFileHandle availableData];
  
  while ([data length]  0) {
  NSLog(@got some more: %@, [[NSString alloc] 
 initWithData:data encoding:NSUTF8StringEncoding]);
  NSLog(@output size: %d, [data length]);   
  data = [myFileHandle availableData];
  }
 
 }
 code end
 
 I never got the full output in threadPipeReader, but then I tried to fetch 
 the data in threadTaskStopped - but that only gives some output. Not all the 
 way to the end either.
 
 What you need to do is just mark some internal state so you know the task has 
 exited in threadTaskStopped:.  Then, return to the run loop so that you can 
 continue to receive the notifications from the background reads.  Eventually, 
 you'll receive the end-of-file marker (a zero-length data).  After you've 
 received both the end-of-file and the task termination notification, then you 
 can proceed to make final use of the data and clean up the task (and your 
 registrations with the notification center).

This sounds like the thing I need - however I need a more detailed explanation. 
I don't know what return to the run loop means. Can you give a code example?

But threadTaskStopped: does not need to examine data for the process that 
exited. In fact I will prefer to have threadPipeReader: continue to get the 
data fed, even though the process exited. It's not important that the process 
exited.

 The issue you're encountering is probably because there's both a background 
 read in progress and your attempt to synchronously read in the foreground.  

If you think of the availableData calls from threadTaskStopped:, I only put 
them there because threadPipeReader: didn't get called after threadTaskStopped: 
did.

 The background read has probably obtained the missing data that you're 
 never seeing from the foreground read.  

Hmmm, I suspect some more code is needed. The part of the program that executes 
these NSTasks is a seperate thread:

App.h: 

-(id) init {

  self = [super init];
// now assigning super init result to self :-)

  if (self) {

[[NSNotificationCenter defaultCenter] addObserver:self
 

Re: NSInvocation error when closing a dirty document

2010-04-11 Thread Brad Stone
For future reference, I needed to end editing in the textView or the combo 
boxes to prevent the NSInvocation error.  I did this by making the window the 
firstResponder in my NSDocument class with the saveDocumentWithDelegate method 
only when the window is being closed.  This is not necessary when the document 
is just being saved.

Here's the code

- (void)saveDocumentWithDelegate:(id)delegate 
didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo {

// Try to end editing

if (didSaveSelector == @selector(_document:shouldClose:contextInfo:)) { 
NSWindow *w = [headerBox window];   
BOOL ended = [w makeFirstResponder:w];
if (!ended) {
NSLog(@Could not end editing in 
MyDocument:saveDocumentWithDelegate:);
return;
}
} 



[super saveDocumentWithDelegate:(id)delegate 
didSaveSelector:didSaveSelector
contextInfo:(void 
*)contextInfo];


}  

On Apr 10, 2010, at 9:12 PM, Jerry Krinock wrote:

 
 On 2010 Apr 10, at 12:43, Brad Stone wrote:
 
 I have a strange bug that I've been tracking for a while and I'd like the 
 benefit of your experience.  It happens with I close a window that needs to 
 be saved.
 
 When closing a dirty Core Data NSPersistentDocument I get the following 
 error between the Do you want to save sheet and the save panel:
 
 [58341:a0f] +[NSInvocation invocationWithMethodSignature:]: method signature 
 argument cannot be nil
 
 If I make the document dirty by typing text into any of the combo boxes or 
 the text view I get the above error after I press the Save button on the  
 Do you want to save…  sheet
 
 Well, as usual, there are two routes to attack this.  I was going to say to 
 try either, but in this case, since you know it has something to do with the 
 combo boxes or text view, I'd try Route 2 first.
 
 Route 1 - The Scientist.  Use debugging information to try and narrow down 
 where the problem might be.  To do this, set breakpoints on the following 
 symbols.  (Some are irrelevant for this case, but you should have these handy 
 in any project):
 
 handleFailureInMethod:object:file:lineNumber:description:
 objc_exception_throw
 malloc_printf
 -[NSException raise]
 handleFailureInFunction:file:lineNumber:description:
 raise:format:arguments:
 
 Then Debug - Breakpoints On.  Reproduce your problem, and the debugger will 
 stop where the exception occurs.  Look at the call stack and think real hard. 
  To get more food for thought, in your Xcode documentation browser, search 
 for and open the Document-Based Applications Overview.  Click on the 
 chapter, Message Flow in the Document Architecture, then scroll down to and 
 feast your eyes upon Figure 6.
 
 Route 2 - The Engineer.  Figure out what you're doing that's different than 
 what everyone else is doing, and change your design toward the more 
 conventional until the problem goes away.  You didn't say much about how 
 you're binding these combo boxes and text view.  Look at Apple's 
 DepartmentAndEmployees sample code, in the MyDocument.nib, and note how the 
 DepartmentController, an NSObjectController, is interposed between the user 
 interface and the data model.  One reason to do that is so that your data 
 model will be updated when the window is closed, and then you won't need to 
 do this:
 
 have the bindings set, in IB, to Continuously Updates Value.
 
 which is definitely *not* conventional.  (Again, look at the bindings in 
 DepartmentAndEmployees MyDocument.nib.)  Other reasons may be related to your 
 current problem.
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40softraph.com
 
 This email sent to cocoa-...@softraph.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: Table with cells as dragging destination?

2010-04-11 Thread Graham Cox

On 09/04/2010, at 1:26 AM, Izak van Langevelde wrote:

 I implemented the table as an NSTableView with NSImageCells, I know about the 
 standard drag and drop for table rows.
 However, I am clueless about how to use cells as dragging destination.
 Am I supposed to subclass NSTableView, and implement drag and drop, including 
 all gory details? Are there any examples available?
 Is there another view more suitable for what I'm trying to achieve?


You should be able to do it all with delegate/dataSource methods.

You are not dragging data to the table view's cells. You are dragging data to 
the underlying data model, which the table view displays (the table view only 
has one cell per column anyway).

When you receive the drag, handled by the datasource dragging callbacks, just 
insert the new image data into your data model and ask the table to redisplay. 
Simple as.

--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: Problem with reading an NSPipe-NSFileHandle to end

2010-04-11 Thread Ken Thomases
On Apr 11, 2010, at 3:18 PM, Rasmus Skaarup wrote:

 On 11/04/2010, at 21.17, Ken Thomases wrote:
 
 On Apr 8, 2010, at 9:57 AM, Rasmus Skaarup wrote:
 
 [[NSNotificationCenter defaultCenter] addObserver:self 
 
 selector:@selector(threadPipeReader:) 
 
 name:NSFileHandleReadCompletionNotification 
 
 object:nil]; 
 
 [[NSNotificationCenter defaultCenter] addObserver:self
 
  selector:@selector(threadTaskStopped:)
 
  name:NSTaskDidTerminateNotification
 
  object:nil];
 
 The above lines register to for those notifications on _all_ tasks and file 
 handles in the whole process.  This is probably not what you want.  You 
 should register for those notifications after you've created the pipe (and 
 its file handle) and the task, and you should register on those objects 
 specifically.
 
 I launch multiple processes, and I do a check to see which one is the one I'm 
 getting notified for by doing this in threadPipeReader:
 
 if ( [notification object] == myFileHandle ) 
 
 (and of course I have more NSTasks and NSFileHandles than myTask and 
 myFileHandle than my example shows).

OK, that's fairly reasonable.  Given that you're checking the notification 
object is one of the ones you're interested in, it's safe.

 So unless you strongly discourage this method, it works out pretty well and I 
 am able to distinguish which process is notifying me. The method you suggests 
 forces me to create seperate sub-routines for each invokation.

That's actually not true.  You can observe specific objects while using the 
same selector for all of the observations.

The distinction between this and what you are apparently doing is that the 
framework could theoretically be using NSFileHandles or (less likely) NSTask 
for its own purposes.  If you observe indiscriminately, then your method may 
get called for file handles or tasks that you didn't explicitly create.  You 
then check the notification objects, which filters out the ones you didn't 
create.  If you observe only the specific objects you create, then your method 
is only invoked for them and not for any framework-created objects.  Either way 
is workable, although I personally prefer to be specific.

 What you need to do is just mark some internal state so you know the task 
 has exited in threadTaskStopped:.  Then, return to the run loop so that you 
 can continue to receive the notifications from the background reads.  
 Eventually, you'll receive the end-of-file marker (a zero-length data).  
 After you've received both the end-of-file and the task termination 
 notification, then you can proceed to make final use of the data and clean 
 up the task (and your registrations with the notification center).
 
 This sounds like the thing I need - however I need a more detailed 
 explanation. I don't know what return to the run loop means. Can you give a 
 code example?

Um, not really.  Returning to the run loop means returning from your methods 
back to the whatever run loop is running.  For example, the main event loop (if 
the task launch and file handle readInBackgroundAndNotify are issued on the 
main thread).

Your code is launching the task and initiating the background read from the 
file handle, and then returning.  Then, when something happens, a notification 
is posted and your registered observer methods are invoked.  In between those 
events, what is your program doing?  Generally speaking, it's running the run 
loop, which actually means it's waiting for external events or data to arrive 
(or timers to fire).

If you don't understand this, you may need to read up about run loops:
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html


 -(id) init {
 [... snipped ...]
   NSThread *bgThread = [[NSThread alloc] initWithTarget:self 
 selector:@selector(myThread:) object:nil];
   [bgThread start];
 [... snipped ...]
 }
 
 - (void)myThread:(id)param {
   [self performSelectorOnMainThread:@selector(startMyTask:) 
 withObject:nil waitUntilDone:YES]; 
 }

The above makes no sense.  You are launching a background thread, but the only 
thing the background thread is doing is passing some work to the foreground 
thread.

You have added nothing but complexity and cost by involving a thread.

There is no need to do anything with threads to get asynchronous launching and 
monitoring of tasks.  The APIs involved (at least, the ones you are using) are 
inherently asynchronous.

I suspect we're still not seeing the real code.  I 

Re: Cant read second table from same sqlite database iphone

2010-04-11 Thread charisse napeÿfffff1as
I forgot to change the index to 1 but anyway I finally got it working. I guess 
its a copy problem from my createDatabaseIfNeeded function. since I already 
have a copy of the databse in the Users/Documents in the iphone simulator, 
after I've added data inside the second table, it wouldn't reflect in the query 
because my copy of the databse is outdated. I had to delete the existing 
database inside so my code can generate a new updated copy. My mistake is that 
I added data in the second table even after I have already used it.




From: Andrew Farmer andf...@gmail.com
To: charisse napeÿf1as cnape...@yahoo.com
Cc: cocoa-dev@lists.apple.com
Sent: Monday, April 12, 2010 4:10:21
Subject: Re: Cant read second table from same sqlite database iphone

On 10 Apr 2010, at 18:02, charisse napeÿf1as wrote:
//get the name and the score
int  iDen = sqlite3_column_int(statement, 0);
NSString* name = [NSString stringWithUTF8String:(char 
 *)sqlite3_column_text(statement, 0)];

Surely column 0 cannot be both an integer and text. Which one is it?


  Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


MPMoviePlayerController playhead position, setting markers to trigger events and notifications

2010-04-11 Thread Kevin Callahan
As a user scrubs forward and backward  through movie using 
MPMoviePlayerController, what's the most efficient way to know where the 
playhead is at? 
Is there a simple timeStamp one can grab?
Is there a way to set markers to trigger events and notifications?

Thanks,
Kevin
Accessorizer:   http://www.kevincallahan.org/software/accessorizer.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: Problem with reading an NSPipe-NSFileHandle to end

2010-04-11 Thread Jens Alfke
You could use MYTask, or at least look at how it’s implemented, instead of 
writing your own code. NSTask is surprisingly tricky to use if you want to read 
the task output.

http://bitbucket.org/snej/myutilities/src/tip/MYTask.h

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


Re: NSInvocation error when closing a dirty document

2010-04-11 Thread Jerry Krinock
Brad, you're overriding a method for a strange purpose, and it looks like 
you're examining an argument to see if it is a certain Apple private selector, 
and all this is done to achieve something which is quite ordinary, namely 
binding your data model to a combo box and a text view.

When you find yourself doing something extraordinary to achieve a result which 
is ordinary, it means that you took a wrong turn somewhere.  Anyone else with a 
similar problem should instead try the object controller I suggested.


On 2010 Apr 11, at 14:42, Brad Stone wrote:

 - (void)saveDocumentWithDelegate:(id)delegate 
 didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo {
   
 if (didSaveSelector == @selector(_document:shouldClose:contextInfo:)) {   


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: MPMoviePlayerController playhead position, setting markers to trigger events and notifications (MPMediaPlayback Protocol Reference)

2010-04-11 Thread Kevin Callahan

On Apr 11, 2010, at 8:18 PM, Kevin Callahan wrote:

 As a user scrubs forward and backward  through movie using 
 MPMoviePlayerController, what's the most efficient way to know where the 
 playhead is at? 
 Is there a simple timeStamp one can grab?
 Is there a way to set markers to trigger events and notifications?
 
 Thanks,
 Kevin
 Accessorizer: 
 http://www.kevincallahan.org/software/accessorizer.html

okay .. I found what I was looking for after sending the email, of course

MPMediaPlayback Protocol Reference

The current position of the playhead. (required)

@property(nonatomic) NSTimeInterval currentPlaybackTime

-K

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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