OutlineView please remember you selection

2008-03-30 Thread Adam Gerson
I have an OutlineView bound to an NSTreeController. I would like to
set the selected row of the OutlineView at the applications launch to
the second row. It defaults to the first. I have tried many
combination of the code below to no avail. If I trigger the code from
a button it works just fine. Something happens at launch time to
override these commands. Sometimes at app launch it even chooses the
second row and then I see it switch back to the first row before my
eyes. I have tried this code in awakeFromNib and
applicationDidFinishLaunching.


NSError *error;
[treeController fetchWithRequest:nil merge:NO error:&error];

[treeController setSelectionIndexPath:[NSIndexPath indexPathWithIndex:1]];

[outlineView selectRow:1 byExtendingSelection:NO];
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: machine with null serial number?

2008-03-30 Thread Justin McKillican



On Fri, 28 Mar 2008, Mike wrote:

Or it is a prototype machine from Apple that was never a real production 
machine but that got out into the wild somehow. When I worked there, all the 
prototype machines used to have their serial # (and other firmware info) 
missing.


-m
==

Kenny Leung wrote:
This is a G5 machine, so it must be new enough. Maybe it has been in for 
repairs. Thanks for the tip!


-Kenny


On Mar 28, 2008, at 3:33 PM, Horst Hösel wrote:

Hi All.

I am working on a software licensing system that keys itself to the 
serial # of a particular machine. This has been working fine, except we 
bumped into a machine with no serial #. It even shows as a blank on Apple 
System Profiler. Has anybody bumped into this, or know the reason why a 
machine might have no serial #?


Thanks!

-Kenny


Two possible reasons I know of, there might be more!

- The mainboard has been replaced, but someone forgot to 'burn' a serial 
number into it. (Seen that a few times)
- The machine is too old (meaning before the first G3 machines, probably 
not an issue any more)


HTH,
Horst



___

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

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

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


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]

[Apple Example] NSOutlineView

2008-03-30 Thread Adam Gerson
I just came across this great Apple NSTreeController / NSOutlineView example.

It incorporates a lot of 10.5 style techniques into one example.

-Image and text cells
-iTunes like groups in OutlineView
-10.5 Window styles
-CoreAnimation

If this is comenly known I appologize, but I have spent a lot of time
trying to figure some of this stuff out on my own. I figured others
could benefit from a nice example.

http://developer.apple.com/samplecode/SourceView/index.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 [EMAIL PROTECTED]


Re: NSOutlineView / NSSplitView redraw delay

2008-03-30 Thread Adam Gerson
I had some problems with OutlineView and SplitView redraws. I switched
over to RBSplitView and its worked great since. I think the general
consensus is that NSSplitView can behave strangely.

http://www.brockerhoff.net/src/rbs.html

Adam


On Sat, Mar 29, 2008 at 7:57 PM, Milen Dzhumerov <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  I've just noticed a small regression in my app. I've got an
>  NSOutlineView and an NSTableView inside an NSSplitView. Now, imagine
>  that the outline view has some text rows and I drag the splitter such
>  that the whole text in the outline is no longer visible. What used to
>  happen is that as soon as there was not enough space for the text to
>  be displayed, it would get truncated immediately. The problem now is
>  that the text in the outline view gets redrawn _after_ I release the
>  mouse button (from dragging the split divider). I must have
>  accidentally changed some settings but I tried checking them in IB and
>  I couldn't find anything that fixed it. Any suggestions what might be
>  delaying the refresh of the outline text?
>
>  Thanks,
>  Milen
>
>  PS. The lineBreakMode of the cell is properly set.
>  ___
>
>  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>  Please do not post admin requests or moderator comments to the list.
>  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>  Help/Unsubscribe/Update your Subscription:
>  http://lists.apple.com/mailman/options/cocoa-dev/agersonl%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa Tutoring in SF Bay Area

2008-03-30 Thread Adam Gerson
"CocoaHeads is a group devoted to discussion of Apple Computer's Cocoa
Framework for programming on MacOS X. During monthly meetings, members
present on their projects and offer tutorials on various programming
topics."

http://cocoaheads.org/us/SiliconValleyCalifornia/index.html


On Sat, Mar 29, 2008 at 12:50 PM, Brad Gibbs <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I'm new to Cocoa programming.  I have a specific application I would
>  like to create and feel I have a good idea of the application's
>  requirements, but I'm looking for advice on how to structure the code
>  most efficiently.  I'm hoping to meet with someone for an hour or two
>  initially to discuss the project and get some advice on how to proceed.
>
>  Are there any resources like this in the SF Bay Area?  The program
>  involves sending HTTP Posts to an RPC Server on a local network and
>  receiving and parsing responses.
>
>  Thanks in advance.
>
>  Brad
>  ___
>
>  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>  Please do not post admin requests or moderator comments to the list.
>  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>  Help/Unsubscribe/Update your Subscription:
>  http://lists.apple.com/mailman/options/cocoa-dev/agersonl%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Bloated NIB files

2008-03-30 Thread Andreas Schwarz
I'm having a problem with huge, bloated nib files using IB 3.0.  If I  
modify and save any of my older nib files, they jump from under 20k  
apiece to over 3 MB (in rare instances over 20 MB) apiece!


Viewing the contents of the keyedobjects.nib file reveals the bloat is  
coming from huge chunks of NSTIFFRepresentation data... What's it all  
doing in there? How do I get rid of it?


Thanks,
Andreas Schwarz
___

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

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

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

This email sent to [EMAIL PROTECTED]


scrollRangeToVisible from within mouseDown causing crash?

2008-03-30 Thread Ben Lachman
I just added a call to scrollRangeToVisible: that is sometimes called  
from my text view's mouseDown method.  Now, whenever  
scrollRangeToVisible: is called on a range that is not visible, the  
next drawRect of the text view crashes with the exception: "***  
NSLayoutManager, _getGlyphBuffer(): NSZoneMalloc  
failed!" (EXC_BAD_ACCESS).  I had assumed that this was just a memory  
management bug on my part, but the fact that I can basically turn the  
crash on or off based on whether I call scrollRangeToVisible has me a  
bit confused.  Anyone know what this could be?


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threads and Core Data, bindings results in view corruption

2008-03-30 Thread Ben Lachman

On Mar 29, 2008, at 11:48 PM, Jeff LaMarche wrote:

Are you using separate managed object contexts for each thread?  
According to the documentation here:


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


That's the way to do it - pass managed object IDs between threads,  
not managed objects, and when you're done, you can call  
refreshObject:mergeChanges: on the main thread's context with the  
objects that were changed, then call processPendingChanges on it.


He stated that using the 1 MOC/thread scheme doesn't work for his  
situation since in doing so you have to save: whenever you want to  
sync the MOCs in different threads.  I'm actually interested in this  
question as I just rewrote a chunk of my app to do things the 1 MOC/ 
thread way and have seen pretty crappy performance due to all the  
saving.  My UI is slightly more responsive but particularly on older  
(tiger) machines it really pegs the processor and disk with having to  
save so much and the actually task takes significantly longer.  The  
other issue is that when you spawn a new thread/MOC you have to build  
out any of the object graph that you'll need.  In my case that is a  
couple thousand objects and contributes to the performance hit as well.


