Re: How is the best way to emulate the plist editor GUI?

2010-02-15 Thread Andrew Farmer
On 14 Feb 2010, at 22:35, Juanma Cabello wrote:
 I have a simple object that only has a NSMutableDictionary where I
 store all the Apache configurations parameters. That's the collection
 I want to bind.

I know it's a bit of a tangent, but that representation isn't going to work 
very well. Particularly when mod_rewrite becomes involved, Apache configuration 
values don't follow a strict key-value pattern: a single directive may appear 
multiple times with similar (or even identical) values, and the order of 
directives can affect their 
meaning.___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 is the best way to emulate the plist editor GUI?

2010-02-15 Thread Juanma Cabello
I know that. Firstly I want to get the OutlineView working, after that
I'll take care about those cases where the key-value pattern isn't
followed.

Enviado desde mi iPhone

El 15/02/2010, a las 09:33, Andrew Farmer andf...@gmail.com escribió:

 On 14 Feb 2010, at 22:35, Juanma Cabello wrote:
 I have a simple object that only has a NSMutableDictionary where I
 store all the Apache configurations parameters. That's the collection
 I want to bind.

 I know it's a bit of a tangent, but that representation isn't going
 to work very well. Particularly when mod_rewrite becomes involved,
 Apache configuration values don't follow a strict key-value pattern:
 a single directive may appear multiple times with similar (or even
 identical) values, and the order of directives can affect their
 meaning.
___

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

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


NSView : Background bitmap drawing issue

2010-02-15 Thread Alexander Bokovikov
I've written a subclass of NSView, which draws a NSImage, as the  
background. All is working, but the only problem is in different  
behavior on different Macs / OS versions. Here is the drawing code:


@interface BGSkinView : NSView {
NSImage *bg;
BOOL isLeo, isSnowLeo;
}
..
- (void)drawRect:(NSRect)rect {
NSGraphicsContext *ctx;
CGFloat y;

ctx = [NSGraphicsContext currentContext];
[ctx saveGraphicsState];
y = [self bounds].size.height;

///
if (!isLeo)
y++;

///
[ctx setPatternPhase:NSMakePoint(0, y)];
//
[[NSColor colorWithPatternImage:bg] set];
NSRectFill([self bounds]);
//
[ctx restoreGraphicsState];
}

isLeo is true on 10.5 and isSnowLeo is true on 10.6

I tested this code on my Mac with both 10.4, 10.5 and 10.6 and have  
got a shift of the image for one pixel down on 10.4 and 10.6.  
Therefore I've added the condition, selected above. But now I've got a  
report from another 10.6 Mac, where my code shifts the background for  
one pixel up. Thus, my patch with y++ should be disabled there.


As far as I understand, this effect is caused not by OS version, but  
by some graphic subsystem feature. Could anybody tell me, what is this  
one-pixel shift? Maybe it's some border, drawn outside of my view,  
which I don't see?


Any help would be appreciated.

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: make connections without InterfaceBuilder

2010-02-15 Thread Mario Kušnjer

Hello !

I don't know if this got answered but here is my attempt. It is just a  
basic way of programmatically setting
an object as a application delegate and programmatically creating a  
button on the applications main

window and setting it to perform an action when clicked.

I know that there are some issues about the way this is implemented  
but it points the way to go.

Since I am a newbie my self any suggestions are more than welcome.

Brief explanation follows.

In Interface Builder:
- in MainMenu.xib create generic NSObject by adding it from the Library
- select that NSObject and in the Identity Inspector make it an  
instance of our ApplicationController class

In Xcode:
- in awakeFromNib we make our self as the application delegate
- in applicationDidFinishLaunching: we tell the application to make  
the first window that it finds as main

window, because at this time there is still no main window
- then we create our button instance, set its action as a selector  
with our action method, set our self as a target of that action,
and perform all necessary initializations for our button (title, type,  
etc)

- we add our button on the main window and then release the button
- in dealloc we remove our self as being application delegate
- okButtonAction: is our button's action method that performs NSBeep()  
function


Code follows.


ApplicationController.h

#import Cocoa/Cocoa.h


@interface ApplicationController : NSObject
{

}

@end

ApplicationController.m

#import ApplicationController.h


@implementation ApplicationController

- (void)awakeFromNib
{
[NSApp setDelegate:self];
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[NSApp makeWindowsPerform:@selector(makeMainWindow) inOrder:NO];

	NSButton * okButton = [[NSButton alloc]  
initWithFrame:NSMakeRect(10.0, 10.0, 96.0, 32.0)];

[okButton setAction:@selector(okButtonAction:)];
[okButton setTarget:self];
[okButton setTitle:@OK];
[okButton setButtonType:0];
[okButton setBezelStyle:11];

[[[NSApp mainWindow] contentView] addSubview:okButton];
[okButton release];
}

- (void)dealloc
{
[NSApp setDelegate:nil];

[super dealloc];
}

- (void)okButtonAction:(id)sender
{
NSBeep();
}

@end


Thanks.


Mario Kušnjer
mario.kusn...@sb.t-com.hr
+385957051982
mariokusnjer (at) Skype



___

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

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

2010-02-15 Thread Brad Stone
Thanks for your response.  That's exactly what I was doing but your response 
made me take another look (I was working on this all day yesterday).  It seems 
I was reloading the column before the wrapper was completely saved (even though 
I thought I was)!  When I put the reload code in a button and clicked it after 
the save it works fine.  Ugh - if I did this yesterday I would have saved hours 
of frustration!

On Feb 14, 2010, at 9:19 PM, Keary Suska wrote:

 On Feb 14, 2010, at 3:53 PM, Brad Stone wrote:
 
 I have an app that saves it's documents in a fileWrapper.  The document's 
 window has a NSBrowser where users can attach files.  Before the document is 
 saved for the first time the NSBrower's root is a temporary attachments 
 folder (because the filewrapper doesn't exist).  After it's saved that 
 attachment folder is moved into the wrapper.  When I save the file for the 
 first time, even though I set the root item to the attachment folder in the 
 wrapper, the Browser can't find the attachments (the items are still looking 
 in the temp folder).  If I close and reopen the document it works fine.
 
 What do I have to do to tell the NSBrowser that the root item has been 
 changed and that the items are now in the attachment folder in the wrapper?
 
 Did you call reloadColumn: after the change?
 
 Keary Suska
 Esoteritech, Inc.
 Demystifying technology for your home or business
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/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: Debugging auto_zone_resurrection_error in Core Data using GCD