So, the question still stands, is there a way to use CoreData driven  
bindings in a multithreaded app with a single managed object  
context?  Anyone?


->Ben

--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Mar 29, 2008, at 11:30 PM, David wrote:

I would think this is the normal typical case, but can't figure it  
out.
The UI should run on one thread, another thread should be used for  
time
consuming updates/generation of an object tree maintained using  
Core Data. I
have a NSOutlineView (via NSTreeController subclass) which  
displays the

object tree from Core data.

I can not figure out how to make this thread safe. I periodically  
get random
data showing up in the outline view while the core data object  
tree is being

updated.

I've tried locking the managedObjectContext when I make additions  
or changes
to the object tree, but I still get erroneous data showing up in  
the view.


I don't understand how NSTreeController and bindings are  
interacting with

Core data to extract the data while I'm populating it.

Any suggestions greatly appreciated.

I've been reading and rereading the Core Data programming guide and
Threading programming guide to no avail.

The Core data programming guide says its best to maintain a separate
managedObjectContext per thread. But this appears to require the  
data to be
written to persistent store to make it work (file). That not  
reasonable in

my case where I'm adding many objects to an object tree. It takes a
significant amount to time to write it out, negating the benefit  
of trying

to make the UI seem responsive.

I'm running Leopard.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Core Data Client/Server Application

2008-03-30 Thread Philip Bridson
Hi there,

Can core data be used to create a Client/Server type application? I heard that 
there are a few problems when accessing the persistent store via multiple 
clients.

Many thanks,

Phil.
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPredicate and Regexes

2008-03-30 Thread Romain Pechayre

Hi All,

I am new to both cocoa and regex, so I would not be surprised to see  
that I just did a silly mistake in the regex in the following code:


NSString* regexFormat=@"[+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z| 
0-9]*([+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|0-9]*)*";

NSString* equation =@"X1+2X2+3X3";

NSPredicate* regexTest=[NSPredicate predicateWithFormat:@"SELF MATCHES 
%@",regexFormat];

if ([regexTest evaluateWithObject:equation] == YES) {
NSLog(@"Equation OK");

} else{
NSLog(@"Bad format for equation in Objective");
NSLog(equation);
}

I want to match any linear equation using the regex regexFormat. It  
works in most cases ( ie, it matches what I want and does not match  
what I don't), except that it does match X1+2X2++3X3, which is quite  
worrying. In addition to this, it does not match neither X1+2X2++X3  
nor X1 +2X2++3.1X3.


I have done all the manipulations that came to my mind to check it and  
it looks like the presence of a integer ( and not floating)  
coefficient in front of a variable which is not the first one in the  
equation allows a double + in front of it. It also works with +- but  
does not work with more than two +.


Finally, I have tried it in python ( see code below ), and it does  
exactly what I want. Do you think there could be an issue with regexes  
using NSPredicate ?


Does anyone have a clue ?

Best regards,

rpechayr


Here the "equivalent" code in python :

#!/usr/bin/env python
# encoding: utf-8


import sys
import os
import re

def main():
	reg ='[+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|0-9]*([+-]?([0-9]*\.? 
[0-9]+)?[A-Z|a-z][A-Z|a-z|0-9]*)*'

prog=re.compile(reg)
result = prog.match('X1+2X2++1.00X3')
print result.group(0)

if __name__ == '__main__':
main()


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setMenuVisible

2008-03-30 Thread John Joyce

On 27.03.2008, at 08:24, Wesley Smith wrote:


I'm trying to make an NSWindow that takes up the entire screen
including the menu bar but is not actually a fullscreen window.  I
know this is possible with Carbon, but I can't figure it out with
Cocoa.  Whenever I call [NSMenu setMenuVisible:TRUE], the menubar  
goes

away, but so does my window.



maybe you really want  setMenuBarVisible:(BOOL)visible
NSMenu class method
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOutlineView / NSSplitView redraw delay

2008-03-30 Thread Milen Dzhumerov

Hi all,

I've found the problem and a solution. It didn't have anything to do  
with the NSSplitView but with the the column resizing of the  
NSOutlineView instance. What happens is that maybe for optimization  
reasons, during a live resize, the outline view only resizes the  
columns when it finishes with the resize (i.e., when I release the  
mouse button or during a live resize pause). But if you take a look at  
Mail.app's sidebar, it resizes immediately. The way I achieved the  
same effect is  by overriding -(BOOL)inLiveResize to always return NO  
- it works perfectly.


Milen

On 29 Mar 2008, at 23:57, Milen Dzhumerov wrote:
[snip] Any suggestions what might be delaying the refresh of the  
outline text?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Thread safe?

2008-03-30 Thread Thomas Engelmeier


On 29.03.2008, at 18:54, Adam R. Maxwell wrote:


Drawing into an NSImage is explicitly documented to be thread safe  
in the article you linked to, and each thread has its own graphics  
context.  The post I linked to does indicate that you might want to  
use [image setCacheMode:NSImageCacheNever].  If your goal is just to  
get an NSBitmapImageRep from a file, it's probably easier just to  
use +imageRepWithContentsOfFile:.


While it is documented to be thread save you might get crashes later  
when an NSBitmapImageRep created by drawing into from an secondary  
thread gets drawn itself. The crash occurs when the image tries to  
access an NULL (offscreen) window context (it probably was originally  
drawn into).


Tried to debug that on 10.5.2 (and simply worked around)...

Regards,
Tom_E


 
___


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

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

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

This email sent to [EMAIL PROTECTED]


CGDisplayReconfigurationCallBack

2008-03-30 Thread Trygve Inda
> void MyDisplayReconfigurationCallBack (
>CGDirectDisplayID display,
>CGDisplayChangeSummaryFlags flags,
>void *userInfo
> );
> 
> Your callback function should avoid attempting to change display
> configurations, and should not raise exceptions or perform a non-local return
> such as calling longjmp.

Does this mean I should stuff display and flags into a dict and use
something like

- (void)performSelector:(SEL)aSelector withObject:(id)anArgument
afterDelay:(NSTimeInterval)delay

How can I ensure a longjmp is not used here?

Thanks,

Trygve


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGDisplayReconfigurationCallBack

2008-03-30 Thread Jean-Daniel Dupas


It does not say to not use longjmp, it sais to not use longjmp to jump  
outside this function.


Just encapsulate your code in a @try / @catch()  block to ensure that  
even if an exception occurs (@throw use longjmp in the 32 bits  
runtime), it will jump in your catch block and not outside your  
callback.
In the same way, if you are using C++ call in the call back, you have  
to use a try/catch block to avoid that an exception trigger a non- 
local return.


Le 30 mars 08 à 15:31, Trygve Inda a écrit :


void MyDisplayReconfigurationCallBack (
  CGDirectDisplayID display,
  CGDisplayChangeSummaryFlags flags,
  void *userInfo
);

Your callback function should avoid attempting to change display
configurations, and should not raise exceptions or perform a non- 
local return

such as calling longjmp.


Does this mean I should stuff display and flags into a dict and use
something like

- (void)performSelector:(SEL)aSelector withObject:(id)anArgument
afterDelay:(NSTimeInterval)delay

How can I ensure a longjmp is not used here?

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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


How to add number do Dock Icon like in Mail?

2008-03-30 Thread Samvel
I'd like my application to show number of completed tasks in Dock Icon  
as it is done in Mail (number of unread emails). Anyone knows how to  
do that or where I can read about such functionality?


The idea is widely used by next applications:

Adium
Mail
iGetter
Transmission
XCode

They all add some number / text / progress bar to Dock Icon.

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


Re: How to add number do Dock Icon like in Mail?

2008-03-30 Thread Tony Becker

It's called "badging"

http://developer.apple.com/samplecode/DockTile/listing5.html

On Mar 30, 2008, at 10:42 AM, Samvel wrote:

I'd like my application to show number of completed tasks in Dock  
Icon as it is done in Mail (number of unread emails). Anyone knows  
how to do that or where I can read about such functionality?


The idea is widely used by next applications:

Adium
Mail
iGetter
Transmission
XCode

They all add some number / text / progress bar to Dock Icon.

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/aebecker%40mac.com

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Thread safe?

2008-03-30 Thread Adam R. Maxwell


On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote:


On 29.03.2008, at 18:54, Adam R. Maxwell wrote:


Drawing into an NSImage is explicitly documented to be thread safe  
in the article you linked to, and each thread has its own graphics  
context.  The post I linked to does indicate that you might want to  
use [image setCacheMode:NSImageCacheNever].  If your goal is just  
to get an NSBitmapImageRep from a file, it's probably easier just  
to use +imageRepWithContentsOfFile:.


While it is documented to be thread save you might get crashes later  
when an NSBitmapImageRep created by drawing into from an secondary  
thread gets drawn itself. The crash occurs when the image tries to  
access an NULL (offscreen) window context (it probably was  
originally drawn into).


Tried to debug that on 10.5.2 (and simply worked around)...


That's interesting.  Was it an NSBitmapImageRep or NSImage/ 
NSCachedImageRep?  I didn't think a bitmap context would be associated  
with a window context like that.  Either way it doesn't sound good,  
though.


--
adam


On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote:


On 29.03.2008, at 18:54, Adam R. Maxwell wrote:


Drawing into an NSImage is explicitly documented to be thread safe  
in the article you linked to, and each thread has its own graphics  
context.  The post I linked to does indicate that you might want to  
use [image setCacheMode:NSImageCacheNever].  If your goal is just  
to get an NSBitmapImageRep from a file, it's probably easier just  
to use +imageRepWithContentsOfFile:.


While it is documented to be thread save you might get crashes later  
when an NSBitmapImageRep created by drawing into from an secondary  
thread gets drawn itself. The crash occurs when the image tries to  
access an NULL (offscreen) window context (it probably was  
originally drawn into).


Tried to debug that on 10.5.2 (and simply worked around)...


That's interesting.  Was it an NSBitmapImageRep or NSImage/ 
NSCachedImageRep?  I didn't think a bitmap context would be associated  
with a window context like that.  Either way it doesn't sound good,  
though.


--
adam

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Thread safe?

2008-03-30 Thread Trygve Inda
> 
> On 29.03.2008, at 18:54, Adam R. Maxwell wrote:
>> 
>> Drawing into an NSImage is explicitly documented to be thread safe
>> in the article you linked to, and each thread has its own graphics
>> context.  The post I linked to does indicate that you might want to
>> use [image setCacheMode:NSImageCacheNever].  If your goal is just to
>> get an NSBitmapImageRep from a file, it's probably easier just to
>> use +imageRepWithContentsOfFile:.
> 
> While it is documented to be thread save you might get crashes later
> when an NSBitmapImageRep created by drawing into from an secondary
> thread gets drawn itself. The crash occurs when the image tries to
> access an NULL (offscreen) window context (it probably was originally
> drawn into).
> 
> Tried to debug that on 10.5.2 (and simply worked around)...

This will never be drawn to the screen, but will be saved to disk:

NSDictionary*imageProps = [NSDictionary dictionaryWithObject:[NSNumber
numberWithFloat:0.9] forKey:NSImageCompressionFactor];

NSData*imageData = [myImageRep
representationUsingType:NSJPEGFileType properties:imageProps];

[imageData writeToFile:path atomically:NO];

How did you work around this?

Basically I am opening a bitmap drawing an NSImage into it, then pixel-level
tweaking the bitmap, and saving it to disk as a jpg.

Trygve


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to set color file labels?

2008-03-30 Thread Piotr Adamski

Hi All.

Is there any way to change Finder color file label with use of Cocoa?  
I've managed to retrive it (with use of MDItemCopyAttribute) but have  
no idea how to change it. I've been googling around with no success,  
so I've decided to ask you.


Thanks.

Piotr Adamski || [EMAIL PROTECTED]
jabber : [EMAIL PROTECTED] || skype : piotr.adamski.





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPredicate and Regexes

2008-03-30 Thread Keary Suska
on 3/30/08 4:26 AM, [EMAIL PROTECTED] purportedly said:

> NSString* regexFormat=@"[+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|
> 0-9]*([+-]?([0-9]*\.?[0-9]+)?[A-Z|a-z][A-Z|a-z|0-9]*)*";
> NSString* equation =@"X1+2X2+3X3";

The compiler should have warned you about this: backslashes indicate escape
sequences, so all your '\.' become plain old '.' when the string is parsed.
You should instead use '\\.'. The NSPredicate examples show this.

I suspect that Python has quoting semantics like Perl, so the backslashes
aren't seen as escape sequences, as they would if the string was
double-quoted.

Best,

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


Re: How to set color file labels?

2008-03-30 Thread Adam R. Maxwell


On Mar 30, 2008, at 8:45 AM, Piotr Adamski wrote:

Hi All.

Is there any way to change Finder color file label with use of  
Cocoa? I've managed to retrive it (with use of MDItemCopyAttribute)  
but have no idea how to change it. I've been googling around with no  
success, so I've decided to ask you.


You'll need to use File Manager functions for this. See

https://tcobrowser.svn.sourceforge.net/svnroot/tcobrowser/trunk/bibdesk/vendorsrc/amaxwell/FileView/FVFinderLabel.m

for a Cocoa wrapper (near the bottom of the file).  Since Finder  
labels aren't indexed, using the File Manager directly is likely as  
fast as MDItem.  There's also a class there for a Finder label view  
that looks very similar to Finder's (10.5 only).


--
adam
On Mar 30, 2008, at 8:45 AM, Piotr Adamski wrote:

Hi All.

Is there any way to change Finder color file label with use of  
Cocoa? I've managed to retrive it (with use of MDItemCopyAttribute)  
but have no idea how to change it. I've been googling around with no  
success, so I've decided to ask you.


You'll need to use File Manager functions for this. See

https://tcobrowser.svn.sourceforge.net/svnroot/tcobrowser/trunk/bibdesk/vendorsrc/amaxwell/FileView/FVFinderLabel.m