2010-02-15 Thread Ashley Clark
I have seen some similar behavior with GCD in GC apps.

It seems that objects created on a separate thread that are then used from 
within a block on another thread do not get registered as existing in multiple 
threads. When the collector runs on the thread where the object was created it 
sees no more references to it and collects it, even though it now exists 
elsewhere.

I've only been able to work around it, either by creating the object within the 
block, or if necessary calling CFRetain()/CFRelease() on the object immediately 
after creating it. As I understand it, CFRetain triggers the collector to stop 
treating that address as a thread-local object.

You could also call Block_copy() on your block which should also fix this bug: 
http://twitter.com/bbum/status/6871389586


On Jan 26, 2010, at 4:49 PM, Benjamin Rister wrote:

 Because this isn’t already thorny enough, let me note that adding a 
 [startDate self] below the dispatch_sync in the first example doesn’t fix the 
 problem. This shows that it’s surviving long enough to at least reach the 
 dispatch_sync() call, and in fact malloc_history shows this:
 
 ALLOC 0x200028960-0x20002896f [size=16]: thread_102787000 |thread_start | 
 _pthread_start | __NSThread__main__ | -[MyThread main] | 
 -[__NSOperationInternal start] | -[MyOperation main] | +[NSDate date] | 
 +[__NSCFDate __new:] | __CFAllocateObject | 
 _internal_class_createInstanceFromZone | auto_zone_allocate_object 
 
 FREE  0x200028960-0x20002896f [size=16]: thread_102787000 |thread_start | 
 _pthread_start | __NSThread__main__ | -[MyThread main] | 
 -[__NSOperationInternal start] | objc_collect | auto_collect | 
 Auto::ThreadLocalCollector::collect(bool) | 
 Auto::ThreadLocalCollector::process_local_garbage(bool) | 
 Auto::ThreadLocalCollector::scavenge_local(unsigned long, unsigned long*) 
 
 In other words, it’s being collected after -main has returned, as part of 
 -[NSOperation start]’s cleanup.
 
 Also new interesting data is that even in the -doThatThingTo:attachValue: 
 instances, the resurrected garbage pointer is still an NSDate from the 
 *other* example. So it seems like there’s some sort of a delayed response, 
 like Core Data is storing a weak-but-nonzeroing pointer to the NSDate 
 somewhere, the object is collected, and later mucking in the MOC exposes the 
 dangling pointer.
 
 I remain thoroughly mystified…
 
 Thanks for any assistance,
 Benjamin Rister
 
 
 On Jan 26, 2010, at 10:57 AM, Benjamin Rister wrote:
 
 I’m getting an auto_zone_resurrection_error from inside Core Data. Because 
 this is following switching from locking a MOC on different threads (which 
 was working fine) to dispatching blocks to a GCD queue, my suspicion 
 naturally tends towards a multithreading violation. However, I’ve been over 
 it a million times and just can’t find by inspection any cases of doing 
 anything in the MOC (including its MOs, obviously) besides on that queue. 
 Using the debug suffix when loading frameworks (to try to enable Core Data’s 
 multithreading asserts) dies elsewhere for no apparent reason, not to 
 mention that I don’t actually see a _debug version in Core Data.framework, 
 nor see a download to obtain one from connect.apple.com like there was for 
 10.5.
 
 However, there’s also a suspicious trend in the places that this happens of 
 it appearing that an object assigned to a local variable or method parameter 
 outside of a dispatch_sync() is being collected before its use in the block. 
 In other words, the block’s reference may not be keeping the object alive. 
 For instance:
 
 - (void)main {
  NSDate* startDate = [NSDate date];
 
  /* lots of stuff */
 
  dispatch_sync(dispatch_get_main_queue(), ^{
  if(![self isCancelled]) {
  MyManagedObject* myMO = self.aRelationship.itsMO;
  ourItem.numericalValue = /* a number; this works fine, 
 so it seems the MO is okay*/;
  ourItem.aDate = startDate; /* problem occurs here, and 
 Instruments suggests startDate is the resurrected pointer */
  
  /* ... */
  }
  });
 }
 
 So,
 - What’s the current mechanism for enabling Core Data’s multithreading 
 asserts?
 - Is there a typical, non-multithreading cause for 
 auto_zone_resurrection_errors inside Core Data?
 - Or, are there any known bugs with GC and blocks (or a bug of mine in the 
 code snippet I gave) causing this?
 
 
 Some more details, if needed:
 
 malloc: resurrection error for block 0x2000281c0 while assigning 
 0x20003aa00[40] = 0x2000281c0
 garbage pointer stored into reachable memory, break on 
 auto_zone_resurrection_error to debug
 (gdb) bt
 #0  0x7fff8862dc44 in auto_zone_resurrection_error ()
 #1  0x7fff88628f09 in check_resurrection ()
 #2  0x7fff8862adac in auto_zone_set_write_barrier ()
 #3  0x7fff80749625 in objc_assign_strongCast_gc ()
 #4  0x7fff80251104 in 

Re: IKImageBrowserView IKImageView subclasses not getting called

2010-02-15 Thread Ashley Clark
On Feb 3, 2010, at 7:27 PM, Charles Burnstagger wrote:

 I subclass IKImageBrowserView  IKImageView overriding initWithFrame:  
 drawRect: and sending the same messages to super in both cases.
 
 I've set them as the classes for the UI objects in my IB file, and as 
 IBOutlets in my window's window controller subclass.
 
 But when I run the code, neither of my two subclasses ever get called. What 
 gives? Is there anything else I need to do in my subclasses?
 
 If I set the IBOutlets in the contoller subclass and class types in IB back 
 to IKImageBrowserView  IKImageView, the code seems to do the same thing as 
 when I use my subclasses.


For objects that were saved in a NIB file -initWithFrame: is usually not what's 
called to recreate them (there are some exceptions that I don't remember off 
the top of my head). Since NIBs are essentially archives most of the views 
stored within them are recreated via -initWithCoder:

As for the drawRect: override, it was my understanding that the IK*View objects 
didn't do any of their drawing in drawRect: but instead were done via CALayers. 
I could be misinformed on this point though.


Ashley

___

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

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

2010-02-15 Thread Steven Degutis
Essentially you need to use the Security.framework API which you were
already using in the beginning. You're already heading in the right
direction. If you continue to read the docs on it, you'll get your sample
code working; they're pretty thorough docs I believe.

-Steven

On Mon, Feb 15, 2010 at 1:48 AM, cocoa learner cocoa.lear...@gmail.comwrote:

 Ok let me put my problem in simple words -

 I have a cocoa app and I want to launch a shell script which has to do some
 task with root privilege. How can I do it???

 Regards,
 Cocoa.learner

 On Mon, Feb 15, 2010 at 1:49 AM, Nick Zitzmann n...@chronosnet.com
 wrote:

 
  On Feb 13, 2010, at 11:05 PM, cocoa learner wrote:
 
   And permission of this script is -
   -rwx-- 1 root  wheel  536 Feb 14 10:51 /Users/test/myScript
  
  
   When I am executing the app launchScript is returning me TRUE but my
   script is not getting executed. I am totally lost, have no clue why
 it's
   happening like this.
  
   Does any body know why this script is not getting executed? Am I doing
  any
   thing wrong?
 
  Yes and yes. You set your script's permissions to 700 root/wheel, which
  means that you don't have permission to run the script. AEWP() executes
  tasks with root privileges, but it doesn't execute them _as_ root. If you
  need to do that, then you must use a wrapper that sets the uid to root.
  Check the archives for more information. It might be easier, though, to
 set
  the permissions to 755 instead, and put in a check for root privileges.
 
  And if that still doesn't work, then you might need to execute the shell
 as
  the task, and point the shell to the script, but I'm pretty sure you just
  have the permissions set incorrectly.
 
  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/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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

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

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

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


Re: Bind to string (path), convert to NSImage

2010-02-15 Thread Steven Degutis
You can bind an NSString path of an image, to an NSImageView. Look up
NSImageView bindings in the documentation.

Also it seems like bad practice to have the at-symbol inside your
NSDictionary key strings. For example make sure you use @iconpath instead
of @@iconpath because that at-symbol could eventually conflict with
Apple's own collection operators.

-Steven

2010/2/15 Trygve Inda cocoa...@xericdesign.com

 I have an NSImageWell (or NSView). I am using an NSCollectionView and have
 it bound to an ArrayController which is bound to an array of NSDictionary.

 The dicts have several keys, among them @name and @iconpath

 @iconpath is a NSSting that contains a path to an NSImage.

 How can I bind though my NSArrayController, but have code that converts my
 path to an NSImage to return to the view inside NSCollectionView

 Obviously I know how to derive the NSImage from the path, but since the
 NSImage in not in the array of dicts, how can I bind it?

 I basically need the system to call a method I write to take a path and
 return an NSImage.

 Thanks,

 Trygve


 ___

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

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

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

 This email sent to steven.degu...@gmail.com




-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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

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

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

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


Re: NSPanel and runModalForWindow: problems

2010-02-15 Thread Keary Suska
On Feb 13, 2010, at 7:53 AM, Daniel Káčer wrote:

 I have a NSPanel that is opened like Modal panel:
 
 -(void) showModal {
 [NSApp runModalForWindow: myWindow];
 }
 
 and is closed with event click on button that is allocated on this NSPanel:
 
 -(IBAction)delayWindow:(id)sender {
[NSApp abortModal];
  //[myWindow orderOut: self];
[myWindow close];
 }
 
 First calling of runModalForWindow: works fine and NSPanel is in modal status 
 but after calling delayWindow and after then second calling of  showModal is 
 NSPanel correctly showed but is not in Modal status :(
 What i do wrongly and why is not my NSPanel in Modal status after second, 
 third etc. calling of showModal ?

The proper way to end a modal session within the modal event loop is to use 
-stopModal or -stopModalWithCode: . Try that and keep the -orderOut call (not 
because it is necessary, just that it is a good practice for windows you know 
you will re-use without re-loading).

HTH,

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

___

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

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

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

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


Re: UIWebView PDF Paging

2010-02-15 Thread David Duncan
On Feb 13, 2010, at 6:49 AM, Josh Tucker wrote:

 I'm loading a PDF stored locally into a UIWebView. Is there any way that I 
 can achieve paging?


No, if you want paging you will have to implement your own PDF viewer. If you 
use the UIWebView, you get what you get.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: IKImageBrowserView IKImageView subclasses not getting called

2010-02-15 Thread Jens Alfke

On Feb 15, 2010, at 7:18 AM, Ashley Clark wrote:

 For objects that were saved in a NIB file -initWithFrame: is usually not 
 what's called to recreate them (there are some exceptions that I don't 
 remember off the top of my head). Since NIBs are essentially archives most of 
 the views stored within them are recreated via -initWithCoder:

Right. Setup code for objects from nibs should usually go in -awakeFromNib.

 As for the drawRect: override, it was my understanding that the IK*View 
 objects didn't do any of their drawing in drawRect: but instead were done via 
 CALayers. I could be misinformed on this point though.

Right again, basically, although I think they use direct OpenGL for drawing. 
This unfortunately makes it extremely difficult to customize the display of 
these views, since the OpenGL surface covers up any regular drawing. I tried 
pretty hard to extend the image-browser a few years ago and eventually gave up.

—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


GeekGameBoard (was: Re: Touch-and-drag architecture question)

2010-02-15 Thread Dave DeLong
Thanks, Jens!  I'd never heard of this before, and it looks like it'll fit the 
bill nicely.  However, I'm a total noob when it comes to CoreAnimation, so it 
may be a while before I grok what's going on underneath.

As far as GGB goes, how well does it handle custom boards?  For example, let's 
say I wanted to recreate this board:  
http://gallery.me.com/davedelong#100084/Boardbgcolor=black (dots are valid 
positions, and lines indicate valid moves between positions).  