for a Cocoa wrapper (near the bottom of the file).  Since Finder  
labels aren't indexed, using the File Manager directly is likely as  
fast as MDItem.  There's also a class there for a Finder label view  
that looks very similar to Finder's (10.5 only).


--
adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: weak linking

2008-03-30 Thread Gerriet M. Denkmann


On 30 Mar 2008, at 01:47, [EMAIL PROTECTED] wrote:


I use in some Cocoa app a weak linked library.


[...]


if (weak_function == NULL)
{
NSLog(@"%s weak_function %p NULL", __FUNCTION__, weak_function );
}
else
{
NSLog(@"%s weak_function %p non-NULL", __FUNCTION__, weak_function );
}

The result without library is:
... weak_function 0x0 non-NULL

10.4.11, powerpc-apple-darwin8-gcc-4.0.1.


Without this line:
extern void weak_function() __attribute__((weak_import));
the compiler notices that weak_function is non-NULL during  
compilation and optimizes under the assumption that it will remain  
non-NULL even at run time.


Kind regards,

Gerriet.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Thread safe?

2008-03-30 Thread Jens Alfke


On 30 Mar '08, at 8:34 AM, Trygve Inda wrote:


How did you work around this?

Basically I am opening a bitmap drawing an NSImage into it, then  
pixel-level

tweaking the bitmap, and saving it to disk as a jpg.


You might want to drop down a level and use CGImage for your bitmap.  
CG is stateless (the graphics context is passed in to every drawing  
call) and doesn't do the types of offscreen caching that NSImage does,  
so it's more likely to be thread-safe.


You can use Cocoa graphics calls to draw into GCImages ... the recipe  
was discussed here in the last week or two, though I don't remember  
the details. You need to get a CG graphics context for drawing into  
the image, then make it the current NSGraphicsContext. (The books on  
Quartz 2D graphics probably discuss this too.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Thread safe?

2008-03-30 Thread glenn andreas


On Mar 30, 2008, at 12:02 PM, Jens Alfke wrote:



On 30 Mar '08, at 8:34 AM, Trygve Inda wrote:


How did you work around this?

Basically I am opening a bitmap drawing an NSImage into it, then  
pixel-level

tweaking the bitmap, and saving it to disk as a jpg.


You might want to drop down a level and use CGImage for your bitmap.  
CG is stateless (the graphics context is passed in to every drawing  
call) and doesn't do the types of offscreen caching that NSImage  
does, so it's more likely to be thread-safe.




Or drop down just a step to just use NSBitmapImageRep instead of  
NSImage which avoids all the caching issues (since you never make an  
NSImage).  It is very well suited for "pixel level work that is saved  
in a file" (since you'll need it to do NSBitmapImageRep's  
representationUsingType: properties: to get the data for a JPG or PNG  
file anyway).


The only slightly tricky part is that if you want to draw in it (using  
the standard drawing routines, as opposed to custom pixel access  
stuff), you'll need to make a context using NSGraphicContext's  
graphicsContextWithBitmapImageRep and then set that as the current  
context.


Graphics contexts are thread safe (there is one for each thread) so  
there's no problem with threading.  I've used this approach without a  
problem (and my rendering stuff is highly threaded - not just multiple  
threads rendering different things into different files, but each  
renderer can be multi-threaded as well)



Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium2 | build, mutate, evolve, animate  | images, textures,  
fractals, art



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSFileHandle / NSConcreteFileHandle problem

2008-03-30 Thread Jeff LaMarche
I'm having an unusual problem with an NSFileHandle. I'm creating an  
NSFileHandle and initializing it with a file descriptor that's  
actually a network socket. I'm able to send and receive data using it  
and it works fine. Then, I pass the NSFileHandle instance as the first  
argument of an NSInvocation call


[invocation setArgument:fh atIndex:2];

When I invoke the invocation, it calls my method with the file handle  
as the first argument, exactly as it's supposed to, BUT, the file  
handle doesn't work. I get the following message in the console when  
my code tries to actually use it:


*** +[NSConcreteFileHandle writeData:]: unrecognized selector sent to  
class 0xa014ba80


The weird thing is, if I call:

[invocation target] performSelector:[invocation selector]  
withObject:fh];


it works just fine.

Does anyone have any idea what might be going on here? I've tried  
creating a new NSFileHandle and initializing it with the descriptor  
taken from the first argument, and I get the same result doing that.  
I'm able to work around the problem, but I'd still like to know if I'm  
doing something wrong.


TIA for any help anyone can offer.
Jeff
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSFileHandle / NSConcreteFileHandle problem

2008-03-30 Thread Jeff LaMarche


On Mar 30, 2008, at 3:30 PM, Jeff LaMarche wrote:

[invocation target] performSelector:[invocation selector]  
withObject:fh];


Actually, that would be:
[[invocation target] performSelector:[invocation selector]  
withObject:con];


missed a bracket when I copied and pasted :)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Thread safe?

2008-03-30 Thread Trygve Inda

> Or drop down just a step to just use NSBitmapImageRep instead of
> NSImage which avoids all the caching issues (since you never make an
> NSImage).  It is very well suited for "pixel level work that is saved
> in a file" (since you'll need it to do NSBitmapImageRep's
> representationUsingType: properties: to get the data for a JPG or PNG
> file anyway).

I am not using NSImage - except to draw an existing file into my premade
NSBitmapImageRep. Is there a way to draw a jpg into this NSBitmapRep without
loading the jpg into an NSImage?

> The only slightly tricky part is that if you want to draw in it (using
> the standard drawing routines, as opposed to custom pixel access
> stuff), you'll need to make a context using NSGraphicContext's
> graphicsContextWithBitmapImageRep and then set that as the current
> context.

Yep - doing that.

Trygve


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Thread safe?

2008-03-30 Thread glenn andreas


On Mar 30, 2008, at 3:21 PM, Trygve Inda wrote:




Or drop down just a step to just use NSBitmapImageRep instead of
NSImage which avoids all the caching issues (since you never make an
NSImage).  It is very well suited for "pixel level work that is saved
in a file" (since you'll need it to do NSBitmapImageRep's
representationUsingType: properties: to get the data for a JPG or PNG
file anyway).


I am not using NSImage - except to draw an existing file into my  
premade
NSBitmapImageRep. Is there a way to draw a jpg into this  
NSBitmapRep without

loading the jpg into an NSImage?



Yes - NSBitmapImageRep's can be init'ed with NSData (the contents of  
a jpg) and being a subclass of NSImageRep, can be drawn using  
drawAtPoint or drawInRect.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to set color file labels?

2008-03-30 Thread Gerriet M. Denkmann


On 30 Mar 2008, at 17:49, [EMAIL PROTECTED] wrote:



Is there any way to change Finder color file label with use of Cocoa?


No. But there is FSSetCatalogInfo. Can be used from Cocoa.

Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSFileHandle / NSConcreteFileHandle problem

2008-03-30 Thread Boaz Stuller
You have to pass a pointer to the object pointer not the object pointer
itself, i.e &fh not fh, when adding arguments to an invocation.  So, the
correct call is:
[invocation setArgument:&fh atIndex:2];
Because objective-c objects' memory layout begin with a pointer to the
object's class, what actually occurred is that you set the argument to the
object's class rather than the object itself.  That's why the error message
looks mostly correct, with only a subtle '+' instead of the '-' in front to
indicate it was interpreted as a class method.