Presumably I'd be creating a custom Grid subclass and building the board 
layout in there.  My board is based on a square grid, but I'm not sure how I'd 
only make some of the grid positions valid locations, nor how I'd draw the 
lines in between them.  What would I need to do to recreate this board?

Thanks!

Dave

On Feb 14, 2010, at 3:18 PM, Jens Alfke wrote:

 CoreAnimation is the best way to go for board games IMO. Lighter weight than 
 views, and it does the interpolation for you.
 
 I wrote a framework for board games using CA:
 http://bitbucket.org/snej/geekgameboard
 
 --Jens   {via iPhone}
 
 
 On Feb 14, 2010, at 1:38 PM, Dave DeLong davedel...@me.com wrote:
 
 Hi everyone,
 
 I've an iPhone app that I'm working on (it's a simple game), where I've got 
 the game board on the screen, and then a row of pieces above and below the 
 board (representing the pieces controlled/captured by each player).  I'd 
 like to be able to drag pieces from these rows onto the board.  My question 
 is this:
 
 How should I set up the view hierarchy to do the drag and drop?  As I see 
 it, there are three main ways:
 
 1.  Use different views for the board and the two rows.  This is good for 
 encapsulation, but bad for cross-view dragging.
 2.  Use a single view for the board and the two rows.  This is bad for 
 encapsulation, but makes dragging much easier.
 3.  Use different views for the board and the two rows, but have an 
 invisible view on top of everything that captures all the events and passes 
 them on accordingly.  I'm not sure how this would work out.
 
 Perhaps another important question is: how should pieces be rendered?  I've 
 been drawing them with CoreGraphics (hence the difficulty of dragging them 
 between views), but I could also make each piece its own UIView (which might 
 complicate dragging in other ways).
 
 What do you suggest?
 
 Thanks!
 
 Dave DeLong
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/jens%40mooseyard.com
 
 This email sent to j...@mooseyard.com



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

problem with distributed objects

2010-02-15 Thread Eric Smith
OK, I'm back.

I have some distributed object code that used to work just great (back in the 
Tiger days, I think), and now does not.  I see the error: [NSPortCoder 
sendBeforeTime:sendReplyPort:] timed out, when I try to get the rootProxy from 
a connection.  I see this mentioned here and there on various mailing lists, 
but haven't seen any solution. 

I need to provide a DO across a network.  The simple code Apple provides in the 
DO programming guide does work on a single machine:

vend it
/* Assume serverObject has a valid value of an object to be vended. */
NSConnection *theConnection;
 
theConnection = [NSConnection defaultConnection];
[theConnection setRootObject:serverObject];
if ([theConnection registerName:@server] == NO) {
/* Handle error. */
}

get it
id theProxy;
theProxy = [[NSConnection
rootProxyForConnectionWithRegisteredName:@server
host:nil] retain];
[theProxy setProtocolForProxy:@protocol(ServerProtocol)];



But if one initializes the connection with an NSSocketPort, which is required 
if one wants to talk beyond a single machine, the registerName message fails.  
So, I whip out the code that used to work.  The few relevant parts listed below:

vend it:

conduitPort = [[NSSocketPort alloc] init];
myConduit = [[ServerConduit alloc] init];
conduitConnection = [[NSConnection alloc] initWithReceivePort:conduitPort 
sendPort:nil];
[conduitConnection setRootObject:myConduit];

get it:
- (void)netServiceDidResolveAddress:(NSNetService *)netService{
struct sockaddr *address;

NSConnection* theConnection;
NSSocketPort* thePort;
NSSocketPort* socket;
printf(\resolved address\n);
socket = [[NSSocketPort alloc] init];
if([[netService addresses] count]  0){
address = (struct sockaddr *)[[[netService addresses] 
objectAtIndex:0] bytes];
thePort = [[NSSocketPort alloc] 
initRemoteWithProtocolFamily:address-sa_family socketType:SOCK_STREAM 
protocol:0 address:[[netService  addresses] 
objectAtIndex:0]];
theConnection = [[NSConnection alloc] initWithReceivePort:nil 
sendPort:thePort];
[thePort release];
id theProxy = [theConnection rootProxy];
}else{
NSLog(@Could not find an address for the service.);
}
}


When I call rootProxy, I get the time out error.  Does anyone have a 
dirt-simple sample app I can look at that vends, and gets, a DO over a network 
on 10.5 or later?!  

Thanks for the help,
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/archive%40mail-archive.com

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


Re: Question about zipping files

2010-02-15 Thread Greg Guerin

Gideon King wrote:

1. Use NSTask to create a zip file, passing in as arguments all the  
filenames to zip. My question about this would be whether I would  
run into any restrictions with the length of the command which well  
be beyond the old 1024 character limits (not sure if any command  
line argument limits are still extant). I would think this would be  
the most efficient way to do it (both time and memory/storage  
wise), so long as there are no limitations on command line length.


Max argv size is defined by sysctl kern.argmax.  It's at least 256K  
these days.  I don't think it was ever as low as 1024.


Most archive tools have an option that tells them to read file-lists  
from stdin, one pathname per line.


If the archive format doesn't have to be pkzip, then consider using  
tar and gzip.


You could hard-link selected files into a temp-folder rather than  
copying them.  Then unlink when you're done and no copies needed. You  
can't hard-link symlinks, though, so that may not work.  However,  
pkzip has no encoding for symlinks, so you can't zip a symlink,  
anyway.  Or are you using ditto to write the zip file?


  -- GG

___

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

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

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

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


Re: GeekGameBoard (was: Re: Touch-and-drag architecture question)

2010-02-15 Thread Jens Alfke

On Feb 15, 2010, at 8:49 AM, Dave DeLong wrote:

 As far as GGB goes, how well does it handle custom boards?  For example, 
 let's say I wanted to recreate this board: 
 http://gallery.me.com/davedelong#100084/Boardbgcolor=black (dots are valid 
 positions, and lines indicate valid moves between positions).  
 Presumably I'd be creating a custom Grid subclass and building the board 
 layout in there.  My board is based on a square grid, but I'm not sure how 
 I'd only make some of the grid positions valid locations, nor how I'd draw 
 the lines in between them. What would I need to do to recreate this board?