Best wishes,
Bo

On Sun, Mar 30, 2008 at 3:30 PM, Jeff LaMarche <[EMAIL PROTECTED]>
wrote:

> I'm having an unusual problem with an NSFileHandle. I'm creating an
> NSFileHandle and initializing it with a file descriptor that's
> actually a network socket. I'm able to send and receive data using it
> and it works fine. Then, I pass the NSFileHandle instance as the first
> argument of an NSInvocation call
>
> [invocation setArgument:fh atIndex:2];
>
> When I invoke the invocation, it calls my method with the file handle
> as the first argument, exactly as it's supposed to, BUT, the file
> handle doesn't work. I get the following message in the console when
> my code tries to actually use it:
>
> *** +[NSConcreteFileHandle writeData:]: unrecognized selector sent to
> class 0xa014ba80
>
> The weird thing is, if I call:
>
> [invocation target] performSelector:[invocation selector]
> withObject:fh];
>
> it works just fine.
>
> Does anyone have any idea what might be going on here? I've tried
> creating a new NSFileHandle and initializing it with the descriptor
> taken from the first argument, and I get the same result doing that.
> I'm able to work around the problem, but I'd still like to know if I'm
> doing something wrong.
>
> TIA for any help anyone can offer.
> Jeff
> ___
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


simple table column bindings

2008-03-30 Thread Gareth Davis

hi,

I'm having some trouble with completing a simple proof of concept app.  
The requirement is to process a simple xml document and display the  
results in a two column table.


I've managed to load the xml and parse what I need from it into a  
bunch of "Movement" objects which I attempt to add to a  
NSArrayController. My table actually displays three records but only  
with the null placeholder. Some where along the lines the bindings  
I've specified for the two table columns are broken.


If any of you have 5 minutes a copy of my project is available at:

http://web.mac.com/gareth.davis/Misc/cocoa-dev/SignsDesktop1.tar.gz

(You'll have to forgive the "Foo" class, it seemed like a good name  
for the class a couple of days ago)


The app it's self is pretty simple, clicking the "load" button should  
populate the table with the data using the example.xml resource.


Any help would be gratefully received.

Thanks in advance
Gareth Davis

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSCollectionView: dynamic resizing of collection item subviews

2008-03-30 Thread Nick Toumpelis

Hi all,

I have a problem with NSCollectionView and its item subviews.

I don't seem to be able to resize dynamically a subview whatever I  
try. I'm trying to have different heights of subviews that are loaded  
dynamically but it appears that this is not possible.


Has anyone else encountered this problem? Is this a limitation of  
NSCollectionView?


Thanks,

Nick


Nick Toumpelis :: email:[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: simple table column bindings

2008-03-30 Thread Hamish Allan
Hi Gareth,

On Sun, Mar 30, 2008 at 10:42 PM, Gareth Davis
<[EMAIL PROTECTED]> wrote:

>  I've managed to load the xml and parse what I need from it into a
>  bunch of "Movement" objects which I attempt to add to a
>  NSArrayController.

Your array controller does not appear to have a content binding. You
are missing the M from your MVC :)

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data and NSOperation

2008-03-30 Thread Daniel Thorpe

Oh, sorry, I meant dependent not independent!

Using NSInvocationOperation looks as though it would work fine  
assuming that none of my calculations had any dependencies, which is  
not always true.  I'm currently working on a system that uses  
NSOperation objects as delegates for NSManagedObjects to perform the  
calculations, although I'm not sure if it will be possible to add the  
delegate of one object as a dependency of another object's delegate.


If it all works, then I'll reply back to the list in case anyone else  
needs to do anything similar.


Thanks for your help!

Cheers
Dan


On 29 Mar 2008, at 08:58, Quincey Morris wrote:


On Mar 28, 2008, at 22:56, Daniel Thorpe wrote:


Oooh, that might work...

But how do you assign independent operations using  
NSInvocationOperation objects?


I don't understand the question. Each NSInvocationOperation  
represents the independent execution of a method on an object in a  
thread, essentially. What other kind of independence are you looking  
for?

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to interrupt a long loop with command-period?

2008-03-30 Thread Matt Neuburg
On Sat, 29 Mar 2008 20:45:38 -0400, Duncan Champney <[EMAIL PROTECTED]> said:
>My app can create 3D views of the fractal images it creates.
>
>It has an option to save very large versions of these 3D views to disk
>as JPEGs or TIFFs. I generate the images as tiles, then assemble them
>and save the result to disk. For very large images this can take tens
>of seconds.
>
>I have a save panel that I display as a sheet on my 3D view, and I'm
>showing a progress bar on the save panel as I build the image for
>saving. My code has to call [progress_bar display] explicitly, since I
>don't visit the event loop while I'm generating my image.
>
>I'd like to be able to have the user press command-period/escape and
>quit the save in the middle.
>
>I thought I could check for key down events with a call like this:
>
>theEvent =  [[self window]
nextEventMatchingMask:(NSKeyDownMask)];
>
>But when I issue that call, everything comes to a halt until the user
>presses a key.
>
>I really want a "check the event queue for keyboard events" call that
>would let me pick command period or escape key events out of the
>applications event queue.
>
>I don't want to re-factor my code to return to the event loop if I can
>help it, both because it would be a fair amount of work, and because
>I'm using the OpenGL back buffer for my window to do my tiled
>rendering, and if the user makes changes to the window it would mess
>up my off-screen rendering. If I do have to re-factor my code to
>service the event loop I'll have to tear down the save panel sheet
>only to draw another save progress sheet in it's place, both as a
>place to show a progress bar, and to keep the user from messing up the
>save that's in progress. At least if I did that I could put a cancel
>button on it and be able to respond when the user clicks it.

I could be totally off base here, but what I do in this situation (and it
hasn't bitten me yet) is do the hard work in a thread. This leaves the main
event loop open. So, the user does whatever (press the Stop button, type Esc
or Command-period, etc.) and I hear about it immediately. I then raise a
flag (i.e. set a boolean). Meanwhile my hard-working code is periodically
checking that flag.

Now, there might be some reason why you can't do this (perhaps having to do
with your use of OpenGL), in which case just ignore that idea. m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


re: NSPersistentDocument Revert Question

2008-03-30 Thread Ben Trumbull

Mike,

Each persistent document has its own Core Data stack.  When you close 
one, and reopen it, it has a new NSPersistentStoreCoordinator, 
NSManagedObjectModel, and NSManagedObjectContext.


So any bindings to managed objects or their entity descriptions from 
the old, deallocated persistent document are effectively invalid.

--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Simple menu-action question

2008-03-30 Thread Rick Mann
In the mishmash of Cocoa tutorials and other docs I've read, I never  
seem to be led through the fundamentals. With Cocoa doing so much  
basic stuff for me, and Xcode stationery doing a bunch more, a few  
things seem to fall through the cracks.