You can create a 7x7 RectGrid and then call -removeCellAtRow:column: to remove 
the cells that don't appear in that board. You'd also want to set the 
borderWidth to 0 in the remaining cells so they don't draw their square 
outlines.

Alternatively, you could just start with an empty board and add a BitHolder 
object for every valid position.

Drawing the background lines is up to you. You could create a fancy image of 
the board and add it as a PNG file, or you could make a CALayer for the 
background that has a custom drawing callback.

—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: Bind to string (path), convert to NSImage

2010-02-15 Thread Trygve Inda
 You can bind an NSString path of an image, to an NSImageView. Look up
 NSImageView bindings in the documentation.
 
 Also it seems like bad practice to have the at-symbol inside your
 NSDictionary key strings. For example make sure you use @iconpath instead
 of @@iconpath because that at-symbol could eventually conflict with
 Apple's own collection operators.
 
 -Steven
 
 2010/2/15 Trygve Inda cocoa...@xericdesign.com
 
 I have an NSImageWell (or NSView). I am using an NSCollectionView and have
 it bound to an ArrayController which is bound to an array of NSDictionary.
 
 The dicts have several keys, among them @name and @iconpath
 
 @iconpath is a NSSting that contains a path to an NSImage.
 
 How can I bind though my NSArrayController, but have code that converts my
 path to an NSImage to return to the view inside NSCollectionView
 
 Obviously I know how to derive the NSImage from the path, but since the
 NSImage in not in the array of dicts, how can I bind it?
 
 I basically need the system to call a method I write to take a path and
 return an NSImage.

Actually the @ is not in my names - not sure why I wrote it out like that.

Thank you.


___

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

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

2010-02-15 Thread Julien Jalon
SnowLeopard introduced a bunch of new public API to make customizing easier:

On the view itself:

- (void) setBackgroundLayer:(CALayer *) aLayer;

- (void) setForegroundLayer:(CALayer *) aLayer;

extern NSString * const IKImageBrowserGroupHeaderLayer; /*
CALayer */

extern NSString * const IKImageBrowserGroupFooterLayer; /*
CALayer */

on the browser cell:

- (CALayer *) layerForType:(NSString *) type;

-- 
Julien

On Mon, Feb 15, 2010 at 5:42 PM, Jens Alfke j...@mooseyard.com wrote:


 On Feb 15, 2010, at 7:18 AM, Ashley Clark wrote:

  For objects that were saved in a NIB file -initWithFrame: is usually not
 what's called to recreate them (there are some exceptions that I don't
 remember off the top of my head). Since NIBs are essentially archives most
 of the views stored within them are recreated via -initWithCoder:

 Right. Setup code for objects from nibs should usually go in -awakeFromNib.

  As for the drawRect: override, it was my understanding that the IK*View
 objects didn't do any of their drawing in drawRect: but instead were done
 via CALayers. I could be misinformed on this point though.

 Right again, basically, although I think they use direct OpenGL for
 drawing. This unfortunately makes it extremely difficult to customize the
 display of these views, since the OpenGL surface covers up any regular
 drawing. I tried pretty hard to extend the image-browser a few years ago and
 eventually gave up.

 —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/jjalon%40gmail.com

 This email sent to jja...@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: IKImageBrowserView IKImageView subclasses not getting called

2010-02-15 Thread Julien Jalon
And you have an example:

http://devworld.apple.com/mac/library/samplecode/ImageBrowserViewAppearance/index.html

-- 
Julien

On Mon, Feb 15, 2010 at 5:42 PM, Jens Alfke j...@mooseyard.com wrote:


 On Feb 15, 2010, at 7:18 AM, Ashley Clark wrote:

  For objects that were saved in a NIB file -initWithFrame: is usually not
 what's called to recreate them (there are some exceptions that I don't
 remember off the top of my head). Since NIBs are essentially archives most
 of the views stored within them are recreated via -initWithCoder:

 Right. Setup code for objects from nibs should usually go in -awakeFromNib.

  As for the drawRect: override, it was my understanding that the IK*View
 objects didn't do any of their drawing in drawRect: but instead were done
 via CALayers. I could be misinformed on this point though.

 Right again, basically, although I think they use direct OpenGL for
 drawing. This unfortunately makes it extremely difficult to customize the
 display of these views, since the OpenGL surface covers up any regular
 drawing. I tried pretty hard to extend the image-browser a few years ago and
 eventually gave up.

 —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/jjalon%40gmail.com

 This email sent to jja...@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: NSPanel and runModalForWindow: problems

2010-02-15 Thread Daniel Káčer
Thank you, but maybe i have not describe it quite right, but my issue  
is, that in first calling of  showModal function is my NSPanel  
displayed top of all windows on my desktop and clicking on any window  
will this window not overlap my NSPanel and will remain this my panel  
still on top. This is correct functionality ! :)  But .. this function  
showModal is called multiple times during runnig my application, and  
this NSPanel is multiple showed and closed. But only first calling of  
showModal function will showing my panel still on top of all windows  
on desktop, all other calls this function, during running my  
application, show my panel so, that is no problem overlap him with  
clicking to another window and panel will not remain on top. :(


thnx
Daniel

On Feb 15, 2010, at 17:19 , Keary Suska wrote:

On Feb 13, 2010, at 7:53 AM, Daniel Káčer wrote:


I have a NSPanel that is opened like Modal panel:

-(void) showModal {
   [NSApp runModalForWindow: myWindow];
}

and is closed with event click on button that is allocated on this  
NSPanel:


-(IBAction)delayWindow:(id)sender {
  [NSApp abortModal];
//[myWindow orderOut: self];
  [myWindow close];
}

First calling of runModalForWindow: works fine and NSPanel is in  
modal status but after calling delayWindow and after then second  
calling of  showModal is NSPanel correctly showed but is not in  
Modal status :(
What i do wrongly and why is not my NSPanel in Modal status after  
second, third etc. calling of showModal ?


The proper way to end a modal session within the modal event loop is  
to use -stopModal or -stopModalWithCode: . Try that and keep the - 
orderOut call (not because it is necessary, just that it is a good  
practice for windows you know you will re-use without re-loading).


HTH,

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


___

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

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

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

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


Null value from NSMutableArray

2010-02-15 Thread mart...@telia.com
Is there a way to display/view data inside an Arraylist.
trying to use:

RandomObj *fooObj = [[RandomObj alloc]init];

NSEnumerator *enumerator = [fooArray objectEnumerator];
  id obj;
  while ( obj = [enumerator nextObject] ) {
  NSLog( @%@, obj);
  NSLog( @%d, fooObj.id);
  NSLog( @%@, fooObj.name);
}

I get memory slots + values when im runing this from same method as the 
imported data from a sqliteDB. But when im calling the same Object but from 
example in Appdelegate (where i have the arraylist) i get the memory slot but 
values in id and name become 0 and null.

- Martin
___

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

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


Freelance Cocoa job- SF Bay Area

2010-02-15 Thread Dave
Cocoa Developer- SF Bay area

Cocoa Developer sought to complete specific tasks on existing laboratory 
automation software.

Familiarity with threads, AMSerialPort, Applescript is a plus.

This is a freelance position. Ability to work on-site occasionally is required 
(40 miles from Silicon Valley). NDA required.

Interested parties should send their resume and a brief cover letter, OFF LIST, 
to this email address. 

Thank you!

Dave___

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

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

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

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


Re: NSView : Background bitmap drawing issue

2010-02-15 Thread Steve Christensen
While there could be a drawing but in the OS, it's probably best to  
rule out issues with your code first. How do you determine the OS  
version? I ask because that's the only version-specific test in your  
drawing code. I would do something like this to initialize the  
variables:


double majorOSVersionNumber = floor(NSAppKitVersionNumber);

isLeo = NO;
isSnowLeo = NO;
if (majorOSVersionNumber  NSAppKitVersionNumber10_4)
{
if (majorOSVersionNumber  NSAppKitVersionNumber10_5)
isSnowLeo = YES;
else
isLeo = YES;
}

You should not being doing tests like if (NSAppKitVersionNumber ==  
NSAppKitVersionNumber10_5) since that will only be true for 10.5.0,  
but will fail for 10.5.1, 10.5.2, etc. The value of  
NSAppKitVersionNumber is incremented by an integer amount for 10.x  
releases and by a fractional amount for 10.x.x releases.



On Feb 15, 2010, at 1:26 AM, Alexander Bokovikov wrote:

I've written a subclass of NSView, which draws a NSImage, as the  
background. All is working, but the only problem is in different  
behavior on different Macs / OS versions. Here is the drawing code:


@interface BGSkinView : NSView {
NSImage *bg;
BOOL isLeo, isSnowLeo;
}
..
- (void)drawRect:(NSRect)rect {
NSGraphicsContext *ctx;
CGFloat y;

ctx = [NSGraphicsContext currentContext];
[ctx saveGraphicsState];
y = [self bounds].size.height;

///
   if (!isLeo)
y++;

///
[ctx setPatternPhase:NSMakePoint(0, y)];
//
[[NSColor colorWithPatternImage:bg] set];
NSRectFill([self bounds]);
//
[ctx restoreGraphicsState];
}

isLeo is true on 10.5 and isSnowLeo is true on 10.6

I tested this code on my Mac with both 10.4, 10.5 and 10.6 and have  
got a shift of the image for one pixel down on 10.4 and 10.6.  
Therefore I've added the condition, selected above. But now I've got  
a report from another 10.6 Mac, where my code shifts the background  
for one pixel up. Thus, my patch with y++ should be disabled there.


As far as I understand, this effect is caused not by OS version, but  
by some graphic subsystem feature. Could anybody tell me, what is  
this one-pixel shift? Maybe it's some border, drawn outside of my  
view, which I don't see?


___

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

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

2010-02-15 Thread Steve Christensen
You could expect to see zero/nil values returned from object  
properties if the object pointer is nil. Adding


NSLog(@%p, fooObj);

would tell you if that's the case.

Also, I'm not sure how your question relates to NSMutableArray since,  
at least in your code snippet, you don't do much with it.



On Feb 15, 2010, at 1:53 AM, mart...@telia.com wrote:


Is there a way to display/view data inside an Arraylist.
trying to use:

RandomObj *fooObj = [[RandomObj alloc]init];

NSEnumerator *enumerator = [fooArray objectEnumerator];
 id obj;
 while ( obj = [enumerator nextObject] ) {
 NSLog( @%@, obj);
 NSLog( @%d, fooObj.id);
 NSLog( @%@, fooObj.name);
}

I get memory slots + values when im runing this from same method as  
the
imported data from a sqliteDB. But when im calling the same Object  
but from
example in Appdelegate (where i have the arraylist) i get the memory  
slot but

values in id and name become 0 and null.


___

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

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

2010-02-15 Thread Alexander Bokovikov

On Monday, February 15, 2010 at 11:50 PM Steve Christensen wrote:

While there could be a drawing but in the OS, it's probably best to  rule 
out issues with your code first. How do you determine the OS  version?


I've used a code from the Net, which adds a category to NSApplication. This 
code was tested in both 10.4, 10.5 and 10.6 and works perfectly. No problems 
here. Moreover, I've changed the drawing code to make it to be more clear. 
My initial goal was just to draw the upper part of background image (the 
same for several windows), whereas windows have different height. Therefore 
I calculate an offset value, which is used in setPatternPhase, as


[myView bounds].size.height - [myBgImage size].height

And I've tried to exclude version checking from the code. A person, who 
reported a bug in 10.6, now tells that all is OK. But I've tested this 
version in 10.6 and in 10.4 and in both versions there is a shift for 1 
pixel down. It looks like my NSView is shifted for 1 pixel. But its frame 
top is zero. Its height is the same in every OS... Just a weird problem...


Best regards,
Alexander



- Original Message - 
From: Steve Christensen puns...@mac.com

To: Alexander Bokovikov openwo...@uralweb.ru
Cc: cocoa-dev@lists.apple.com
Sent: Monday, February 15, 2010 11:50 PM
Subject: Re: NSView : Background bitmap drawing issue


While there could be a drawing but in the OS, it's probably best to  rule 
out issues with your code first. How do you determine the OS  version? I 
ask because that's the only version-specific test in your  drawing code. I 
would do something like this to initialize the  variables:


double majorOSVersionNumber = floor(NSAppKitVersionNumber);

isLeo = NO;
isSnowLeo = NO;
if (majorOSVersionNumber  NSAppKitVersionNumber10_4)
{
if (majorOSVersionNumber  NSAppKitVersionNumber10_5)
isSnowLeo = YES;
else
isLeo = YES;
}

You should not being doing tests like if (NSAppKitVersionNumber == 
NSAppKitVersionNumber10_5) since that will only be true for 10.5.0,  but 
will fail for 10.5.1, 10.5.2, etc. The value of  NSAppKitVersionNumber is 
incremented by an integer amount for 10.x  releases and by a fractional 
amount for 10.x.x releases.



On Feb 15, 2010, at 1:26 AM, Alexander Bokovikov wrote:

I've written a subclass of NSView, which draws a NSImage, as the 
background. All is working, but the only problem is in different 
behavior on different Macs / OS versions. Here is the drawing code:


@interface BGSkinView : NSView {
NSImage *bg;
BOOL isLeo, isSnowLeo;
}
..
- (void)drawRect:(NSRect)rect {
NSGraphicsContext *ctx;
CGFloat y;

ctx = [NSGraphicsContext currentContext];
[ctx saveGraphicsState];
y = [self bounds].size.height;
///
   if (!isLeo)
y++;
///
[ctx setPatternPhase:NSMakePoint(0, y)];
//
[[NSColor colorWithPatternImage:bg] set];
NSRectFill([self bounds]);
//
[ctx restoreGraphicsState];
}

isLeo is true on 10.5 and isSnowLeo is true on 10.6

I tested this code on my Mac with both 10.4, 10.5 and 10.6 and have  got 
a shift of the image for one pixel down on 10.4 and 10.6.  Therefore I've 
added the condition, selected above. But now I've got  a report from 
another 10.6 Mac, where my code shifts the background  for one pixel up. 
Thus, my patch with y++ should be disabled there.


As far as I understand, this effect is caused not by OS version, but  by 
some graphic subsystem feature. Could anybody tell me, what is  this 
one-pixel shift? Maybe it's some border, drawn outside of my  view, which 
I don't see?




___

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

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


Embedded web server

2010-02-15 Thread jonat...@mugginsoft.com
There are a few visible references to embedding web servers in Cocoa apps:

http://toxicsoftware.com/is_that_an_http_server_in_your_cocoa_application
http://www.cocoabuilder.com/archive/cocoa/135882-embedding-web-server-in-cocoa-app.html

I have been considering two approaches:

1. A Cocoa based solution - http://code.google.com/p/cocoahttpserver/
2. Twisted via PyObjC - http://twistedmatrix.com/trac/

The Cocoa solution seems fairly straightforward but I am intrigued by Twisted.

Has anyone experience of integrating Twisted into a Cocoa app in this way?

Is it viable to run from within an application bundle in a shipping app?

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: Null value from NSMutableArray

2010-02-15 Thread Jens Alfke

On Feb 15, 2010, at 1:53 AM, mart...@telia.com wrote:

 RandomObj *fooObj = [[RandomObj alloc]init];
 
 NSEnumerator *enumerator = [fooArray objectEnumerator];
  id obj;
  while ( obj = [enumerator nextObject] ) {
  NSLog( @%@, obj);
  NSLog( @%d, fooObj.id);
  NSLog( @%@, fooObj.name);
 }

I can't really follow what this code is supposed to do. fooObj is a 'blank' 
object, whose properties don't get set to anything, but you print out its id 
and name property every time through the loop. Did you mean to use obj instead 
of fooObj in the last two NSLog calls? In that case, what's fooObj for?

Also, it's a heck of a lot easier to iterate over an array by using
for (id obj in fooArray) { ... }
unless you need your app to remain compatible with the thirty-two Mac users who 
still run 10.4.

—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


valueForUndefinedKey confusion

2010-02-15 Thread James Maxwell
Hello All,

I have an NSMutableDictionary I'm trying to read from, but it's giving me 
valueForUndefinedKey errors. I can NSLog the key successfully, so I'm very 
confused as to what's going on.

NSLog(@Total number of components in work: %i, [AllComponents count]);
for(NSString* cKey in AllComponents)
{
NSLog(@key? %@, cKey);
MnSComponent *comp = (MnSComponent*)[AllComponents valueForKey:cKey];
[comp buildPitchMatrix];
[comp calculateTension];
}

The NSLog prints the expected key, then the code gags on the next line. ???


-

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
jbmaxw...@rubato-music.com
jbmax...@sfu.ca

___

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

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

2010-02-15 Thread Graham Cox

On 16/02/2010, at 8:56 AM, James Maxwell wrote:

 I have an NSMutableDictionary I'm trying to read from, but it's giving me 
 valueForUndefinedKey errors. I can NSLog the key successfully, so I'm very 
 confused as to what's going on.
 
 NSLog(@Total number of components in work: %i, [AllComponents count]);
 for(NSString* cKey in AllComponents)
 {
   NSLog(@key? %@, cKey);
   MnSComponent *comp = (MnSComponent*)[AllComponents valueForKey:cKey];
   [comp buildPitchMatrix];
   [comp calculateTension];
 }
 
 The NSLog prints the expected key, then the code gags on the next line. ???

Try -objectForKey: instead of -valueForKey: there might be some subtlety of use 
KVC versus direct access that's screwing things up here. The key might contain 
characters that can be misinterpreted by KVC - containing '@' or '.' characters 
for example.

Also, are you certain that buildPitchMatrix and calculateTension are not 
mutating the dictionary? If they do the iteration will fail.

--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: valueForUndefinedKey confusion

2010-02-15 Thread James Maxwell
Ha - that did it!
As expected, you are a rock star, Graham.

(and no, the following methods don't muck with the dictionary - it's obviously 
some subtlety in KVC... There is an underscore in the key string, so that 
probably borked it.)

cheers,

J.


On 2010-02-15, at 2:09 PM, Graham Cox wrote:

 
 On 16/02/2010, at 8:56 AM, James Maxwell wrote:
 
 I have an NSMutableDictionary I'm trying to read from, but it's giving me 
 valueForUndefinedKey errors. I can NSLog the key successfully, so I'm very 
 confused as to what's going on.
 
 NSLog(@Total number of components in work: %i, [AllComponents count]);
 for(NSString* cKey in AllComponents)
 {
  NSLog(@key? %@, cKey);
  MnSComponent *comp = (MnSComponent*)[AllComponents valueForKey:cKey];
  [comp buildPitchMatrix];
  [comp calculateTension];
 }
 
 The NSLog prints the expected key, then the code gags on the next line. ???
 
 Try -objectForKey: instead of -valueForKey: there might be some subtlety of 
 use KVC versus direct access that's screwing things up here. The key might 
 contain characters that can be misinterpreted by KVC - containing '@' or '.' 
 characters for example.
 
 Also, are you certain that buildPitchMatrix and calculateTension are not 
 mutating the dictionary? If they do the iteration will fail.
 
 --Graham
 
 

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
jbmaxw...@rubato-music.com
jbmax...@sfu.ca

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Debugger: Cannot access memory at address 0x00

2010-02-15 Thread Fritz Anderson
On 15 Feb 2010, at 1:32 AM, Charles Burnstagger wrote:

 I have a perfecting working desktop OS X app built under Xcode 3.2.1 and 
 10.6.2, targeting 10.6 only. I move the project folder a subfolder, reset all 
 source, resource, and framework paths to reflect the new location and now 
 when I build and run (even without debugging), Xcode gives me this error:
 
 Error From Debugger: Cannot access memory at address 0x00
 
 Does anyone know what causes this and how to solve it?

It looks like an Xcode bug, which the xcode-users list might be able to tell 
you more about. In the mean time, use the Debugging panel of the Preferences 
window to turn on GDB logging, reproduce the bug, and be prepared to include 
the relevant part of the log in your discussion. 

See if doing a Build  Clean All Targets helps. See if clearing-out the Code 
Sense index (Project Info window, General tab, button at the bottom) helps.

— F

___

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

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


Debugger issue

2010-02-15 Thread Matthew Weinstein

Dear XCode folk,
I'm sure this is obvious but it's got me stumped and googling has  
produced no solutions.


The program always runs with the debugger when I launch with xcode  
(3.1.4). It doesn't matter if I pick build and go or go; the debugger  
always launches.


In previous versions (2.5) I was able to run w/o the debugger. In  
general, It's too slow with the debugger up and going for a lot of my  
debugging work.


Is there a way to run this w/o putting it through the debugger?

--Matthew

___

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

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


Ignore last message...

2010-02-15 Thread Matthew Weinstein

The XCode problem was solved. Guard Molloch [sic] was the culprit.

--Matthew
___

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

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

2010-02-15 Thread Daniel Káčer

Ok, so .. at the end I managed to find the correct solution

-(void) showModal
[myWindow setLevel: NSStatusWindowLevel];
[myWindow center];
[myWindow orderFront: self];
}

-(IBAction)delayWindow:(id)sender {
[myWindow orderOut: self];
}

also thank those Keary Suska, that he brought me back on track :)