I have a pretty straightforward document application (using Core  
Data). I want to add an "Import" command to the File menu. What's the  
right way to go about this? I figure it's very similar to how Open  
works, but since so much of Open is already implemented by the base  
classes, etc, it's hard to know how to duplicate it.


Any suggestions on an example to study? Thanks!

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data and NSOperation

2008-03-30 Thread Ben Trumbull

Daniel,

Each NSOperation is, conceptually, its own thread.  In addition to 
using NSInvocationOperation to easily dispatch a work function to an 
object, you'll also need to follow the multi-threading rules 
described in the Core Data Programming Guide.

--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Core Data migration

2008-03-30 Thread Ben Trumbull

David,


To sum up:
Relationships to entities from which another entity inherits are not
automatically set up properly.


Unfortunately.  This is a known issue.


Anyone have any experience with this, or know how to handle this
situation? I suppose I could write a whole bunch of custom code to
handle it, but it seems as if the migration system should handle the
inheritance.


I'll trade you a bug report for a work around.
--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: simple table column bindings

2008-03-30 Thread Milen Dzhumerov

Hi Gareth,

There were a couple of problems.

1) You should be calling [movements addObject:m] instead of [movements  
add:m]
2) You should set the class which the array controller manages in IB  
to Movement (the Classname text field)


After doing this, it all works.

Regards,
Milen

On 30 Mar 2008, at 22:42, Gareth Davis wrote:

hi,

I'm having some trouble with completing a simple proof of concept  
app. The requirement is to process a simple xml document and display  
the results in a two column table.


I've managed to load the xml and parse what I need from it into a  
bunch of "Movement" objects which I attempt to add to a  
NSArrayController. My table actually displays three records but only  
with the null placeholder. Some where along the lines the bindings  
I've specified for the two table columns are broken.


If any of you have 5 minutes a copy of my project is available at:

http://web.mac.com/gareth.davis/Misc/cocoa-dev/SignsDesktop1.tar.gz

(You'll have to forgive the "Foo" class, it seemed like a good name  
for the class a couple of days ago)


The app it's self is pretty simple, clicking the "load" button  
should populate the table with the data using the example.xml  
resource.


Any help would be gratefully received.

Thanks in advance
Gareth Davis

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/md207%40doc.ic.ac.uk

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


re: NSManagedObject Copy and Paste

2008-03-30 Thread Ben Trumbull

I have a question regarding implementing copy and paste with
NSManagedObjects--


You're more or less on the right track.  Here's an excerpt regarding 
moving values between threads which may help you with copy&paste:


At 8:22 AM -0700 3/1/06, [EMAIL PROTECTED] wrote:

The problem with insertions is that the brand new objects are not
accessible to other contexts until they are saved.  By accessible, I
mean semantically, as in their existence can't be communicated.
Until they are saved, the new objects don't have an identity (primary
key)

For updates and deletions, the objects have their permanent identity,
and you can use any of the standard Cocoa or OSX idioms for
communicating between threads to replicate those changes in a
different context.

Core Data doesn't have any additional routines for that.

However, Core Data offers the following on NSManagedObject:

- (NSDictionary *)committedValuesForKeys:(NSArray *)keys;  
- (NSDictionary *)changedValues;


Also, NSManagedObject is fully KeyValueCoding compliant, and KVC has
a number of handy methods for pushing and pulling batches of changes:

-(NSDictionary *)dictionaryWithValuesForKeys:(NSArray *)keys
- (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues


--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Core Data Client/Server Application

2008-03-30 Thread Ben Trumbull

Philip,

Core Data doesn't support client server applications.

Some developers have successfully used it on the client for its data 
management (undo, change tracking, notifications, etc) and Cocoa 
Bindings support, with an in-memory store they manage themselves.  A 
few developers have done more sophisticated things with a Core Data 
sqlite store that is effectively a cache of a subset of the server's 
database.


But there's no back end support for MySQL or Postgres besides what 
you do for yourself.

--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data faulting and bindings: recursive KVO notifications?

2008-03-30 Thread Ben Trumbull

Dennis,

Well, it might be far from ideal for CD performance, but that doesn't 
mean it's bound poorly.  It is done exactly to do what we need it to 
do, otherwise this binding would have been the first to be targeted 
for rewrite.


Creating a gigantic autoreleased NSArray from valueForKeyPath: and 
simultaneously observing tens of thousands of objects is an awful lot 
of work for little reward.


The user cannot *see* tens of thousands of things.

I really do require the app to be able to show the user the values of 
about 1000 items at once, e.g. for a stack of related items.  If they 
are the same for every item, it is important that that value be

visible to the user.


You want distinct values, not tens of thousands of them.  Too much 
data is unmanageable from a user experience perspective.


Since your data is mostly read only, observing all these values is a 
horrific waste.  Just get the distinct values once, and invalidate 
the cache in the rare case the user edits one of them.


And this is one thing Bindings as it is, cannot do properly:  The 
creation of all observation info (one dictionary for each bound 
property of each item in the selection) when selecting is just too 
much overhead.  Plus you easily encounter the aforementioned stack

overflow.


You should file a bug report on this.  Also, I still don't see a bug 
report for your earlier problem with KVO & faulting.



Properties should be propagatable to 1000 objects at once for my
users, as they work equally with individual images and up till 1000-
image stacks.


Your 30" monitor must be a lot larger than mine.

I guess this calls for an extra layer of indirection, 
with a real separate entity representing the image stack and 
propagating the changes, without having 1000s of observers-observed

object relationships.


Exactly. Now that's an idea that can scale.
--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Movable by window background AND custom NSView

2008-03-30 Thread vance

Hi,

I have a Textured Window with a NSView that has some custom drawing  
done in drawRect.


When I click and drag outside the custom NSView
The window moves
(That is exactly what is needed)

When I click and drag within the custom NSView
The window moves
The custom NSView receives the mouseDragged messages

Since I am overriding mouseDragged (and most other mouse related  
messages in NSResponder) I would expect for the custom NSView to only  
receive the messages and since I am not calling [super mouseX];  
the message should not get outside the NSView therefore the window  
should not move.


Clearly that is now what happens. The window moves when I click and  
drag within the custom view which is something we dont want to happen.


Does anyone understands what is the flow of mouse events and what to  
do to get around this?


Thank you,
Vance
___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Threads and Core Data, bindings results in view corruption

2008-03-30 Thread Ben Trumbull

David, Jeff, Ben

There are a few issues here.

First, enough pieces of AppKit and Cocoa Bindings are not thread safe 
that, even without Core Data, you just can't do this in this 
particular fashion.


If you want multi-threaded work with the view and controller classes 
in Cocoa, you'll need to perform your background operations, and 
communicate back to the main thread (view & controllers) via the run 
loop.  -performSelectorOnMainThread and its friends in NSThread.h are 
your best bet.


Using a run loop on a background thread and communicating from the 
main thread to it with the new 10.5 -performSelector... methods is 
often conceptually simpler (easier to debug) than many other 
threading patterns.


Sharing a MOC with Cocoa Bindings and a background thread will end in 
tears.  Cocoa Bindings doesn't lock its bound MOC, so you're 
basically SOL.


Even if it did work, though, it'd be a bad idea.  Sharing a MOC means 
a background thread would still at times block the main thread and 
SPOB your app.


These 3 points (can't work, doesn't work, shouldn't work) are why the 
Core Data Programming Guide says don't do this.


This isn't to say what what you intend to accomplish is wrong or 
undesirable. Quite the contrary.  Just that this 'how' is going in 
the wrong direction.



The Core data programming guide says its best to maintain a separate
managedObjectContext per thread. But this appears to require the data to be
written to persistent store to make it work (file). That not reasonable in
my case where I'm adding many objects to an object tree. It takes a
significant amount to time to write it out, negating the benefit of trying
to make the UI seem responsive.


The list archives also have these, which you should read:



It's possible to shuttle pending changes between threads by hand using KVC.

On Tiger, saves are especially expensive as the default behavior was 
to use a more correct/aggressive version of fsync, specifically 
fcntl(...,F_FULLFSYNC).  This is 100-1000x slower than fsync, which 
technically is incorrect on nearly all consumer grade hard drives at 
a hardware level.


On Leopard, we made significant performance optimizations, so the 
user experience can vary greatly between the two OS's.


If you're inserting a large number of new objects, you really should 
just batch the operation together, save, and present the user with 
new objects in the tree view in batches.


On Leopard, in the scenarios under which you can save, you can also 
use -mergeChangesFromContextDidSaveNotification:


While AppKit & Bindings makes it impossible to share a MOC with a 
background thread, theoretically all your background threads can 
share a MOC if you lock and unlock them.  Or you could just have 1 
background thread processing asynchronous operations.  That'd be a 
lot easier to debug.


You should also use the Debug libraries and Core Data multi-threaded 
assertions:



Life's a lot easier when your app halts in gdb as soon as you make a 
mistake.  'thread apply all bt' is your friend.


Finally, in 4 years no one has filed a bug about this.

If one developer has a problem, it's unfortunate.  If three 
developers have a problem, it's an issue.  If two hundred developers 
have a problem, it's a crisis.


Kinda hard to tell the difference if developers can't be bothered to 
speak up in the only way that really matters: bugerport.apple.com


Feature requests, performance problems, and enhancement suggestions 
are all "bugs"

--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threads and Core Data, bindings results in view corruption

2008-03-30 Thread Ben Lachman

Ben:

I was actually just uncovering some of this stuff myself.  In my  
particular case  I am mostly doing inserts so while the KVC stuff is  
interesting and very well may be useful at some point, it doesn't  
apply to my current situation.


My problem is that I receive data from a connection and process it in  
my one worker thread sequentially.  After each batch I save the  
worker thread's MOC and send a bunch of OIDs back to the main  
thread.  I think this is the approved way of doing things.  The  
issues lie in the fact that, depending on several things, batches  
often end up being rather small which makes saves rather frequent.   
Last night (morning) after posting I spent some time in shark and  
save: was burning up >50% of the time in my worker thread.  With a  
little work to coalesce batches and sleep instead of immediately  
exiting (in hope that a new batch might come in) I've gotten that  
number down to around 40%.  However this is still quite substantial  
and I'd like to get it down into the 25% range.  The trick is just  
trying to figure out ways to save less frequently, without letting  
the UI go too stale.  One of the biggest performance improvements so  
far has been to coalesce pending batches into a single larger  
batch... this makes the sorting behavior of my UI a bit more "chunky"  
than I'd like, but I think is acceptable as it cuts a second or so  
off the length to completion of normal searches.


I'm guessing the bugs really should be filed on the documentation  
since one page on performance of a highly complex API like CD is  
nowhere near enough.  My guess is that documentation doesn't get as  
many bugs as it should since it is, at the point of the developer  
filing the bug, no longer a road block and therefore is kind of seen  
(wrongly) as a waste of time since it is just for the greater good of  
the dev community not getting your project done.


Thanks for the feedback it was quite helpful.  Any thoughts or tricks  
to reduce the frequency of saving in worker threads would be welcome,  
but I think I'm now on the right path.


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Mar 30, 2008, at 9:50 PM, Ben Trumbull wrote:

David, Jeff, Ben

There are a few issues here.

First, enough pieces of AppKit and Cocoa Bindings are not thread  
safe that, even without Core Data, you just can't do this in this  
particular fashion.


If you want multi-threaded work with the view and controller  
classes in Cocoa, you'll need to perform your background  
operations, and communicate back to the main thread (view &  
controllers) via the run loop.  -performSelectorOnMainThread and  
its friends in NSThread.h are your best bet.


Using a run loop on a background thread and communicating from the  
main thread to it with the new 10.5 -performSelector... methods is  
often conceptually simpler (easier to debug) than many other  
threading patterns.


Sharing a MOC with Cocoa Bindings and a background thread will end  
in tears.  Cocoa Bindings doesn't lock its bound MOC, so you're  
basically SOL.


Even if it did work, though, it'd be a bad idea.  Sharing a MOC  
means a background thread would still at times block the main  
thread and SPOB your app.


These 3 points (can't work, doesn't work, shouldn't work) are why  
the Core Data Programming Guide says don't do this.


This isn't to say what what you intend to accomplish is wrong or  
undesirable. Quite the contrary.  Just that this 'how' is going in  
the wrong direction.



The Core data programming guide says its best to maintain a separate
managedObjectContext per thread. But this appears to require the  
data to be
written to persistent store to make it work (file). That not  
reasonable in

my case where I'm adding many objects to an object tree. It takes a
significant amount to time to write it out, negating the benefit  
of trying

to make the UI seem responsive.


The list archives also have these, which you should read:



It's possible to shuttle pending changes between threads by hand  
using KVC.


On Tiger, saves are especially expensive as the default behavior  
was to use a more correct/aggressive version of fsync, specifically  
fcntl(...,F_FULLFSYNC).  This is 100-1000x slower than fsync, which  
technically is incorrect on nearly all consumer grade hard drives  
at a hardware level.


On Leopard, we made significant performance optimizations, so the  
user experience can vary greatly between the two OS's.


If you're inserting a large number of new objects, you really  
should just batch the operation together, save, and present the  
user with new objects in the tree view in batches.


On Leopard, in the scenarios under which you can save, you can also  
use -mergeChangesFromContextDidSaveNotification:


While A

Re: Simple menu-action question

2008-03-30 Thread Graham Cox
I'm not sure if using Core Data would make a difference, but I'd just  
do this by responding to the menu command by putting up an NSOpenPanel  
then processing the filename it returns appropriately. I don't think  
there's any magic "proper" way to do this within the document  
architecture, except for...


Just list the file types (UTIs) that you can open in your info plist  
and map them to different NSDocument subclasses (if indeed a different  
document type is used for each different file type) or map different  
UTIs to the same class and differentiate the file type passed in the  
document's -readFromURL:ofType:error: method. This latter approach  
means you don't even need an "Import" menu, it just integrates into  
the existing Open file menu, which is more user friendly in my book -  
it "just works" rather than the user having to worry about what  
"Import" really means and whether, why and when they need to use it.



--
S.O.S.



On 31 Mar 2008, at 10:57 am, Rick Mann wrote:
In the mishmash of Cocoa tutorials and other docs I've read, I never  
seem to be led through the fundamentals. With Cocoa doing so much  
basic stuff for me, and Xcode stationery doing a bunch more, a few  
things seem to fall through the cracks.


I have a pretty straightforward document application (using Core  
Data). I want to add an "Import" command to the File menu. What's  
the right way to go about this? I figure it's very similar to how  
Open works, but since so much of Open is already implemented by the  
base classes, etc, it's hard to know how to duplicate it.


Any suggestions on an example to study? Thanks!

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


unpacking binary data

2008-03-30 Thread C Sandeep
Greetings,

 Im working on an cocoa application that needs to, among other things,
unpack binary data, into NSString preferably. I have used perl's
unpack (http://perldoc.perl.org/functions/unpack.html) in the past to
do such a thing. I have looked at NSData's documentation, however Im
at a loss on how to accomplish the same. Any help is greatly
appreciated. Thanks.

- Sandeep
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CAOpenGLLayer

2008-03-30 Thread John Harper

Hi,

On Mar 29, 2008, at 9:01 AM, Stefan Hafeneger wrote:
I would like to use CAOpenGLLayer instead of NSOpenGLView. I didn't  
find any example source code but got it working. I implemented

…
The API documentation says that the viewport is already set to  
bounds size before drawInCGLContext:... is called and that I should  
disable all OpenGL settings that I enabled before. I don't  
understand why.


I don't either, there's no reason for you to undo any changes to the  
context you made before returning from your draw method. With the  
default implementation of the -copyCGLContextForPixelFormat: method  
you are guaranteed to have exclusive access to the OpenGL context  
until it's destroyed.




I would like to setup my OpenGL context once (as with NSOpenGLView)  
and set the perspective only if the bounds change. I tried to set  
the perspective (gluPerspective) in copyCGLContextForPixelFormat:...  
but this didn't work (I set the currect context to the new OpenGL  
context and also locked the context).


Assuming you didn't override -copyCGLContextForPixelFormat: (e.g. to  
share a single context between multiple layers) that should work, but  
only until the window hosting the layer moves to a different display.  
When that happens the layer's display mask may change and the layer  
will release the original context and create a new one. You can detect  
this by overriding either the -releaseCGLContext: or - 
releaseCGLPixelFormat: method and recording that you need to reload  
all your OpenGL state next time you draw.


btw, it's not necessary for you to set the current context and lock  
it, CAOpenGLLayer will make sure the context passed to the draw method  
is current and locked.


John


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: unpacking binary data

2008-03-30 Thread stephen joseph butler
On Sun, Mar 30, 2008 at 10:23 PM, C Sandeep <[EMAIL PROTECTED]> wrote:

>  Im working on an cocoa application that needs to, among other things,
> unpack binary data, into NSString preferably. I have used perl's
> unpack (http://perldoc.perl.org/functions/unpack.html) in the past to
> do such a thing. I have looked at NSData's documentation, however Im
> at a loss on how to accomplish the same. Any help is greatly
> appreciated. Thanks.


Look at  -[NSString initWithData:encoding:]. Or, if you only need a range of
the bytes, -[NSString initWithBytes:length:encoding:].
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threads and Core Data, bindings results in view corruption

2008-03-30 Thread Ben Trumbull


On Mar 30, 2008, at 7:50 PM, Ben Lachman wrote:

I'm guessing the bugs really should be filed on the documentation  
since one page on performance of a highly complex API like CD is  
nowhere near enough.  My guess is that documentation doesn't get as  
many bugs as it should since it is, at the point of the developer  
filing the bug, no longer a road block and therefore is kind of seen  
(wrongly) as a waste of time since it is just for the greater good  
of the dev community not getting your project done.


There are two sets of bugs you should file.  (1) better documentation  
for the current state of affairs and (2) better support for your work  
pattern in a future version of the framework.


Developers need to file their own bugs.

There are several reasons for that.  First, to be able to check the  
status of an issue and track it over however long it takes to get  
fixed. Second, to be accessible to ADC for follow ups, clarifications  
in case we can't reproduce it, or receiving work arounds for known  
issues.   Especially since once in a while, you might actually get  
back a work around that's better than what you came up with yourself.   
Of course, filing the issue before spending lots of time developing a  
workaround might also save you some effort once in a while.


And so my shadowy masters actually believe real live developers have  
this problem, as opposed to my imaginary friends.  Oddly "20  
developers requested this" seems to work better than  "we should spend  
lots of time on this because I feel like it"


And that just covers the problems we already know about.  There are a  
few more reasons for filing bugs you've worked around ...


Thanks for the feedback it was quite helpful.  Any thoughts or  
tricks to reduce the frequency of saving in worker threads would be  
welcome, but I think I'm now on the right path.



Batching and coalescing are both good ideas, so you're on the right  
track.  Your other alternative is a proxy object for inserts, as I  
describe in one of the list archived messages I referenced earlier.


You could also consider evaluating whether or not requiring Leopard  
makes sense for your customer base.  At some point, there's a  
diminishing return on your effort to address a problem that $130 can  
mitigate.  A compromise is to not perform the same threading on Tiger,  
or not in the same way, and accept a somewhat different user  
experience on older systems.


- Ben

___

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

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

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

This email sent to [EMAIL PROTECTED]


Trying to contact Cathy Shive (again)

2008-03-30 Thread John Musbach
We're still working on the Moire project together, unfortunately I've
again lost contact with her and have not received any replies to my
correspondence for 10 days or so now. Pinging her here in case gmail's
getting caught in her spam filter or somesuch, hope everything's ok...
:)

-- 
Best Regards,

John Musbach
___

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

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

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

This email sent to [EMAIL PROTECTED]


Making a window fit its contents?

2008-03-30 Thread Jack Repenning
How can I [someNSTextField setStringValue:someString] (to some value I  
only learn at run time), and then resize the window that contains it  
so the string is visible?  Or, is there something I can set in  
Interface Builder that will make this resize happen automatically?


I found a sizeToFit in the NSTextField, but not on the surrounding  
NSWindow or NSView.


-==-
Jack Repenning
Chief Technology Officer
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
office: +1 650.228.2562
mobile: +1 408.835.8090
raindance: +1 877.326.2337, x844.7461
aim: jackrepenning
skype: jackrepenning





___

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

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

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

This email sent to [EMAIL PROTECTED]


Modify Input in NSTableView

2008-03-30 Thread K. Darcy Otto
I'm working on an application in which users enter data into a table,  
but I need to substitute a greater-than symbol (>) for a right-arrow  
symbol (→, unicode: 2192) as the user presses they key (or copies the  
text, or whatever).  After looking at the docs and this list, I'm not  
much closer to determining the best way to do this (or even how to do  
it).  So far, I have been thinking I have to do something with  
NSWindow and the fieldEditor; perhaps setting the window's field  
editor to be a particular NSTextView, and implement some method in  
that text view  (insertText:?) to make the substitution.  I take it  
that working with keyDown: would not be the best approach.  Would this  
be on the right track?  Any help would be appreciated.___


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

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

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

This email sent to [EMAIL PROTECTED]