Daniel



On Feb 15, 2010, at 17:19 , Keary Suska wrote:

On Feb 13, 2010, at 7:53 AM, Daniel Káčer wrote:


I have a NSPanel that is opened like Modal panel:

-(void) showModal {
   [NSApp runModalForWindow: myWindow];
}

and is closed with event click on button that is allocated on this  
NSPanel:


-(IBAction)delayWindow:(id)sender {
  [NSApp abortModal];
//[myWindow orderOut: self];
  [myWindow close];
}

First calling of runModalForWindow: works fine and NSPanel is in  
modal status but after calling delayWindow and after then second  
calling of  showModal is NSPanel correctly showed but is not in  
Modal status :(
What i do wrongly and why is not my NSPanel in Modal status after  
second, third etc. calling of showModal ?


The proper way to end a modal session within the modal event loop is  
to use -stopModal or -stopModalWithCode: . Try that and keep the - 
orderOut call (not because it is necessary, just that it is a good  
practice for windows you know you will re-use without re-loading).


HTH,

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


___

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

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

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

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


Getting a stacktrace on 10.5

2010-02-15 Thread Gideon King
I am building on 10.6 and targeting 10.5 deployment. I pick up exceptions and 
log the stacktrace using callStackSymbols if it is available (10.6) - this 
works fine.

On 10.5, if the user has the developer tools installed, I can use the atos 
command to get the trace, but if they haven't is there any way to get a 
stacktrace on 10.5? I have tried the backtrace_symbols method, but that doesn't 
seem to give me anything useful. 

Is there some other way of doing this on 10.5? 

Are there compile options that would get backtrace_symbols to produce something 
useful? If so, what would be the impact of using them?

Thanks

Gideon


___

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

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

2010-02-15 Thread Matthew Lindfield Seager
On Tuesday, February 16, 2010, Jens Alfke j...@mooseyard.com wrote:
 unless you need your app to remain compatible with the thirty-two Mac users 
 who still run 10.4.

Thirty one now. I forgot to tell you I've finally retired my trusty G3
Wallstreet. Rest In Peace Gina, I'll miss you (but only until Apple
releases core i5/i7 MBPs). ;-)
___

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

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


IKImageBrowserView vs NSCollectionView and scaling

2010-02-15 Thread Trygve Inda
Is there any nice way to get NSCollectionView to scale its images the way
IKImageBrowserView does?

It is much easier to customize the item views with NSCollectionView and the
only thing really lacking is scaling of the subviews... It also binds a lot
nicer than IKImageBrowserView.

Thanks,

Trygve


___

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

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

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

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


Refresh com.apple.symbolichotkeys.plist

2010-02-15 Thread DeNigris Sean
Hi list,

Is there any way to cause the system to re-read 
com.apple.symbolichotkeys.plist.plist in Cocoa (or anywhere else)?  I want to 
programmatically change a shortcut (which is no problem), but I want it to take 
effect immediately.  System Preferences obviously signals the system to do this 
- does anyone know how it does that?

Thanks! 

Sean DeNigris



___

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

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