Re: problems with CAAnimation - SOLVED (kinda)

2009-03-20 Thread Graham Cox


On 20/03/2009, at 10:39 AM, mm w wrote:


your design simply sucks, you don't understand the library
I cannot help you on  this, I am not Jesus and I cannot save all  
people who
are pretending to program, once again I did complex design with CA  
related API,

and I have never been stuck in this kind of issue, so I let you think,
nobody can solve
your issue you took the wrong way



There is absolutely no call for this sort of language. If you are  
unable to help, you are not obliged to reply. Mounting personal  
attacks on people is not helpful in any way - do you think anyone is  
going to be impressed by your supposed "superior" knowledge with this  
attitude? No-one is asking or expecting you to "save" them, so quit  
with the God complex, hmmm?


There is a wide spread of expertise on this list, including many  
beginners. Attacking them with phrases such as "pretending to program"  
is not going to assist them and just makes you look like a dickhead.  
Not only that, but where you have made an attempt to offer actual  
advice, it has been hilariously wrong, which completely undermines  
your self-made claim of being such a clued-up programmer. If you want  
respect, earn it kiddo.



--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: Banding/smoothing problem with drawing angled gradients.

2009-03-20 Thread Graham Cox


On 20/03/2009, at 2:57 PM, Phi Le wrote:


Hello,

I want to draw angled gradients with multiple sharp transitions using
NSGradient. I am not getting very smooth transitions between the
colors. Please take a look at my attachment to see the problem.   Are
there solutions without having to use NSShading?



Is the problem the "step" effect you're seeing with small angles?

If so, you could try drawing the gradient always in a fixed direction  
(0 degrees) and using the current transform to set the angle. It might  
turn out that gives a better anti-aliasing effect than relying on the  
gradient angle (which appears to be anti-aliasing only across  
horizontal scanlines and not vertical). Of course the gradient might  
be simply using a transform internally so it might not help, but it's  
worth a try.


Another alternative is to render the gradient into a bitmap at some  
larger size - say 4x the final output, then scale the bitmap down to  
the final destination. That should blend out the artifacts you're  
seeing though expect this approach to be quite a lot slower to draw.


--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: How do you store an NSArray as an attribute in a Core Data entity

2009-03-20 Thread tmowlem

On Mar 19, 2009, at 1:26 AM, tmow...@talktalk.net wrote:

>> I want to store a list of Strings as an attribute of an entity in  
>> Core Data but there doesn't appear to be a way to use NSArray (or  
>> NSSet or NSDictionary either) as an attribute.?Please can someone  
>> explain how you use an NSArray or NSDictionary as an attribute of a  
>> Core Data entity?

> In general, if you want to have multiple things as an attribute of a  
> Core Data entity, what you really want is a to-many relationship with  
> another entity.

> Let's take tags as an example.  Say I'm creating a weblog editor and I  
> want the ability to tag my posts.  I could model this as a string  
> attribute with some specific format (space- or comma-separated), or as  
> a transformed attribute.  However, that doesn't get me the ability to  
> do things like say "show all the posts with this tag" or even "auto- 
> complete known tags."  It also leads to persistent store bloat because  
> I'm breaking a cardinal rule of relational data, "store each piece of  
> data once," because each tagged post winds up with a copy of the tag's  
> text.

> Instead of having an attribute, I would model a to-many relationship  
> from my Post entity to my new Tag entity, with a to-many inverse  
> relationship from my Tag entity to my BlogPost entity.  This way:

> Each Tag instance only exists once in the persistent store.
> I can traverse the object graph between Posts and Tags, and between  
> Tags and Posts, with ease.
> I can perform interesting queries across both Posts and Tags to  
> improve my user experience (e.g. support auto-completion or generate  
> tag clouds).

> Not having Tags stored directly on Posts means if I'm just dealing  


> with a Post, Core Data won't bother fetching the Tags too.
>
> Entities and relationships are good, hope this helps you leverage them!
>
>  -- Chris



Hello Chris,






Thank you for your prompt help. As you say a one-to-many relationship is 
indicated in?

your example and indeed is what I am after for a similar application to your 
example.?




In Core Data though you can only use entities in relationships so you can't 
directly use?

NSString or other foundation objects in a relationship property. My thinking 
was that it?

seems pointless to create an entity which contains a string rather than using a 
NSString directly.




However thinking further I believe I read that an instance of NSManagedObject 
basically?

looks up the fields for the entity that is is representing in the corresponding 
NSEntityDescription?

then just uses KVC for those properties, so I guess an entity with a single 
string instance variable?

is a thin wrapper anyway. So Apple's design here makes sense.




Another poster has suggested using transformable attributes which probably 
works because?

the default value transformer transforms objects that are NSCoding compliant 
according to the?

Core Data programming guide, which NSArray and NSString are. I should have read 
this more carefully.


Thank you for clarifying for me.





Regards,




Tim Mowlem

___

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

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

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

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


Re: How to debug this...

2009-03-20 Thread Mark Ritchie

On 20-Mar-09, at 1:04 AM, Alex Kac wrote:

1   CoreFoundation  0x3023c326 CFRelease + 58
2   Foundation	0x3066fe04 -[NSCFDictionary  
release] + 2

3   CoreFoundation  0x3023c326 CFRelease + 58
4   Foundation	0x3066fe04 -[NSCFDictionary  
release] + 2


Do you know which version of Mac OS X was running to produce this  
backtrace?
I built a test case and looked at what happens during CFRelease  
however it didn't line up to above.

I'm running OSX, 10.5.6 with Xcode 3.1.2.

Regards!
Mark
__
Mark Ritchie
Cocoa and WebObjects Developer
Diamond Lake Consulting Inc.
Toronto, Ontario, Canada



___

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

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

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

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


Re: NSTableView updating checkboxes

2009-03-20 Thread Jo Phils
Hi Graham and thank you very much for your reply.  I think I'm still a bit 
confused I do apologize. :-(  Here's my code so far so you can see...

- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return[filenamescount];
}

- (id)tableView:(NSTableView *)aTableView
  objectValueForTableColumn:(NSTableColumn *)aTableColumn
  row:(NSInteger)rowIndex
{
if([[aTableColumn identifier] isEqualToString:@"column2"])
{
return[NSNumbernumberWithInt:NSOnState];
}
return [filenames objectAtIndex:rowIndex];
- (void)tableView:(NSTableView *)aTableView
  setObjectValue:(id)anObject
  forTableColumn:(NSTableColumn *)aTableColumn
  row:(int)rowIndex
{
// This is where I'm stuck!
}

And in this code I am using my variable which is a list of filenames...

NSMutableArray*filenames;

Other than the connections I have in IB I have given this column of checkboxes 
the Identifier "column2" in IB.  I have not set any other property key like you 
mentioned and I'm not sure where I would do that?  I'm not using bindings in my 
case...I was under the impression it was not necessary?  The first 2 methods 
seem to work fine and the 3rd method is being called but it's just I couldn't 
figure out the code to change the state of the checkboxes...

Thank you again so much for your help,

Rick





From: Graham Cox 
To: Jo Phils 
Cc: cocoa-dev@lists.apple.com
Sent: Friday, March 20, 2009 1:56:36 PM
Subject: Re: NSTableView updating checkboxes


On 20/03/2009, at 4:43 AM, Jo Phils wrote:

> I am still a Cocoa beginner and looking for some help.  Based on Using a 
> Table Data Source in the Table View Programming Guide I have initiated my 
> Table View with 2 columns...one for filenames and one for checkboxes 
> (NSButtonCell).  Everything is fine except this method:
> 
> - (void)tableView:(NSTableView *)aTableView
>setObjectValue:anObject
>forTableColumn:(NSTableColumn *)aTableColumn
>row:(int)rowIndex
> 
> I can't seem to get the right syntax to tell my Table View to toggle the 
> state.  I am able to initiate my Table View with the checkboxes in the ON 
> state (other method) but this method is where I'm stuck.  My source is a 
> NSArray *filenames and my table column is "column2."  If someone could help 
> show me how to code this I would appreciate it very much not just to get me 
> passed this point but also so I can learn what I'm doing wrong. :-)


You don't actually state clearly what the problem is, but there is a minor 
error above:

>setObjectValue:anObject

should be:

>setObjectValue:(id) anObject

is that it?

I believe that types left out default to  so it may not be. If your 
question is "how do I toggle the state of something in my data model when the 
checkbox is changed?" then this may help:


- (void) tableView:(NSTableView*) tv setObjectValue:(id) objectVal 
forTableColumn:(NSTableColumn*) column row:(int) rowIndex
{
id someObject;

someObject = [[self dataModel] objectAtIndex:rowIndex];

[someObject setValue:objectVal forKey:[column identifier]];
}

where [column identifier] returns the string which is the property key for the 
boolean property of interest that the checkbox is representing. You set this in 
IB, e.g. @"myBooleanProperty"


--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: How to debug this...

2009-03-20 Thread Alex Kac
2.2 and 2.21 mostly. As I said - I can't reproduce this. I only get  
crash logs from users with it. I'm just trying to get some idea of  
what it could be.


On Mar 20, 2009, at 4:57 AM, Mark Ritchie wrote:


On 20-Mar-09, at 5:32 AM, Alex Kac wrote:
iPhone OS :) And normally I'd ask on the iPhone Dev Forums, but  
this is more of a cocoa question I think as its not Cocoa Touch  
Related.


Ah, ok.  And which version of iPhone OS?
I moved my test case to an iPhone app and ran it on version 2.2  
however, again things don't line up.

Thanks!
M.


Alex Kac - President and Founder
Web Information Solutions, Inc.

"The person who is not hungry says that the coconut has a hard shell."
-- African Tribal Saying





___

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

Please do not post admin requests or moderator comments to the list.
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: NSCell with URL

2009-03-20 Thread Alexander Spohr


Am 20.03.2009 um 15:02 schrieb Charles Romestant:


But I don't see how to do this.
I tried NSAttributedString but its painfully slow ( seems that (id
)tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn
*)tableColumn
row:(int)row is called on every refresh resize of the page),
plus i did not get to put the URL in there either, just some colours.

What would be the proper way to go about this.



First, make the above method fast! That thing has to be fast, as it  
will be called every time the data changes. Cache your contents /  
NSAttributedStrings in an NSArray.


Only after that method is really fast think about how to get your cell  
to do what you want.


atze

___

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

Please do not post admin requests or moderator comments to the list.
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: NSScrollView like iTunes

2009-03-20 Thread Citizen

On 20 Mar 2009, at 06:35, Graham Cox wrote:

On 20/03/2009, at 5:29 PM, Chris Purcell wrote:

I'm trying to create a view similar to the left iTunes bar (http://i39.tinypic.com/2hwp7w5.png 
) and many other apps (Mail, iCal, etc.).  Is this a NSScrollView  
or NSOutlineView?  Or am I going about this the wrong way.


It's a NSOutlineView (within a NSScrollView) set to use "source  
list" appearance with some custom cells


Apple has some sample code here:
http://developer.apple.com/samplecode/SourceView/index.html

Dave
--
David Kennedy (http://www.zenopolis.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


asl_search abysmally slow

2009-03-20 Thread Gerriet M. Denkmann


I am trying to access the Apple System Log facility.

char *lastMessageId = "765123";

aslmsg q = asl_new(ASL_TYPE_QUERY);
asl_set_query(q, kAslMessageId, lastMessageId, ASL_QUERY_OP_GREATER |  
ASL_QUERY_OP_NUMERIC );
aslresponse r = asl_search( NULL, q);	// r will contain all messages  
after 765123


Works fine, if the asl database is small. But with about 200 000  
messages in asl, asl_search() will take about a dozen seconds.


1. question: is there any faster method to get a list of asl messages?

2. question: is there a way to make Xcode 3.1.1 print NSLog() messages  
ONLY into it's own Console and NOT also into the asl-console (like the  
good old Xcode 2.x did)?


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


Re: need advice on subclassing NSScrollVIew

2009-03-20 Thread Rainer Brockerhoff
At 19:59 -0700 19/03/09, cocoa-dev-requ...@lists.apple.com wrote:
>From: John Reppy 
>Date: Thu, 19 Mar 2009 15:39:44 -0500
>Message-ID: 
>
>I'm building a viewer for event logs that needs to support a wide range
>of scales (say from seconds/inch to nanoseconds/inch).  I've got a custom
>subclass of NSView for displaying this information, which I want to embed
>in an NSScrollView.  The problem that I'm faced with is that the floating-point
>coordinates used by Cocoa do not have enough precision at full magnification.
>
>I'm guessing that the best solution is to subclass NSScrollView to track the
>visible rectangle's origin using doubles, but I'm not sure which NSScrollView
>methods I should be overriding.  Also, do I need to override NSClipView too?
>Any pointers or suggestions would be appreciated.

In a similar situation, I didn't subclass NSScrollView. I subclassed NSView and 
inserted an NSScroller directly as its subview. I tracked the position with a 
64-bit variable which I converted to a range suitable for the NSScroller just 
for setting its thumb position and size. I set my view as the NSScroller's 
target to convert back to my 64-bit position.

In the subclass' -drawRect: method, I calculated the visible portion of the 
view, and simply drew that - no NSClipView required. For your case, you'd have 
an additional step involving the scale; be careful with loss of precision there.

Despite being somewhat more work to implement, this proved to be more efficient 
and also a good learning experience regarding the view drawing mechanism.

HTH,
-- 
Rainer Brockerhoff  
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
___

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

Please do not post admin requests or moderator comments to the list.
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: Bug+Fix: NSController (and subclasses) have problems with custom KVO keys

2009-03-20 Thread Steve Steinitz

Hi Marc and Quincy

On 19/3/09, m...@sky4studios.be wrote:


'NSInternalInconsistencyException', reason: 'Cannot remove an observer
 for the key path "targetPhoto.name" from
, most likely because the value for the
key "targetPhoto" has changed without an appropriate KVO notification
being sent. Check the KVO-compliance of the NSMyArrayController class.'


That is indeed a real problem and one which can take a lot of 
time from you.  In some cases the scenario really is what the 
message above is saying.  Other times, I think, its something 
else, or a bug.  Re the former, I had a simple app that was 
getting that problem but which looked fine to me.  I showed the 
code to a bright young man on this mailing list named Hamish 
Allen and he immediately saw the problem and suggested a fix, 
which worked perfectly.  (See footnote.)  To this day, I can't 
say I completely understand why his fix worked.


I had the same problem in a much more complex app.  It was a 
sort of master-slave display of models and their specific 
products.  If I changed the model for a product I got the 
error.  I discovered that the fields in the product list which 
actually belonged to the model were causing the problem.  For 
example, in the product list, I showed the product category name 
via this binding [self.]model.category.name.  In the end I 
hacked it to work by changing the binding to selectedmodel.category.name.


I shudder to think of the number of hours I spent trying to 
ensure KVO compliance and to really understand this problem.


Your best bet might be to throw yourself at the feet of the 
talented Mr Allen -- or perhaps you can gain his skills 
yourself.  I've pasted below an excerpt from his masterful email 
-- maybe you can glean something useful from it.


Good luck,

Steve



from Hamish Allen

"Cannot remove an observer  for the key path
"contributionForSelectedDecisionValue.degree" from , most likely because the value for the key
"contributionForSelectedDecisionValue" has changed without an
appropriate KVO notification being sent. Check the 
KVO-compliance of

the Alternative class."

The problem there was pretty much exactly as the error message
describes: the Contribution in question is being dynamically selected
within the method contributionForSelectedDecisionValue, and said
method is free to return a different object than the one it returned
last time it was called, without
willChangeValueForKey:@"contributionForSelectedDecisionValue" having
been called in the interim.

This is confirmed by changing the table column binding from
"contributionForSelectedDecisionValue.degree' to
'degreeForContributionForSelectedDecisionValue' and writing the
following code:

- (NSNumber *)degreeForContributionForSelectedDecisionValue
{
  return [[self contributionForSelectedDecisionValue] degree];
}

+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
{
  if ([key isEqualToString:@"degreeForContributionForSelectedDecisionValue"])
return [NSSet setWithObject:@"contributionForSelectedDecisionValue"];
  else
return [super keyPathsForValuesAffectingValueForKey:key];
}

No exception is thrown with this new binding.

___

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

Please do not post admin requests or moderator comments to the list.
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: need advice on subclassing NSScrollVIew

2009-03-20 Thread John Reppy


On Mar 20, 2009, at 1:04 AM, Graham Cox wrote:


Double's are not going to help.

The drawing coordinates are floats. Even if you could persuade  
NSScrollView to position your view to double precision, it will get  
truncated to single precision for display. You'd have to rewrite all  
of Quartz at 64 bit precision to see any benefit.





However, all is not lost.

A float easily exceeds a 10^9 range, so you merely need to scale  
everything upwards. e.g. define 1nS to be, say, 10 points, then draw  
everything else on that basis. You can then scale the whole view to  
show the timeline scale you need. Scaling the view itself is  
trivial, see -scaleUnitSquareToSize:


THanks for the suggestion, but I don't think that it solves my problem.

The problem is that a single-precision float only has 23+1 mantissa  
bits, which
means that it cannot represent a number like 101 exactly.  If  
I'm viewing
the log at the scale 1ns = 1pt, and my view's origin is at 10s, then  
I've only
got about 10uS precision in my float values.  Scaling the NSView  
coordinates only
works if I keep near the origin, which is why I'm planning on tracking  
the view's

origin using a double and then adjusting the coordinates before drawing.

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


Re: NSScrollView like iTunes

2009-03-20 Thread Luca Pazzerello
Chris,Wich NSTableView can expand its items? ;-) (I'm referring to the
iTunes Playlists item).
That NSOutlineView simply hides the disclosure triangle, so that
probably confused you.
If you want to hide the disclosure triangles (wich every expandible item
has by dfault), you need to subclass
NSOutlineView and override the - (NSRect)frameOfOutlineCellAtRow:(NSInteger
)row method; you may want to return NSZeroRect when you don't want the
disclosure triangle to be shown.

--Luca C.

2009/3/20 Chris Purcell 

> I'm trying to create a view similar to the left iTunes bar (
> http://i39.tinypic.com/2hwp7w5.png) and many other apps (Mail, iCal,
> etc.).  Is this a NSScrollView or NSOutlineView?  Or am I going about this
> the wrong way.
>
> Thanks,
>
> --Chris
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/cocoa-dev/luca.pazzerello%40gmail.com
>
> This email sent to luca.pazzere...@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: NSTableView updating checkboxes

2009-03-20 Thread Graham Cox


On 20/03/2009, at 8:53 PM, Jo Phils wrote:

Hi Graham and thank you very much for your reply.  I think I'm still  
a bit confused I do apologize. :-(  Here's my code so far so you can  
see...


- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [filenames count];
}


- (id)tableView:(NSTableView *)aTableView
  objectValueForTableColumn:(NSTableColumn *)aTableColumn
  row:(NSInteger)rowIndex

{
if ([[aTableColumn identifier] isEqualToString:@"column2"])
{
return [NSNumber numberWithInt:NSOnState];
}
return [filenames objectAtIndex:rowIndex];


- (void)tableView:(NSTableView *)aTableView
  setObjectValue:(id)anObject
  forTableColumn:(NSTableColumn *)aTableColumn
  row:(int)rowIndex
{
// This is where I'm stuck!
}

And in this code I am using my variable which is a list of  
filenames...


NSMutableArray *filenames;


Other than the connections I have in IB I have given this column of  
checkboxes the Identifier "column2" in IB.  I have not set any other  
property key like you mentioned and I'm not sure where I would do  
that?  I'm not using bindings in my case...I was under the  
impression it was not necessary?  The first 2 methods seem to work  
fine and the 3rd method is being called but it's just I couldn't  
figure out the code to change the state of the checkboxes...


Thank you again so much for your help,




Well, I guess what isn't clear is what the checkboxes actually *mean*.  
If your data model is simply a list of strings (as it appears to be,  
even though they represent filenames) then what is the boolean property?


If what you're after is to represent some subset of the list, i.e.  
"all the checked filenames", then there are two basic ways to handle  
this. One is to define a class that has both the filename and the  
'checked' state as properties, and keep an array of those. The better  
way (IMO) is to have two lists - the original list "all filenames",  
and a second list "those which are checked". The second approach has  
numerous advantages, such as being able to quickly iterate the list or  
pass it to other processing methods as an object in its own right  
(otherwise everything would have to iterate the main list looking for  
those objects that have the 'checked' property set - this way they can  
just get to work on that list as it comes).


The second approach is possibly a teeny bit more work, but well worth  
it. Your controller will have two lists - the main list - an array of  
filenames, and a second list - those that are checked. I'd recommend  
using NSMutableSet for the second, since there's not really an  
inherent order to be concerned with here, and it ignores double  
entries, etc. If you need a sorted list, it's easy to generate one  
from the set on the fly.


The basic idea is that when a box is checked, the object is added to  
the set. When unchecked, it is removed.


Some example code that shows the general idea (warning, typed into  
mail from memory of the APIs involved)


@interface MyListController : NSObject
{
NSArray*mainList;
NSMutableSet*   selectedObjects;
}

- (void)addToSelection:(id) object;
- (void)removeFromSelection:(id) object;
- (NSSet*)  selection;

@end

//---

@implementation MyListController

// much stuff glossed over, such as initialising the lists


- (void)addToSelection:(id) object
{
[selectedObjects addObject:object];
}


- (void)removeFromSelection:(id) object
{
[selectedObjects removeObject:object];
}


- (NSSet*)  selection
{
return selectedObjects;
}

// as a NSTableDataSource


- (NSInteger)   numberOfRowsInTableView:(NSTableView*) tv
{
return [mainList count];
}


- (id)		tableView:(NSTableView*) tv objectValueForTableColumn: 
(NSTableColumn*) aTableColumn row:(NSInteger) rowIndex

{
id object = [mainList objectAtIndex:rowIndex];

// if the object is in the set, it's checked, otherwise not

if([[aTableColumn identifier] isEqualToString:@"checked"])
return [NSNumber numberWithBool:[selectedObjects 
isMember:object]];
else
return object;
}


- (void)	tableView:(NSTableView*) tv setObjectValue:(id) val  
forTableColumn:(NSTableColumn*) aTableColumn row:(NSInteger) rowIndex

{
id object = [mainList objectAtIndex:rowIndex];

if([[aTableColumn identifier] isEqualToString:@"checked"])
{
BOOL selected = [val boolValue];

// add or remove the object from the selection set

if( selected )
[self addToSelection:object];
else
[self removeFromSelection:object];
}
}


Is that any help? If this isn't what you're trying to do, you'll need  
to be more explicit about what your boolean property 

Re: NSCell with URL

2009-03-20 Thread Charles Romestant
Thank you for your reply,
the method itself right now is very fast, i m using a custom class for the
first column ( displays NSIMage) that caches the images, and the second
column is pure text , that comes from the xml.

What I want is the NSCell on the second column to support formatted text, (
some bold letters, URL detecting/parsing so that I can click on it ).

I m wondering if this can be done easily with prebuilt functions, or if this
has to be done in a custom NSCell class. If it's the latter, could you point
me in the right direction as to how to implement this properly?

thank you in advance

Charles.

On Sat, Mar 21, 2009 at 5:42 AM, Alexander Spohr  wrote:

>
> Am 20.03.2009 um 15:02 schrieb Charles Romestant:
>
>  But I don't see how to do this.
>> I tried NSAttributedString but its painfully slow ( seems that (id
>> )tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn
>> *)tableColumn
>> row:(int)row is called on every refresh resize of the page),
>> plus i did not get to put the URL in there either, just some colours.
>>
>> What would be the proper way to go about this.
>>
>
>
> First, make the above method fast! That thing has to be fast, as it will be
> called every time the data changes. Cache your contents /
> NSAttributedStrings in an NSArray.
>
> Only after that method is really fast think about how to get your cell to
> do what you want.
>
>atze
>
>


-- 
Lic. Charles M. Romestant F.
Phone: +58412 622 2298
___

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

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

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

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


Re: NSTableView updating checkboxes

2009-03-20 Thread Jo Phils
Thank you again Graham so much for the quick reply.  Yes you're right about 
where I'm headed.  I was just thinking that I could code it that when you click 
on the checkboxes the state would toggle then when I got to the processing step 
I would simply read the state and know how to process each item in my array.  
But I see what you're saying yes at this point I have no set boolean state in 
my array.  I was able to initialize my table view with "checked" boxes by 
returning the ON state but in this method I got stuck because the return is 
void and that's where my problem was.  Ok I will work on your suggestion and I 
really do appreciate all of the help... :-)

I'll let you know,

Rick






From: Graham Cox 
To: Jo Phils 
Cc: cocoa-dev@lists.apple.com
Sent: Friday, March 20, 2009 8:56:23 PM
Subject: Re: NSTableView updating checkboxes


On 20/03/2009, at 8:53 PM, Jo Phils wrote:

> Hi Graham and thank you very much for your reply.  I think I'm still a bit 
> confused I do apologize. :-(  Here's my code so far so you can see...
> 
> - (int)numberOfRowsInTableView:(NSTableView *)aTableView
> {
> return [filenames count];
> }
> 
> 
> - (id)tableView:(NSTableView *)aTableView
>   objectValueForTableColumn:(NSTableColumn *)aTableColumn
>   row:(NSInteger)rowIndex
> 
> {
> if ([[aTableColumn identifier] isEqualToString:@"column2"])
> {
> return [NSNumber numberWithInt:NSOnState];
> }
> return [filenames objectAtIndex:rowIndex];
> 
> 
> - (void)tableView:(NSTableView *)aTableView
>   setObjectValue:(id)anObject
>   forTableColumn:(NSTableColumn *)aTableColumn
>   row:(int)rowIndex
> {
> // This is where I'm stuck!
> }
> 
> And in this code I am using my variable which is a list of filenames...
> 
> NSMutableArray *filenames;
> 
> 
> Other than the connections I have in IB I have given this column of 
> checkboxes the Identifier "column2" in IB.  I have not set any other property 
> key like you mentioned and I'm not sure where I would do that?  I'm not using 
> bindings in my case...I was under the impression it was not necessary?  The 
> first 2 methods seem to work fine and the 3rd method is being called but it's 
> just I couldn't figure out the code to change the state of the checkboxes...
> 
> Thank you again so much for your help,
> 


Well, I guess what isn't clear is what the checkboxes actually *mean*. If your 
data model is simply a list of strings (as it appears to be, even though they 
represent filenames) then what is the boolean property?

If what you're after is to represent some subset of the list, i.e. "all the 
checked filenames", then there are two basic ways to handle this. One is to 
define a class that has both the filename and the 'checked' state as 
properties, and keep an array of those. The better way (IMO) is to have two 
lists - the original list "all filenames", and a second list "those which are 
checked". The second approach has numerous advantages, such as being able to 
quickly iterate the list or pass it to other processing methods as an object in 
its own right (otherwise everything would have to iterate the main list looking 
for those objects that have the 'checked' property set - this way they can just 
get to work on that list as it comes).

The second approach is possibly a teeny bit more work, but well worth it. Your 
controller will have two lists - the main list - an array of filenames, and a 
second list - those that are checked. I'd recommend using NSMutableSet for the 
second, since there's not really an inherent order to be concerned with here, 
and it ignores double entries, etc. If you need a sorted list, it's easy to 
generate one from the set on the fly.

The basic idea is that when a box is checked, the object is added to the set. 
When unchecked, it is removed.

Some example code that shows the general idea (warning, typed into mail from 
memory of the APIs involved)

@interface MyListController : NSObject
{
NSArray* mainList;
NSMutableSet*selectedObjects;
}

- (void)addToSelection:(id) object;
- (void)removeFromSelection:(id) object;
- (NSSet*)selection;

@end

//---

@implementation MyListController

// much stuff glossed over, such as initialising the lists


- (void)addToSelection:(id) object
{
[selectedObjects addObject:object];
}


- (void)removeFromSelection:(id) object
{
[selectedObjects removeObject:object];
}


- (NSSet*)selection
{
return selectedObjects;
}

// as a NSTableDataSource


- (NSInteger)numberOfRowsInTableView:(NSTableView*) tv
{
return [mainList count];
}


- (id)tableView:(NSTableView*) tv 
objectValueForTableColumn:(NSTableColumn*) aTableColumn row:(NSInteger) rowIndex
{
id object = [mainList objectAtIndex:rowIndex];

// if the object is in the set, it's checked, otherwise not

if([[aTableColumn identifier] isEqualToString:@"checked"])
  

Re: asl_search abysmally slow

2009-03-20 Thread Luke the Hiesterman
I fought with ASL slowness in trying to develop my app last year. That  
project currently sits on the backburner largely because of  
performance problems I also encountered with ASL. I did fine reading  
once, but as soon as I started reading every second or couple of  
seconds, syslogd cpu usage went through the roof and life became  
awful. I wish I had a solution for you, but instead I simply say, "I  
feel your pain."


Luke

On Mar 20, 2009, at 2:08 AM, Gerriet M. Denkmann wrote:



I am trying to access the Apple System Log facility.

char *lastMessageId = "765123";

aslmsg q = asl_new(ASL_TYPE_QUERY);
asl_set_query(q, kAslMessageId, lastMessageId, ASL_QUERY_OP_GREATER  
| ASL_QUERY_OP_NUMERIC );
aslresponse r = asl_search( NULL, q);	// r will contain all messages  
after 765123


Works fine, if the asl database is small. But with about 200 000  
messages in asl, asl_search() will take about a dozen seconds.


1. question: is there any faster method to get a list of asl messages?

2. question: is there a way to make Xcode 3.1.1 print NSLog()  
messages ONLY into it's own Console and NOT also into the asl- 
console (like the good old Xcode 2.x did)?


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/luketheh%40apple.com

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


___

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

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

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

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


Re: NSTimer & Runloop questions

2009-03-20 Thread Robbie Hanson
How can I know if a fired timer has already been "invalidated" using  
setFireDate?  Consider the following pseudo-code:


- (void)dequeueNextOperation
{
// IF there is another operation in the queue
// Dequeue and start opertation...

// Start timeout timer for operation
	// Instead of creating a new timer for every operation, we'd like to  
simply recycle the same one

[timer setFireDate:[NSDate dateWithTimeIntervalSinceNow:op->timeout]];
}

// Called when the operation has completed
- (void)operationComplete
{
// "invalidate" timer
	// We have learned that this will not always prevent the doTimeout:  
method from being called

[timer setFireDate:[NSDate distantFuture]];

// Notify delegate of completed op

[self performSelector:@selector(dequeueNextOperation) afterDelay:0.0];
}

- (void)doTimeout:(NSTimer *)aTimer
{
// Is there anyway to tell if this timer has already
// been "invalidated" in the operationComplete method?
}

Perhaps there is something clever I can do with the timer's userInfo  
variable or something?




On Mar 19, 2009, at 11:01 PM, Ken Thomases wrote:


On Mar 19, 2009, at 1:51 PM, Robbie Hanson wrote:

However I'm not sure how safe it is to use the setFireDate method  
of NSTimer.  Consider the following code:


NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.2
target:self
   
selector:@selector(timeout:)

  userInfo:nil
   repeats:NO];

[NSThread sleepForTimeInterval:2.0];

// This line will properly prevent the timer from firing
//[timer invalidate];

// This line will NOT
[timer setFireDate:[NSDate distantFuture]];

Why is this exactly?


At a guess, because the timer has already fired.  You are changing  
the time when it will _next_ fire.  But the timer is already marked  
as having fired.  When the run loop next gets a chance, it will  
invoke the callback for the previous firing.  Invalidating the timer  
actually removes it from the run loop, preventing that.


Regards,
Ken



___

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

Please do not post admin requests or moderator comments to the list.
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: NSTimer & Runloop questions

2009-03-20 Thread A.M.


On Mar 20, 2009, at 12:22 PM, Robbie Hanson wrote:

How can I know if a fired timer has already been "invalidated" using  
setFireDate?  Consider the following pseudo-code:


- (void)dequeueNextOperation
{
// IF there is another operation in the queue
// Dequeue and start opertation...

// Start timeout timer for operation
	// Instead of creating a new timer for every operation, we'd like  
to simply recycle the same one
	[timer setFireDate:[NSDate dateWithTimeIntervalSinceNow:op- 
>timeout]];

}

// Called when the operation has completed
- (void)operationComplete
{
// "invalidate" timer
	// We have learned that this will not always prevent the doTimeout:  
method from being called

[timer setFireDate:[NSDate distantFuture]];

// Notify delegate of completed op

	[self performSelector:@selector(dequeueNextOperation) afterDelay: 
0.0];

}

- (void)doTimeout:(NSTimer *)aTimer
{
// Is there anyway to tell if this timer has already
// been "invalidated" in the operationComplete method?
}

Perhaps there is something clever I can do with the timer's userInfo  
variable or something?


Are you modifying the NSTimer from a separate thread? NSTimer/ 
CFRunLoopTimer is only marginally thread-safe. Specifically, calling  
setFireDate from another thread may do nothing because the runloop on  
which the timer is installed may be already blocked (and will not  
process the change). Instead, you should probably use non-repeating  
timers- one for each operation on the thread in which it runs.


Even if you not explicitly using threads here, you should likely go  
with creating individual one-time-firing NSTimers.


Cheers,
M
___

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

Please do not post admin requests or moderator comments to the list.
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


[noob] Best practice for creating multiple instances of a View

2009-03-20 Thread Stuart Malin
I have a Nib file containing a single NSView that contains several  
controls. I need to make numerous copies of this view (which are  
placed as subviews of some containing view). Presently, I load the Nib  
for each occurrence needed. But I now wonder if this is the best  
approach (going back to the Nib file and loading each time).  Is there  
an alternative way to achieve this -- perhaps placing the target  
NSView in some other Nib container (such as with the controller and  
view that manage and contain the multiple instances of the target  
view) and somehow creating new instances?  I have looked through the  
NSView reference material, and some of the Nib reference material, and  
don't see any obvious alternative.



___

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

Please do not post admin requests or moderator comments to the list.
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: need advice on subclassing NSScrollVIew

2009-03-20 Thread Kyle Sluder
You have two (32-bit floating point) coordinate systems to work with
here.  You have the one defined by your view's bounds, and the one you
use internally to convert values in your domain (seconds) into pixels.
 You can set these however you like such that the final transformation
matrix results in drawing at your desired resolution.

This is a bit more involved than just using the view's bounds, but it
is a good way to achieve what you like.  If you wanted, you could
forget entirely about the bounds and draw directly at 1:1.  Whatever
you do, make sure you disable copy-on-scroll.

--Kyle Sluder

-- 
--Kyle Sluder
___

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

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

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

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


Re: Is there an icon to represent "select all"?

2009-03-20 Thread Benjamin Dobson


On 20 Mar 2009, at 18:31:42, David wrote:


Is there a standard icon to represent "select all"?


I believe not. There generally isn't any icon for it at all.


Is there a better website where I should ask this?


Not that I know of. :-)
___

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

Please do not post admin requests or moderator comments to the list.
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: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread I. Savant
On Fri, Mar 20, 2009 at 2:19 PM, Stuart Malin  wrote:
> I have a Nib file containing a single NSView that contains several controls.
> I need to make numerous copies of this view (which are placed as subviews of
> some containing view). Presently, I load the Nib for each occurrence needed.
> But I now wonder if this is the best approach (going back to the Nib file
> and loading each time).

  This is "the usual way" in Cocoa. If you're having performance
issues, profile the code and address them specifically, but you're on
the right track as far as the way it's normally done.

--
I.S.
___

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

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

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

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


Re: NSTimer & Runloop questions

2009-03-20 Thread Robbie Hanson
How can I know if a fired timer has already been "invalidated"  
using setFireDate?  Consider the following pseudo-code:


- (void)dequeueNextOperation
{
// IF there is another operation in the queue
// Dequeue and start opertation...

// Start timeout timer for operation
	// Instead of creating a new timer for every operation, we'd like  
to simply recycle the same one
	[timer setFireDate:[NSDate dateWithTimeIntervalSinceNow:op- 
>timeout]];

}

// Called when the operation has completed
- (void)operationComplete
{
// "invalidate" timer
	// We have learned that this will not always prevent the  
doTimeout: method from being called

[timer setFireDate:[NSDate distantFuture]];

// Notify delegate of completed op

	[self performSelector:@selector(dequeueNextOperation) afterDelay: 
0.0];

}

- (void)doTimeout:(NSTimer *)aTimer
{
// Is there anyway to tell if this timer has already
// been "invalidated" in the operationComplete method?
}

Perhaps there is something clever I can do with the timer's  
userInfo variable or something?


Are you modifying the NSTimer from a separate thread? NSTimer/ 
CFRunLoopTimer is only marginally thread-safe. Specifically, calling  
setFireDate from another thread may do nothing because the runloop  
on which the timer is installed may be already blocked (and will not  
process the change). Instead, you should probably use non-repeating  
timers- one for each operation on the thread in which it runs.


Even if you not explicitly using threads here, you should likely go  
with creating individual one-time-firing NSTimers.


Cheers,
M



All of the methods are run in the same thread.  The "operations" are  
asynchronous, and on the same thread/runloop.


Even if you not explicitly using threads here, you should likely go  
with creating individual one-time-firing NSTimers.


I was worried this might be the answer...

I'm still a bit curious about the code I posted above.  Is there any  
way that the "dequeueNextOperation" method, which gets scheduled in  
the "operationComplete" method, will run *before* the "doTimeout"  
method?  In other words, is there any possibility of this series of  
events happening:


- dequeueNextOperation (starts async operation1, and sets fire date of  
timer)
- operationComplete (sets fire date of timer to distant future, queues  
call to dequeueNextOperation)
- dequeueNextOperation (starts async operation2, and sets fire date of  
timer)

- doTimeout (called for operation1)

If this is at all possible (in any way, shape or form)?
___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread Nick Zitzmann


On Mar 20, 2009, at 12:33 PM, James Maxwell wrote:

But this seems like a memory hungry way of doing things (even though  
setFloatData is a "properly written" accessor, I think, and does  
release the current copy "m_floatData" before storing the new one).  
Is there any way to just operate on the float array "in place", so  
to speak?


Yes; just pass the float array(s) around as arguments. Using NSData to  
encapsulate C arrays is kind of awkward, unless you requested the  
memory using malloc() and use +dataWithBytesNoCopy: to add the bytes  
to the autorelease pool/garbage collector.


Of course, if you need to add the array(s) to a collection object of  
some sort, then you should use NSValue, not NSData.


Just in case there's a problem with the accessor, I'm doing  
something like this:


- (void) setFloatData:(NSData *) theData
{
   if(m_floatData)
   [m_floatData release];
   m_floatData = [theData retain];
}



Bad idea. If m_floatData == theData, then your code will probably  
crash. Also, calling -release on a nil pointer is OK, since nothing  
will happen if you send a message to a nil pointer. What you should do  
instead is this: (typed in Mail)


- (void)setFloatData:(NSData *)theData
{
if (m_floatData != theData)
{
[m_floatData release];
m_floatData = [theData retain];
}
}

Nick Zitzmann




___

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

Please do not post admin requests or moderator comments to the list.
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


NSData confusion

2009-03-20 Thread James Maxwell
I've been using NSData to wrap up float arrays and matrices, so I can  
pass them around my methods and classes.
However, I'm finding they're using loads of memory. Now, I do admit  
this is probably because I'm not doing this properly, so I'd like some  
clarification. The NSData objects are instance variables, and I need  
to be able to perform operations on the float arrays/matrices inside,  
and have these operations permanently change the state of the array/ 
matrix.


I've been doing something like:

- (NSData *) doSomethingToFloatData
{
float stuff[20];

[[self floatData] getBytes:stuff];

// do something to change the float values in stuff

[self setFloatData:[NSData dataWithBytes:stuff length:(20 *  
sizeof(float))]];


return [self floatData];
}

But this seems like a memory hungry way of doing things (even though  
setFloatData is a "properly written" accessor, I think, and does  
release the current copy "m_floatData" before storing the new one). Is  
there any way to just operate on the float array "in place", so to  
speak? Do I really need the "[self setFloatData]" call, if I want the  
changes to stuff to be retained?


Just in case there's a problem with the accessor, I'm doing something  
like this:


- (void) setFloatData:(NSData *) theData
{
if(m_floatData)
[m_floatData release];
m_floatData = [theData retain];
}

This is how I've seen it done in the Apple docs, but maybe this isn't  
the best way to do things...(??)


Keep in mind, I'm from a Java background, so I may be missing some  
things that would be obvious to a C expert... I'm also open to a  
totally different way of doing all this, with the one caveat that the  
float arrays and matrices can get fairly large, and I'm running  
through lots of them (i.e., NSMutableArrays will likely be too slow  
and awkward). Would NSValue be more convenient?


J.
___

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

Please do not post admin requests or moderator comments to the list.
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


Is there an icon to represent "select all"?

2009-03-20 Thread David
Is there a standard icon to represent "select all"?
Is there a better website where I should ask this?

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: need advice on subclassing NSScrollVIew

2009-03-20 Thread Benjamin Stiglitz
> In a similar situation, I didn't subclass NSScrollView. I subclassed NSView 
> and inserted an NSScroller directly as its subview. I tracked the position 
> with a 64-bit variable which I converted to a range suitable for the 
> NSScroller just for setting its thumb position and size. I set my view as the 
> NSScroller's target to convert back to my 64-bit position.
> 
> In the subclass' -drawRect: method, I calculated the visible portion of the 
> view, and simply drew that - no NSClipView required. For your case, you'd 
> have an additional step involving the scale; be careful with loss of 
> precision there.
> 
> Despite being somewhat more work to implement, this proved to be more 
> efficient and also a good learning experience regarding the view drawing 
> mechanism.

One unfortunate caveat of this solution is that it’s very difficult to
exactly reproduce some of the behavior of NSScrollView, especially if
you plan to handle dragging or anything else that requires
-autoscroll:ing.

And don’t forget about exposing the proper accessibility roles and
attributes.

-Ben
___

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

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

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

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


Re: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread Stuart Malin


On Mar 20, 2009, at 8:38 AM, I. Savant wrote:

On Fri, Mar 20, 2009 at 2:19 PM, Stuart Malin   
wrote:
I have a Nib file containing a single NSView that contains several  
controls.
I need to make numerous copies of this view (which are placed as  
subviews of
some containing view). Presently, I load the Nib for each  
occurrence needed.
But I now wonder if this is the best approach (going back to the  
Nib file

and loading each time).


 This is "the usual way" in Cocoa. If you're having performance
issues, profile the code and address them specifically, but you're on
the right track as far as the way it's normally done.


Thanks for the quick reply and the assurance.  No performance issues  
-- just had been wondering about the effect of going back to disk  
every time I need one of these views (which will be frequent and there  
will be many). Perhaps the fact of disk caching makes this a non issue.


___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread Quincey Morris

On Mar 20, 2009, at 11:33, James Maxwell wrote:

I've been using NSData to wrap up float arrays and matrices, so I  
can pass them around my methods and classes.
However, I'm finding they're using loads of memory. Now, I do admit  
this is probably because I'm not doing this properly, so I'd like  
some clarification. The NSData objects are instance variables, and I  
need to be able to perform operations on the float arrays/matrices  
inside, and have these operations permanently change the state of  
the array/matrix.


I've been doing something like:

- (NSData *) doSomethingToFloatData
{
   float stuff[20];

   [[self floatData] getBytes:stuff];

   // do something to change the float values in stuff

   [self setFloatData:[NSData dataWithBytes:stuff length:(20 *  
sizeof(float))]];


   return [self floatData];
}


Seems to me you probably want to be using NSMutableData:

- (void) doSomethingToFloatData
{
float* stuff = [m_floatData mutableBytes];
// do something to change the float values in stuff
}

All you need to do is create the NSMutableData object with a suitable  
size to begin with (it'll get zero-filled), and to resize it if the  
number of floats it contains ever changes.



___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread James Maxwell
Thanks for the tip on the accessor. I'll rewrite mine... all of  
them... yikes! ;-)


J.

On 20-Mar-09, at 11:44 AM, Nick Zitzmann wrote:



On Mar 20, 2009, at 12:33 PM, James Maxwell wrote:

But this seems like a memory hungry way of doing things (even  
though setFloatData is a "properly written" accessor, I think, and  
does release the current copy "m_floatData" before storing the new  
one). Is there any way to just operate on the float array "in  
place", so to speak?


Yes; just pass the float array(s) around as arguments.
Using NSData to encapsulate C arrays is kind of awkward, unless you  
requested the memory using malloc() and use +dataWithBytesNoCopy: to  
add the bytes to the autorelease pool/garbage collector.


Of course, if you need to add the array(s) to a collection object of  
some sort, then you should use NSValue, not NSData.


Just in case there's a problem with the accessor, I'm doing  
something like this:


- (void) setFloatData:(NSData *) theData
{
  if(m_floatData)
  [m_floatData release];
  m_floatData = [theData retain];
}



Bad idea. If m_floatData == theData, then your code will probably  
crash. Also, calling -release on a nil pointer is OK, since nothing  
will happen if you send a message to a nil pointer. What you should  
do instead is this: (typed in Mail)


- (void)setFloatData:(NSData *)theData
{
if (m_floatData != theData)
{
[m_floatData release];
m_floatData = [theData retain];
}
}

Nick Zitzmann






___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread Nick Zitzmann


On Mar 20, 2009, at 12:58 PM, James Maxwell wrote:

Thanks for the tip on the accessor. I'll rewrite mine... all of  
them... yikes! ;-)



If you don't mind only being able to target Leopard & later, have you  
tried using the new synthesized accessor feature? That would save you  
the trouble _and_ give you optional thread safety...


Nick Zitzmann




___

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

Please do not post admin requests or moderator comments to the list.
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: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread Kyle Sluder
On Fri, Mar 20, 2009 at 2:53 PM, Stuart Malin  wrote:
> Thanks for the quick reply and the assurance.  No performance issues -- just
> had been wondering about the effect of going back to disk every time I need
> one of these views (which will be frequent and there will be many). Perhaps
> the fact of disk caching makes this a non issue.

The fact that you have no data to suggest this will cause slowdown, or
even happen, is what makes it a non-issue.  It's a classic case of
premature optimization: you don't have any obviously more efficient or
more correct ways of solving the same problem, and you have no data to
suggest you need to search for a non-obvious implementation, so you do
not yet need to optimize.  Only when one of these two things is true
should you consider a different implementation.

--Kyle Sluder
___

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

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

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

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


Re: NSData confusion

2009-03-20 Thread James Maxwell
oh... yes... I don't mind Leopard-only, but I haven't wrapped my head  
around any of the Obj-C 2.0 stuff yet...
I'll look into it right away, because I had some thread-related  
problems earlier today which might be cured by such a move.


thanks for that.

cheers,

J.

On 20-Mar-09, at 12:03 PM, Nick Zitzmann wrote:



On Mar 20, 2009, at 12:58 PM, James Maxwell wrote:

Thanks for the tip on the accessor. I'll rewrite mine... all of  
them... yikes! ;-)



If you don't mind only being able to target Leopard & later, have  
you tried using the new synthesized accessor feature? That would  
save you the trouble _and_ give you optional thread safety...


Nick Zitzmann






___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread James Maxwell

Oh geez... Of course, NSMutableData... I forgot the m-word.
I'll give that a try, and see how it does.

cheers,

J.

On 20-Mar-09, at 11:55 AM, Quincey Morris wrote:


On Mar 20, 2009, at 11:33, James Maxwell wrote:

I've been using NSData to wrap up float arrays and matrices, so I  
can pass them around my methods and classes.
However, I'm finding they're using loads of memory. Now, I do admit  
this is probably because I'm not doing this properly, so I'd like  
some clarification. The NSData objects are instance variables, and  
I need to be able to perform operations on the float arrays/ 
matrices inside, and have these operations permanently change the  
state of the array/matrix.


I've been doing something like:

- (NSData *) doSomethingToFloatData
{
  float stuff[20];

  [[self floatData] getBytes:stuff];

  // do something to change the float values in stuff

  [self setFloatData:[NSData dataWithBytes:stuff length:(20 *  
sizeof(float))]];


  return [self floatData];
}


Seems to me you probably want to be using NSMutableData:

- (void) doSomethingToFloatData
{
float* stuff = [m_floatData mutableBytes];
// do something to change the float values in stuff
}

All you need to do is create the NSMutableData object with a  
suitable size to begin with (it'll get zero-filled), and to resize  
it if the number of floats it contains ever changes.



___

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

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

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

This email sent to jbmaxw...@rubato-music.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: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread I. Savant
On Fri, Mar 20, 2009 at 2:53 PM, Stuart Malin  wrote:

> Thanks for the quick reply and the assurance.  No performance issues -- just
> had been wondering about the effect of going back to disk every time I need
> one of these views (which will be frequent and there will be many). Perhaps
> the fact of disk caching makes this a non issue.

  As Kyle stated and I implied - premature optimization. :-) Measure
first, then optimize.

  As I recall (and I don't know if I recall correctly), I thought I
heard that nib loading is pretty good about caching things, so I'd be
surprised to see it hitting the disk each time, but it's not
impossible, so ... measure then optimize.

--
I.S.
___

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

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

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

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


Re: NSData confusion

2009-03-20 Thread James Maxwell

okay, but what about matrices?

I've set them up using:

float **theMatrix = [[self matrixData] mutableBytes];

and this part seems okay - or at least, it compiles... But how do I  
then access the matrix.

I've been using normal C-style array notation, thus far:

theMatrix[i][j] = 0.;

but this gives me an EXC_BAD_ACESS error when I run it.

J.


On 20-Mar-09, at 11:55 AM, Quincey Morris wrote:


On Mar 20, 2009, at 11:33, James Maxwell wrote:

I've been using NSData to wrap up float arrays and matrices, so I  
can pass them around my methods and classes.
However, I'm finding they're using loads of memory. Now, I do admit  
this is probably because I'm not doing this properly, so I'd like  
some clarification. The NSData objects are instance variables, and  
I need to be able to perform operations on the float arrays/ 
matrices inside, and have these operations permanently change the  
state of the array/matrix.


I've been doing something like:

- (NSData *) doSomethingToFloatData
{
  float stuff[20];

  [[self floatData] getBytes:stuff];

  // do something to change the float values in stuff

  [self setFloatData:[NSData dataWithBytes:stuff length:(20 *  
sizeof(float))]];


  return [self floatData];
}


Seems to me you probably want to be using NSMutableData:

- (void) doSomethingToFloatData
{
float* stuff = [m_floatData mutableBytes];
// do something to change the float values in stuff
}

All you need to do is create the NSMutableData object with a  
suitable size to begin with (it'll get zero-filled), and to resize  
it if the number of floats it contains ever changes.



___

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

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

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

This email sent to jbmaxw...@rubato-music.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: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread Stuart Malin


On Mar 20, 2009, at 9:30 AM, I. Savant wrote:

On Fri, Mar 20, 2009 at 2:53 PM, Stuart Malin   
wrote:


Thanks for the quick reply and the assurance.  No performance  
issues -- just
had been wondering about the effect of going back to disk every  
time I need
one of these views (which will be frequent and there will be many).  
Perhaps

the fact of disk caching makes this a non issue.


 As Kyle stated and I implied - premature optimization. :-) Measure
first, then optimize.

 As I recall (and I don't know if I recall correctly), I thought I
heard that nib loading is pretty good about caching things, so I'd be
surprised to see it hitting the disk each time, but it's not
impossible, so ... measure then optimize.


Appreciate the comments regarding premature optimization. I wasn't  
trying to optimize -- I had just been looking to validate that I was  
going about handling the situation the smartest way.  Although nothing  
had appeared to me as "more obvious or more efficient" (referencing  
Kyle) -- it isn't always clear to us noobs when a non-obvious approach  
is available (and better).  Thanks again for the comments -- I will be  
sure to remain with the proven approach I am pursuing :-)


___

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

Please do not post admin requests or moderator comments to the list.
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: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread Kyle Sluder
On Fri, Mar 20, 2009 at 3:38 PM, Stuart Malin  wrote:
> Appreciate the comments regarding premature optimization. I wasn't trying to
> optimize -- I had just been looking to validate that I was going about
> handling the situation the smartest way.  Although nothing had appeared to
> me as "more obvious or more efficient" (referencing Kyle) -- it isn't always
> clear to us noobs when a non-obvious approach is available (and better).
>  Thanks again for the comments -- I will be sure to remain with the proven
> approach I am pursuing :-)

I did mean to mention something about this.  It's never premature
optimization to ask, "is there a better way of doing this?"  But it is
important to separate "better" from "more efficient", since the latter
implies an assumption of inefficiency which often leads to long,
unnecessary strolls down the path of complication.

--Kyle Sluder
___

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

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

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

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


Re: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread mmalc Crawford


On Mar 20, 2009, at 11:19 AM, Stuart Malin wrote:

Presently, I load the Nib for each occurrence needed. But I now  
wonder if this is the best approach (going back to the Nib file and  
loading each time).  Is there an alternative way to achieve this --  
perhaps placing the target NSView in some other Nib container (such  
as with the controller and view that manage and contain the multiple  
instances of the target view) and somehow creating new instances?  I  
have looked through the NSView reference material, and some of the  
Nib reference material, and don't see any obvious alternative.

[...]

March 20, 2009 11:53:59 AM

No performance issues -- just had been wondering about the effect of  
going back to disk every time I need one of these views (which will  
be frequent and there will be many). Perhaps the fact of disk  
caching makes this a non issue.




Modulo other's comments about premature optimisation, if you want to  
avoid going back to the disk:


initWithNibNamed:bundle:
instantiateNibWithOwner:topLevelObjects:

mmalc

___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread mmalc Crawford


On Mar 20, 2009, at 11:33 AM, James Maxwell wrote:


- (void) setFloatData:(NSData *) theData
{
   if(m_floatData)
   [m_floatData release];
   m_floatData = [theData retain];
}
This is how I've seen it done in the Apple docs, but maybe this  
isn't the best way to do things...(??)


I would be extremely surprised if you have seen this in the  
documentation.  If there is an example that shows this, please file a  
bug.


All similar examples I've seen follow the patterns illustrated here:



mmalc

___

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

Please do not post admin requests or moderator comments to the list.
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


q's regarding appropriate use of core data?

2009-03-20 Thread Darren Minifie
Hey everyone

I have made my way through the documentation to core data and am really
excited to start using it.  I have a couple of Q's about if my particular
scenario is appropriate for core data, or if I'm forcing the wrong
technology for the job.  I suspect that discussing anything related to sdk
iphone 3.0 is off limits, so i will skirt around that.  If this type of talk
is allowed please let me know and I can elaborate on my poblem.

1.  For my theseis project I am writing software that wil help visually
disabled people use public transit through the use of modile devices.  For
this stage, lets assume I'm talking about a prototype on the mac desktop.
The transit authority has given me scheduling data in the form of multiple
txt files.  I have written python scripts to extract the data from these
files and crate a SQlite database.  With indexes this database is about 70
MB.  Now, after reading Marcus Zarra's core data book, and some of the docs,
I really like how data can be accessed in an object-like way, and not an sql
way.  My idea was to pre-load a core data store up with this transit info
and distribute the app accordingly.  I have two concerns that lead me to
believe that core data may not be appropriate.  First, this data is never
modified by the user, its just a store of data that is used to find bus
times.  Second, since the db is so large, I dont want to incur unnecessary
processing.  Like I siad, I would generally like to avoid the sql api and
use the features of core data, but my question is, is this overkill?

2. This may crossing nda lines, so please ignore if inappropriate.  My
question is, if i created this core data store targeted for a mac
application, would the store itself be compatible with core data on the
iphone?  The tutorials on the iphone core data are significantly different
than for the mac, especially since bindings are still not around.

Thank you for your advice.



-- 
Darren Minifie
Graduate Studies: Computer Science
www.myavalon.ca
www.ohsnapmusic.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: NSData confusion

2009-03-20 Thread James Maxwell
Well, I thought I'd seen it that way, but I can't find it now, so I  
must have just remembered it incorrectly.
At any rate, the best method has been pointed out to me, and I  
understand why it's the way it is...


Any thoughts on accessing a 2D array from an NSMutableData object?

J.

On 20-Mar-09, at 12:46 PM, mmalc Crawford wrote:



On Mar 20, 2009, at 11:33 AM, James Maxwell wrote:


- (void) setFloatData:(NSData *) theData
{
  if(m_floatData)
  [m_floatData release];
  m_floatData = [theData retain];
}
This is how I've seen it done in the Apple docs, but maybe this  
isn't the best way to do things...(??)


I would be extremely surprised if you have seen this in the  
documentation.  If there is an example that shows this, please file  
a bug.


All similar examples I've seen follow the patterns illustrated here:



mmalc



___

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

Please do not post admin requests or moderator comments to the list.
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: q's regarding appropriate use of core data?

2009-03-20 Thread Charles Romestant
May I suggest not using a 70 mb file, it might make things slow, plus
distributing that on the target platform ( as I am guessing it is) will not
be practical.
Why not try and do it as a REST API call with parameters, so that you can
retrieve it "as needed" instead of handling all that with that sqllite file.


On Sat, Mar 21, 2009 at 3:18 PM, Darren Minifie  wrote:

> Hey everyone
>
> I have made my way through the documentation to core data and am really
> excited to start using it.  I have a couple of Q's about if my particular
> scenario is appropriate for core data, or if I'm forcing the wrong
> technology for the job.  I suspect that discussing anything related to sdk
> iphone 3.0 is off limits, so i will skirt around that.  If this type of
> talk
> is allowed please let me know and I can elaborate on my poblem.
>
> 1.  For my theseis project I am writing software that wil help visually
> disabled people use public transit through the use of modile devices.  For
> this stage, lets assume I'm talking about a prototype on the mac desktop.
> The transit authority has given me scheduling data in the form of multiple
> txt files.  I have written python scripts to extract the data from these
> files and crate a SQlite database.  With indexes this database is about 70
> MB.  Now, after reading Marcus Zarra's core data book, and some of the
> docs,
> I really like how data can be accessed in an object-like way, and not an
> sql
> way.  My idea was to pre-load a core data store up with this transit info
> and distribute the app accordingly.  I have two concerns that lead me to
> believe that core data may not be appropriate.  First, this data is never
> modified by the user, its just a store of data that is used to find bus
> times.  Second, since the db is so large, I dont want to incur unnecessary
> processing.  Like I siad, I would generally like to avoid the sql api and
> use the features of core data, but my question is, is this overkill?
>
> 2. This may crossing nda lines, so please ignore if inappropriate.  My
> question is, if i created this core data store targeted for a mac
> application, would the store itself be compatible with core data on the
> iphone?  The tutorials on the iphone core data are significantly different
> than for the mac, especially since bindings are still not around.
>
> Thank you for your advice.
>
>
>
> --
> Darren Minifie
> Graduate Studies: Computer Science
> www.myavalon.ca
> www.ohsnapmusic.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/cromestant%40gmail.com
>
> This email sent to cromest...@gmail.com
>



-- 
Lic. Charles M. Romestant F.
Phone: +58412 622 2298
___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread Stephen J. Butler
On Fri, Mar 20, 2009 at 2:28 PM, James Maxwell
 wrote:
> okay, but what about matrices?
>
> I've set them up using:
>
> float **theMatrix = [[self matrixData] mutableBytes];
>
> and this part seems okay - or at least, it compiles... But how do I then
> access the matrix.
> I've been using normal C-style array notation, thus far:
>
> theMatrix[i][j] = 0.;
>
> but this gives me an EXC_BAD_ACESS error when I run it.

Because this:

float theMatrix[ XSIZE ][ YSIZE ];

is not equivalent to this:

float **theMatrix = /* something */;

The latter says you have an array of float POINTERS. What you want is simple:

float *theMatrix = /* something */;

And then index it with:

theMatrix[ i*XSIZE + j ] = 0.666;
___

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

Please do not post admin requests or moderator comments to the list.
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: NSCell with URL

2009-03-20 Thread Charles Romestant
well first step is done,
made my custom NSCell and its working, now i need to optimize it, and i 'm
guessing run it through a RE before so i can add the link? ( any ideas on
displaying URLS?)

On Sat, Mar 21, 2009 at 10:43 AM, Charles Romestant wrote:

> Thank you for your reply,
> the method itself right now is very fast, i m using a custom class for the
> first column ( displays NSIMage) that caches the images, and the second
> column is pure text , that comes from the xml.
>
> What I want is the NSCell on the second column to support formatted text, (
> some bold letters, URL detecting/parsing so that I can click on it ).
>
> I m wondering if this can be done easily with prebuilt functions, or if
> this has to be done in a custom NSCell class. If it's the latter, could you
> point me in the right direction as to how to implement this properly?
>
> thank you in advance
>
> Charles.
>
>
> On Sat, Mar 21, 2009 at 5:42 AM, Alexander Spohr  wrote:
>
>>
>> Am 20.03.2009 um 15:02 schrieb Charles Romestant:
>>
>>  But I don't see how to do this.
>>> I tried NSAttributedString but its painfully slow ( seems that (id
>>> )tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn
>>> *)tableColumn
>>> row:(int)row is called on every refresh resize of the page),
>>> plus i did not get to put the URL in there either, just some colours.
>>>
>>> What would be the proper way to go about this.
>>>
>>
>>
>> First, make the above method fast! That thing has to be fast, as it will
>> be called every time the data changes. Cache your contents /
>> NSAttributedStrings in an NSArray.
>>
>> Only after that method is really fast think about how to get your cell to
>> do what you want.
>>
>>atze
>>
>>
>
>
> --
> Lic. Charles M. Romestant F.
> Phone: +58412 622 2298
>
>
>


-- 
Lic. Charles M. Romestant F.
Phone: +58412 622 2298
___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread James Maxwell
Ah, yes. That makes sense - you're basically finding the row as a kind  
of offset in the data, is that right?



On 20-Mar-09, at 1:00 PM, Stephen J. Butler wrote:


On Fri, Mar 20, 2009 at 2:28 PM, James Maxwell
 wrote:

okay, but what about matrices?

I've set them up using:

float **theMatrix = [[self matrixData] mutableBytes];

and this part seems okay - or at least, it compiles... But how do I  
then

access the matrix.
I've been using normal C-style array notation, thus far:

theMatrix[i][j] = 0.;

but this gives me an EXC_BAD_ACESS error when I run it.


Because this:

float theMatrix[ XSIZE ][ YSIZE ];

is not equivalent to this:

float **theMatrix = /* something */;

The latter says you have an array of float POINTERS. What you want  
is simple:


float *theMatrix = /* something */;

And then index it with:

theMatrix[ i*XSIZE + j ] = 0.666;


___

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

Please do not post admin requests or moderator comments to the list.
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


NSDate isEqual to...

2009-03-20 Thread Charles E. Heizer

Hello,
I'm playing around with date time stuff right now and I'm trying to  
figure out the bets way to determine if one datetime is equal to  
another. The problem I'm running in to is "isEqualToDate" does not  
appear to work, the NSLog statement will show two identical datetime  
statements but I never see a "These dates are the same!".


Can someone please tell me how I can get this to work.

Thanks,
Charles

NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20  
13:18:00 -0700"];

NSDate *theCurrentDateTime = [NSDate date];
while(1)
{
	NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt,  
theCurrentDateTime);	

if ([theDateTime1 isEqualToDate:theCurrentDate]) {
NSLog(@"These dates are the same!");
		[theDateTimeToRunAt addTimeInterval:900]; // Add 15 Minutes to say  
hi again!

}

sleep(1);
theDate = [NSDate date];
}
___

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

Please do not post admin requests or moderator comments to the list.
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: NSDate isEqual to...

2009-03-20 Thread Mike Abdullah


On 20 Mar 2009, at 20:50, Charles E. Heizer wrote:


Hello,
I'm playing around with date time stuff right now and I'm trying to  
figure out the bets way to determine if one datetime is equal to  
another. The problem I'm running in to is "isEqualToDate" does not  
appear to work, the NSLog statement will show two identical datetime  
statements but I never see a "These dates are the same!".


Can someone please tell me how I can get this to work.

Thanks,
Charles

NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20  
13:18:00 -0700"];

NSDate *theCurrentDateTime = [NSDate date];
while(1)
{
	NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt,  
theCurrentDateTime);	

if ([theDateTime1 isEqualToDate:theCurrentDate]) {
NSLog(@"These dates are the same!");
		[theDateTimeToRunAt addTimeInterval:900]; // Add 15 Minutes to say  
hi again!

}

sleep(1);
theDate = [NSDate date];
}


Because quite simply the dates are not exactly the same. NSDate is  
based on NSTimeInterval which offers sub-second precision, and so it  
is pretty unlikely that fetching the current time gives you a date  
that is precisely 13:18. Instead, you want to compare the dates to see  
if current date is greater than or equal to theDateTimeToRunAt.


Is this really your intention for the code though, or just an example  
method? If the former, why not just use +[NSThread sleepUntilDate:] ?


Mike.

___

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

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

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

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


Re: NSDate isEqual to...

2009-03-20 Thread Shawn Erickson
On Fri, Mar 20, 2009 at 1:50 PM, Charles E. Heizer  wrote:
> Hello,
> I'm playing around with date time stuff right now and I'm trying to figure
> out the bets way to determine if one datetime is equal to another. The
> problem I'm running in to is "isEqualToDate" does not appear to work, the
> NSLog statement will show two identical datetime statements but I never see
> a "These dates are the same!".

What does it mean for one NSDate to be equal to another NSDate from
the point of view of your requirements?

Note what the docs on isEqualToDate: say...

"This method detects sub-second differences between dates. If you want
to compare dates with a less fine granularity, use
timeIntervalSinceDate: to compare the two dates." ...or look at using
-[NSDate laterDate:] -[NSDate earlierDate:]. I generally think in
terms of using the later two methods unless I need to know a specific
delta.

-Shawn
___

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

Please do not post admin requests or moderator comments to the list.
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: [noob] Best practice for creating multiple instances of a View

2009-03-20 Thread Stuart Malin


On Mar 20, 2009, at 10:09 AM, mmalc Crawford wrote:


Modulo other's comments about premature optimisation, if you want to
avoid going back to the disk:


Re: NSDate isEqual to...

2009-03-20 Thread Charles E. Heizer

Thanks,
No it's just playing around right now. It would be nice to be able to  
specify if you wanted NSDate to be sub-second or second precision based.


Just as question, can NSDate be overridden to be second precision based?

Thanks,
- Charles


On Mar 20, 2009, at 2:05 PM, Mike Abdullah wrote:



On 20 Mar 2009, at 20:50, Charles E. Heizer wrote:


Hello,
I'm playing around with date time stuff right now and I'm trying to
figure out the bets way to determine if one datetime is equal to
another. The problem I'm running in to is "isEqualToDate" does not
appear to work, the NSLog statement will show two identical datetime
statements but I never see a "These dates are the same!".

Can someone please tell me how I can get this to work.

Thanks,
Charles

NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20
13:18:00 -0700"];
NSDate *theCurrentDateTime = [NSDate date];
while(1)
{
NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt,
theCurrentDateTime);
if ([theDateTime1 isEqualToDate:theCurrentDate]) {
NSLog(@"These dates are the same!");
[theDateTimeToRunAt addTimeInterval:900]; // Add 15 Minutes to 
say
hi again!
}

sleep(1);
theDate = [NSDate date];
}


Because quite simply the dates are not exactly the same. NSDate is
based on NSTimeInterval which offers sub-second precision, and so it
is pretty unlikely that fetching the current time gives you a date
that is precisely 13:18. Instead, you want to compare the dates to see
if current date is greater than or equal to theDateTimeToRunAt.

Is this really your intention for the code though, or just an example
method? If the former, why not just use +[NSThread sleepUntilDate:] ?

Mike.



___

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

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

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

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


Re: NSDate isEqual to...

2009-03-20 Thread mm w
+ (BOOL)isADayEqualToAnotherDay:(NSDate*)date anotherDate:(NSDate*)anotherDate
{
NSCalendar *cal;
NSDateComponents *componentsFromDate, *componentsFromAnotherDate;
NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |
NSDayCalendarUnit;

cal = [NSCalendar currentCalendar];
componentsFromDate = [cal components:unitFlags fromDate:date];
componentsFromAnotherDate = [cal components:unitFlags 
fromDate:anotherDate];

return (
[componentsFromDate year] == [componentsFromAnotherDate year] &&
[componentsFromDate month] == [componentsFromAnotherDate month] 
&&
[componentsFromDate day] == [componentsFromAnotherDate day]
);
}

+ (NSDate *)timeWithInterval:(NSInteger)timeInterval
{
NSDateComponents *comps = [[NSDateComponents alloc] init];
NSCalendar *cal = [[[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSDate *result;

[comps setHour:(timeInterval / 3600)];
[comps setMinute:(timeInterval / 60) - ((timeInterval / 3600) * 60)];
[comps setSecond:(timeInterval % 60)];

result = [cal dateFromComponents:comps];

[comps release];

return result;
}

(those are only sample codes there are better ways to handle this, I
only pointed you some methods, that will let you the opportunity to
digg into NSDate/NSIntervalTime/NSCalendar APIs, and reach your way)

what you need to compare: is the time of the dateTime object,

Cheers!

On Fri, Mar 20, 2009 at 2:05 PM, Mike Abdullah
 wrote:
>
> On 20 Mar 2009, at 20:50, Charles E. Heizer wrote:
>
>> Hello,
>> I'm playing around with date time stuff right now and I'm trying to figure
>> out the bets way to determine if one datetime is equal to another. The
>> problem I'm running in to is "isEqualToDate" does not appear to work, the
>> NSLog statement will show two identical datetime statements but I never see
>> a "These dates are the same!".
>>
>> Can someone please tell me how I can get this to work.
>>
>> Thanks,
>> Charles
>>
>> NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20 13:18:00
>> -0700"];
>> NSDate *theCurrentDateTime = [NSDate date];
>> while(1)
>> {
>>        NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt,
>> theCurrentDateTime);
>>        if ([theDateTime1 isEqualToDate:theCurrentDate]) {
>>                NSLog(@"These dates are the same!");
>>                [theDateTimeToRunAt addTimeInterval:900]; // Add 15 Minutes
>> to say hi again!
>>        }
>>
>>        sleep(1);
>>        theDate = [NSDate date];
>> }
>
> Because quite simply the dates are not exactly the same. NSDate is based on
> NSTimeInterval which offers sub-second precision, and so it is pretty
> unlikely that fetching the current time gives you a date that is precisely
> 13:18. Instead, you want to compare the dates to see if current date is
> greater than or equal to theDateTimeToRunAt.
>
> Is this really your intention for the code though, or just an example
> method? If the former, why not just use +[NSThread sleepUntilDate:] ?
>
> Mike.
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com
>
> This email sent to openspec...@gmail.com
>



-- 
-mmw
___

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

Please do not post admin requests or moderator comments to the list.
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: NSDate isEqual to...

2009-03-20 Thread mm w
yes, see my previous message;

you should NSLogged a NSDate object

Cheers!

On Fri, Mar 20, 2009 at 2:17 PM, Charles E. Heizer  wrote:
> Thanks,
> No it's just playing around right now. It would be nice to be able to
> specify if you wanted NSDate to be sub-second or second precision based.
>
> Just as question, can NSDate be overridden to be second precision based?
>
> Thanks,
> - Charles
>
>
> On Mar 20, 2009, at 2:05 PM, Mike Abdullah wrote:
>
>>
>> On 20 Mar 2009, at 20:50, Charles E. Heizer wrote:
>>
>>> Hello,
>>> I'm playing around with date time stuff right now and I'm trying to
>>> figure out the bets way to determine if one datetime is equal to
>>> another. The problem I'm running in to is "isEqualToDate" does not
>>> appear to work, the NSLog statement will show two identical datetime
>>> statements but I never see a "These dates are the same!".
>>>
>>> Can someone please tell me how I can get this to work.
>>>
>>> Thanks,
>>> Charles
>>>
>>> NSDate *theDateTimeToRunAt = [NSDate dateWithString:@"2009-03-20
>>> 13:18:00 -0700"];
>>> NSDate *theCurrentDateTime = [NSDate date];
>>> while(1)
>>> {
>>>        NSLog(@"theDateTime1=%@ | theCurrentDate=%@", theDateTimeToRunAt,
>>> theCurrentDateTime);
>>>        if ([theDateTime1 isEqualToDate:theCurrentDate]) {
>>>                NSLog(@"These dates are the same!");
>>>                [theDateTimeToRunAt addTimeInterval:900]; // Add 15
>>> Minutes to say
>>> hi again!
>>>        }
>>>
>>>        sleep(1);
>>>        theDate = [NSDate date];
>>> }
>>
>> Because quite simply the dates are not exactly the same. NSDate is
>> based on NSTimeInterval which offers sub-second precision, and so it
>> is pretty unlikely that fetching the current time gives you a date
>> that is precisely 13:18. Instead, you want to compare the dates to see
>> if current date is greater than or equal to theDateTimeToRunAt.
>>
>> Is this really your intention for the code though, or just an example
>> method? If the former, why not just use +[NSThread sleepUntilDate:] ?
>>
>> Mike.
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com
>
> This email sent to openspec...@gmail.com
>



-- 
-mmw
___

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

Please do not post admin requests or moderator comments to the list.
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


Customization of NSSavePanel

2009-03-20 Thread Sourabh Sahu
Hi Everyone,
I am trying to customize NSSavePanel using method prepareSavePanel,but I want 
NSSavePanel browsing feature to be disabled that is user cannot change the 
directory ,apart from it I also want NSSavePanel to show file of any particular 
type,suppose I want to show only text files.all other files should get hide.
Thanks in advance,
-Sourabh
DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

Please do not post admin requests or moderator comments to the list.
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: NSTimer & Runloop questions

2009-03-20 Thread Joan Lluch-Zorrilla



El 20/03/2009, a las 19:41, Robbie Hanson escribió:

How can I know if a fired timer has already been "invalidated"  
using setFireDate?  Consider the following pseudo-code:


- (void)dequeueNextOperation
{
// IF there is another operation in the queue
// Dequeue and start opertation...

// Start timeout timer for operation
	// Instead of creating a new timer for every operation, we'd like  
to simply recycle the same one
	[timer setFireDate:[NSDate dateWithTimeIntervalSinceNow:op- 
>timeout]];

}

// Called when the operation has completed
- (void)operationComplete
{
// "invalidate" timer
	// We have learned that this will not always prevent the  
doTimeout: method from being called

[timer setFireDate:[NSDate distantFuture]];

// Notify delegate of completed op

	[self performSelector:@selector(dequeueNextOperation) afterDelay: 
0.0];

}

- (void)doTimeout:(NSTimer *)aTimer
{
// Is there anyway to tell if this timer has already
// been "invalidated" in the operationComplete method?
}

Perhaps there is something clever I can do with the timer's  
userInfo variable or something?



Just to let others to know, we have already solved this in the  
CocoaAsyncSocket class pages of code.google.com.


Basically what we have to do is to use the userInfo property of the  
timer to store a collection (for example a dictionary) with  
information of its state. When we "invalidate" the timer by setting  
its fire date to the distant future in the operationComplete method,  
we should also set a flag in the userInfo dictionary so we will know  
its state in the doTimeout method, in case the timer was already  
scheduled to fire and it does. That's the easier approach.


Joan Lluch-Zorrilla



___

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

Please do not post admin requests or moderator comments to the list.
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: NSDate isEqual to...

2009-03-20 Thread Mike Abdullah


On 20 Mar 2009, at 21:17, Charles E. Heizer wrote:


Thanks,
No it's just playing around right now. It would be nice to be able  
to specify if you wanted NSDate to be sub-second or second precision  
based.


Just as question, can NSDate be overridden to be second precision  
based?


Theoretically yes. Practically, it would be a rather bad idea. 1  
second is meaningful to you, but consider a completely different  
culture's calendaring system where "a second" is actually equivalent  
to 3 of ours seconds. What would second precision be then?


The point is that you don't really want to test the equality of two  
dates. Instead you want to compare them like so:


date1 >= date2
date1 <= date2

Or you want to know if they're roughly equal to each other. "Is date1  
within 0.5 seconds of date2"


___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread Boyd Collier
In a program I've been developing, I make a lot of use of matrices of  
doubles, and I've written some straight-forward code for doing this  
that might be of interest to you.  If you're interested, I'd be happy  
to send it to you.


Boyd



On Mar 20, 2009, at 11:33 AM, James Maxwell wrote:

I've been using NSData to wrap up float arrays and matrices, so I  
can pass them around my methods and classes.
However, I'm finding they're using loads of memory. Now, I do admit  
this is probably because I'm not doing this properly, so I'd like  
some clarification. The NSData objects are instance variables, and I  
need to be able to perform operations on the float arrays/matrices  
inside, and have these operations permanently change the state of  
the array/matrix.


I've been doing something like:

- (NSData *) doSomethingToFloatData
{
   float stuff[20];

   [[self floatData] getBytes:stuff];

   // do something to change the float values in stuff

   [self setFloatData:[NSData dataWithBytes:stuff length:(20 *  
sizeof(float))]];


   return [self floatData];
}

But this seems like a memory hungry way of doing things (even though  
setFloatData is a "properly written" accessor, I think, and does  
release the current copy "m_floatData" before storing the new one).  
Is there any way to just operate on the float array "in place", so  
to speak? Do I really need the "[self setFloatData]" call, if I want  
the changes to stuff to be retained?


Just in case there's a problem with the accessor, I'm doing  
something like this:


- (void) setFloatData:(NSData *) theData
{
   if(m_floatData)
   [m_floatData release];
   m_floatData = [theData retain];
}

This is how I've seen it done in the Apple docs, but maybe this  
isn't the best way to do things...(??)


Keep in mind, I'm from a Java background, so I may be missing some  
things that would be obvious to a C expert... I'm also open to a  
totally different way of doing all this, with the one caveat that  
the float arrays and matrices can get fairly large, and I'm running  
through lots of them (i.e., NSMutableArrays will likely be too slow  
and awkward). Would NSValue be more convenient?


J.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bcollier%40sunstroke.sdsu.edu

This email sent to bcoll...@sunstroke.sdsu.edu



___

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

Please do not post admin requests or moderator comments to the list.
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


Is there an iPhone mailing list?

2009-03-20 Thread Steve Wetzel
Hey, I have a UITouch question and I am wondering if there is a mail  
list specifically for the iPhone.  Is there?


Steve
___

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

Please do not post admin requests or moderator comments to the list.
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


CAAnimation - Letting it run without stopping when new animation is activated

2009-03-20 Thread Filip van der Meeren

Good evening (for me it is ;-) ),

I am trying to make a cool visual effect, to allow for this I need to  
be able to start a CAAnimation for a CALayer positioning and keep it  
running until it is done...


And here comes the tricky part, it needs to run even when other  
animations are activated within the same layer. The animations are  
triggered at different moments in time, I have tried to find a  
solution. But each time the animation stops when another is activated.


Any help here is welcome...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

Please do not post admin requests or moderator comments to the list.
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: NSDate isEqual to...

2009-03-20 Thread mm w
Right the comment of Mike is fair,
I don't know what you are doing (a lie), anyway your interest is to
know a time interval rather than a date

you should design a object with a referential start-time:

CFAbsoluteTime timeNow(void)
{
return (CFAbsoluteTime) (CFAbsoluteTimeGetCurrent() -
kCFAbsoluteTimeIntervalSince1970);
// you have similar access thru Cocoa
}

and use only NSDate (rather than to play with it, it's also a main
memory consumer) to make a representation of this time interval at
(T), I think it will save you a lot of pain
for the next time... :)

Cheers!

On Fri, Mar 20, 2009 at 2:50 PM, Mike Abdullah
 wrote:
>
> On 20 Mar 2009, at 21:17, Charles E. Heizer wrote:
>
>> Thanks,
>> No it's just playing around right now. It would be nice to be able to
>> specify if you wanted NSDate to be sub-second or second precision based.
>>
>> Just as question, can NSDate be overridden to be second precision based?
>
> Theoretically yes. Practically, it would be a rather bad idea. 1 second is
> meaningful to you, but consider a completely different culture's calendaring
> system where "a second" is actually equivalent to 3 of ours seconds. What
> would second precision be then?
>
> The point is that you don't really want to test the equality of two dates.
> Instead you want to compare them like so:
>
> date1 >= date2
> date1 <= date2
>
> Or you want to know if they're roughly equal to each other. "Is date1 within
> 0.5 seconds of date2"
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com
>
> This email sent to openspec...@gmail.com
>



-- 
-mmw
___

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

Please do not post admin requests or moderator comments to the list.
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: Is there an iPhone mailing list?

2009-03-20 Thread Randall Meadows

On Mar 20, 2009, at 4:39 PM, Steve Wetzel wrote:

Hey, I have a UITouch question and I am wondering if there is a mail  
list specifically for the iPhone.  Is there?


Well, there is the official developer forum, if you're a registered  
iPhone developer at .


If you're not a registered developer, there are other unofficial  
forums: 

___

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

Please do not post admin requests or moderator comments to the list.
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: NSData confusion

2009-03-20 Thread mm w
on the backside,  for this kind of game, sometimes is good to know to
use C rather than
object/scalar layers, and use only an object to represent the final result.

Cheers!

On Fri, Mar 20, 2009 at 2:57 PM, Boyd Collier
 wrote:
> In a program I've been developing, I make a lot of use of matrices of
> doubles, and I've written some straight-forward code for doing this that
> might be of interest to you.  If you're interested, I'd be happy to send it
> to you.
>
> Boyd
>
>
>
> On Mar 20, 2009, at 11:33 AM, James Maxwell wrote:
>
>> I've been using NSData to wrap up float arrays and matrices, so I can pass
>> them around my methods and classes.
>> However, I'm finding they're using loads of memory. Now, I do admit this
>> is probably because I'm not doing this properly, so I'd like some
>> clarification. The NSData objects are instance variables, and I need to be
>> able to perform operations on the float arrays/matrices inside, and have
>> these operations permanently change the state of the array/matrix.
>>
>> I've been doing something like:
>>
>> - (NSData *) doSomethingToFloatData
>> {
>>   float stuff[20];
>>
>>   [[self floatData] getBytes:stuff];
>>
>>   // do something to change the float values in stuff
>>
>>   [self setFloatData:[NSData dataWithBytes:stuff length:(20 *
>> sizeof(float))]];
>>
>>   return [self floatData];
>> }
>>
>> But this seems like a memory hungry way of doing things (even though
>> setFloatData is a "properly written" accessor, I think, and does release the
>> current copy "m_floatData" before storing the new one). Is there any way to
>> just operate on the float array "in place", so to speak? Do I really need
>> the "[self setFloatData]" call, if I want the changes to stuff to be
>> retained?
>>
>> Just in case there's a problem with the accessor, I'm doing something like
>> this:
>>
>> - (void) setFloatData:(NSData *) theData
>> {
>>   if(m_floatData)
>>       [m_floatData release];
>>   m_floatData = [theData retain];
>> }
>>
>> This is how I've seen it done in the Apple docs, but maybe this isn't the
>> best way to do things...(??)
>>
>> Keep in mind, I'm from a Java background, so I may be missing some things
>> that would be obvious to a C expert... I'm also open to a totally different
>> way of doing all this, with the one caveat that the float arrays and
>> matrices can get fairly large, and I'm running through lots of them (i.e.,
>> NSMutableArrays will likely be too slow and awkward). Would NSValue be more
>> convenient?
>>
>> J.
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> http://lists.apple.com/mailman/options/cocoa-dev/bcollier%40sunstroke.sdsu.edu
>>
>> This email sent to bcoll...@sunstroke.sdsu.edu
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com
>
> This email sent to openspec...@gmail.com
>



-- 
-mmw
___

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

Please do not post admin requests or moderator comments to the list.
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: Customization of NSSavePanel

2009-03-20 Thread Benjamin Dobson


On 20 Mar 2009, at 13:39:42, Sourabh Sahu wrote:


Hi Everyone,
I am trying to customize NSSavePanel using method  
prepareSavePanel,but I want NSSavePanel browsing feature to be  
disabled that is user cannot change the directory ,apart from it I  
also want NSSavePanel to show file of any particular type,suppose I  
want to show only text files.all other files should get hide.

Thanks in advance,
-Sourabh


NSSavePanel does not and should not hide files. The file system in  
NSSavePanel/NSOpenPanel looks the same as in the Finder – that's how  
it's meant to be. It also allows users to place files where they like.  
That's pretty much the point.


Given that you don't seem to want *any* of the features of  
NSSavePanel, why not just bring up a dialog box with a text field for  
the filename and a "Save" and "Cancel" button? That's all you seem to  
want of the built-in functions, so just do that.___


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

Please do not post admin requests or moderator comments to the list.
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: NSDate isEqual to...

2009-03-20 Thread Shawn Erickson
On Fri, Mar 20, 2009 at 2:17 PM, Charles E. Heizer  wrote:
> Thanks,
> No it's just playing around right now. It would be nice to be able to
> specify if you wanted NSDate to be sub-second or second precision based.
>
> Just as question, can NSDate be overridden to be second precision based?

You could add a category (say isEqualToDateUsingSecondResolution:) to
do that with code like the following...

if (fabs([someDate timeIntervalSinceDate:someOtherDate]) < 1.0) {
   // equal ignoring sub-second resolution
}

-Shawn
___

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

Please do not post admin requests or moderator comments to the list.
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: CAAnimation - Letting it run without stopping when new animation is activated

2009-03-20 Thread Matt Long
Use animation grouping. I you use groups, set beginTime with your  
offset for each animation's time to start. The duration of each  
animation must be the full duration of the entire animation put  
together end to end. Your group animation should also have the same  
duration. Here's some pseudo code.


[animation1 setDuration:15];
[animation1 setBeginTime:0];

[animation2 setDuration:15];
[animation2 setBeginTime:5];

[animation3 setDuration:15];
[animation3 setBeginTime:10];

[animationGroup setDuration:15];
[animationGroup setAnimations[NSArray arrayWithObjects:animation1,  
animation2, animation3, nil]];


[layer addAnimation:animationGroup forKey:nil];

hth,

-Matt



On Mar 20, 2009, at 4:45 PM, Filip van der Meeren wrote:


Good evening (for me it is ;-) ),

I am trying to make a cool visual effect, to allow for this I need  
to be able to start a CAAnimation for a CALayer positioning and keep  
it running until it is done...


And here comes the tricky part, it needs to run even when other  
animations are activated within the same layer. The animations are  
triggered at different moments in time, I have tried to find a  
solution. But each time the animation stops when another is activated.


Any help here is welcome...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

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

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

This email sent to matt.l...@matthew-long.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: CAAnimation - Letting it run without stopping when new animation is activated

2009-03-20 Thread Filip van der Meeren

Will that work with animations that are already running?
I mean, if there are 2 or 3 animations running, and I kick off a 4th,  
won't that stop the 3 that are already running?


Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 21 Mar 2009, at 00:07, Matt Long wrote:

Use animation grouping. I you use groups, set beginTime with your  
offset for each animation's time to start. The duration of each  
animation must be the full duration of the entire animation put  
together end to end. Your group animation should also have the same  
duration. Here's some pseudo code.


[animation1 setDuration:15];
[animation1 setBeginTime:0];

[animation2 setDuration:15];
[animation2 setBeginTime:5];

[animation3 setDuration:15];
[animation3 setBeginTime:10];

[animationGroup setDuration:15];
[animationGroup setAnimations[NSArray arrayWithObjects:animation1,  
animation2, animation3, nil]];


[layer addAnimation:animationGroup forKey:nil];

hth,

-Matt



On Mar 20, 2009, at 4:45 PM, Filip van der Meeren wrote:


Good evening (for me it is ;-) ),

I am trying to make a cool visual effect, to allow for this I need  
to be able to start a CAAnimation for a CALayer positioning and  
keep it running until it is done...


And here comes the tricky part, it needs to run even when other  
animations are activated within the same layer. The animations are  
triggered at different moments in time, I have tried to find a  
solution. But each time the animation stops when another is  
activated.


Any help here is welcome...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

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

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

This email sent to matt.l...@matthew-long.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: CAAnimation - Letting it run without stopping when new animation is activated

2009-03-20 Thread Matt Long
It won't stop them unless the fourth animation is animating the same  
property as one of your other three. In that case you can just grab  
the in-flight value of that property from the layer's  
presentationLayer and set that as your fourth animation's fromValue.


-Matt


On Mar 20, 2009, at 5:16 PM, Filip van der Meeren wrote:


Will that work with animations that are already running?
I mean, if there are 2 or 3 animations running, and I kick off a  
4th, won't that stop the 3 that are already running?


Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 21 Mar 2009, at 00:07, Matt Long wrote:

Use animation grouping. I you use groups, set beginTime with your  
offset for each animation's time to start. The duration of each  
animation must be the full duration of the entire animation put  
together end to end. Your group animation should also have the same  
duration. Here's some pseudo code.


[animation1 setDuration:15];
[animation1 setBeginTime:0];

[animation2 setDuration:15];
[animation2 setBeginTime:5];

[animation3 setDuration:15];
[animation3 setBeginTime:10];

[animationGroup setDuration:15];
[animationGroup setAnimations[NSArray arrayWithObjects:animation1,  
animation2, animation3, nil]];


[layer addAnimation:animationGroup forKey:nil];

hth,

-Matt



On Mar 20, 2009, at 4:45 PM, Filip van der Meeren wrote:


Good evening (for me it is ;-) ),

I am trying to make a cool visual effect, to allow for this I need  
to be able to start a CAAnimation for a CALayer positioning and  
keep it running until it is done...


And here comes the tricky part, it needs to run even when other  
animations are activated within the same layer. The animations are  
triggered at different moments in time, I have tried to find a  
solution. But each time the animation stops when another is  
activated.


Any help here is welcome...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

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

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

This email sent to matt.l...@matthew-long.com






___

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

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

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

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


Re: Cocoa-dev Digest, Vol 6, Issue 415

2009-03-20 Thread Tim McGaughy


On Mar 18, 2009, at 4:31 PM, Ken Taylor wrote:


help


The best advice I can give, given your description of your problem, is 
that you sell your computer and never get another one.


___

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

Please do not post admin requests or moderator comments to the list.
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: CAAnimation - Letting it run without stopping when new animation is activated

2009-03-20 Thread Filip van der Meeren
As far as I understand you, you can't group animations of different  
layers, and let them run concurrently?

Because that is what I need.

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 21 Mar 2009, at 00:24, Matt Long wrote:

It won't stop them unless the fourth animation is animating the same  
property as one of your other three. In that case you can just grab  
the in-flight value of that property from the layer's  
presentationLayer and set that as your fourth animation's fromValue.


-Matt


On Mar 20, 2009, at 5:16 PM, Filip van der Meeren wrote:


Will that work with animations that are already running?
I mean, if there are 2 or 3 animations running, and I kick off a  
4th, won't that stop the 3 that are already running?


Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 21 Mar 2009, at 00:07, Matt Long wrote:

Use animation grouping. I you use groups, set beginTime with your  
offset for each animation's time to start. The duration of each  
animation must be the full duration of the entire animation put  
together end to end. Your group animation should also have the  
same duration. Here's some pseudo code.


[animation1 setDuration:15];
[animation1 setBeginTime:0];

[animation2 setDuration:15];
[animation2 setBeginTime:5];

[animation3 setDuration:15];
[animation3 setBeginTime:10];

[animationGroup setDuration:15];
[animationGroup setAnimations[NSArray arrayWithObjects:animation1,  
animation2, animation3, nil]];


[layer addAnimation:animationGroup forKey:nil];

hth,

-Matt



On Mar 20, 2009, at 4:45 PM, Filip van der Meeren wrote:


Good evening (for me it is ;-) ),

I am trying to make a cool visual effect, to allow for this I  
need to be able to start a CAAnimation for a CALayer positioning  
and keep it running until it is done...


And here comes the tricky part, it needs to run even when other  
animations are activated within the same layer. The animations  
are triggered at different moments in time, I have tried to find  
a solution. But each time the animation stops when another is  
activated.


Any help here is welcome...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to matt.l...@matthew-long.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


Fwd: CAAnimation - Letting it run without stopping when new animation is activated

2009-03-20 Thread Filip van der Meeren

Never mind, your idea works like a charm...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

Begin forwarded message:


From: Filip van der Meeren 
Date: Sat 21 Mar 2009 00:32:03 GMT+01:00
To: Matt Long 
Cc: Cocoa-dev@lists.apple.com
Subject: Re: CAAnimation - Letting it run without stopping when new  
animation is activated


As far as I understand you, you can't group animations of different  
layers, and let them run concurrently?

Because that is what I need.

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 21 Mar 2009, at 00:24, Matt Long wrote:

It won't stop them unless the fourth animation is animating the  
same property as one of your other three. In that case you can just  
grab the in-flight value of that property from the layer's  
presentationLayer and set that as your fourth animation's fromValue.


-Matt


On Mar 20, 2009, at 5:16 PM, Filip van der Meeren wrote:


Will that work with animations that are already running?
I mean, if there are 2 or 3 animations running, and I kick off a  
4th, won't that stop the 3 that are already running?


Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 21 Mar 2009, at 00:07, Matt Long wrote:

Use animation grouping. I you use groups, set beginTime with your  
offset for each animation's time to start. The duration of each  
animation must be the full duration of the entire animation put  
together end to end. Your group animation should also have the  
same duration. Here's some pseudo code.


[animation1 setDuration:15];
[animation1 setBeginTime:0];

[animation2 setDuration:15];
[animation2 setBeginTime:5];

[animation3 setDuration:15];
[animation3 setBeginTime:10];

[animationGroup setDuration:15];
[animationGroup setAnimations[NSArray  
arrayWithObjects:animation1, animation2, animation3, nil]];


[layer addAnimation:animationGroup forKey:nil];

hth,

-Matt



On Mar 20, 2009, at 4:45 PM, Filip van der Meeren wrote:


Good evening (for me it is ;-) ),

I am trying to make a cool visual effect, to allow for this I  
need to be able to start a CAAnimation for a CALayer positioning  
and keep it running until it is done...


And here comes the tricky part, it needs to run even when other  
animations are activated within the same layer. The animations  
are triggered at different moments in time, I have tried to find  
a solution. But each time the animation stops when another is  
activated.


Any help here is welcome...

Thank you,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to matt.l...@matthew-long.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/filip%40code2develop.com

This email sent to fi...@code2develop.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


Send events to AppleScript

2009-03-20 Thread Тимофей Даньшин

Hello.
Is it at all possible to have an application send actions to a  
particular AppleScript script, or set that script as a delegate of  
that application or to have an AppleScript as a means of communication  
between two applications (one of which is mine, and the other isn't)?


Thank you in advance for your replies.

Timofey.
___

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

Please do not post admin requests or moderator comments to the list.
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: NSDate isEqual to...

2009-03-20 Thread Charles E. Heizer
Thanks a bunch for clearing this all up for me. I have converted my  
test code to use "timeIntervalSince1970" and it appears to be working  
fine. My main concern is  starting from a specific point in time and  
then have a reliable and consistent interval to count on.


Thanks again,
Charles




On Mar 20, 2009, at 3:46 PM, mm w wrote:


Right the comment of Mike is fair,
I don't know what you are doing (a lie), anyway your interest is to
know a time interval rather than a date

you should design a object with a referential start-time:

CFAbsoluteTime timeNow(void)
{
return (CFAbsoluteTime) (CFAbsoluteTimeGetCurrent() -
kCFAbsoluteTimeIntervalSince1970);
// you have similar access thru Cocoa
}

and use only NSDate (rather than to play with it, it's also a main
memory consumer) to make a representation of this time interval at
(T), I think it will save you a lot of pain
for the next time... :)

Cheers!

On Fri, Mar 20, 2009 at 2:50 PM, Mike Abdullah
 wrote:


On 20 Mar 2009, at 21:17, Charles E. Heizer wrote:


Thanks,
No it's just playing around right now. It would be nice to be able  
to
specify if you wanted NSDate to be sub-second or second precision  
based.


Just as question, can NSDate be overridden to be second precision  
based?


Theoretically yes. Practically, it would be a rather bad idea. 1  
second is
meaningful to you, but consider a completely different culture's  
calendaring
system where "a second" is actually equivalent to 3 of ours  
seconds. What

would second precision be then?

The point is that you don't really want to test the equality of two  
dates.

Instead you want to compare them like so:

date1 >= date2
date1 <= date2

Or you want to know if they're roughly equal to each other. "Is  
date1 within

0.5 seconds of date2"

___

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

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

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


This email sent to openspec...@gmail.com





--
-mmw



___

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

Please do not post admin requests or moderator comments to the list.
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: q's regarding appropriate use of core data?

2009-03-20 Thread Ben Trumbull
I have made my way through the documentation to core data and am  
really
excited to start using it.  I have a couple of Q's about if my  
particular

scenario is appropriate for core data, or if I'm forcing the wrong
technology for the job.  I suspect that discussing anything related  
to sdk

iphone 3.0 is off limits, so i will skirt around that.


Questions pertaining to any pre-release or NDA material should be  
addressed on the Apple Developer Forums intended for that express  
purpose.


- Ben

___

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

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

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

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


Re: NSDate isEqual to...

2009-03-20 Thread Charles Srstka

On Mar 20, 2009, at 6:54 PM, Charles E. Heizer wrote:

Thanks a bunch for clearing this all up for me. I have converted my  
test code to use "timeIntervalSince1970" and it appears to be  
working fine. My main concern is  starting from a specific point in  
time and then have a reliable and consistent interval to count on.


Thanks again,
Charles


It really sounds to me like you might want to look at NSTimer.

Charles
___

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

Please do not post admin requests or moderator comments to the list.
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: [Q] "auto"-incrementing integer attribute in awakeFromInsert

2009-03-20 Thread Sean McBride
On 3/19/09 10:09 AM, Jon C. Munson II said:

>I did some digging and found that the real issue is the call for
>processPendingChanges that apparently is called via the executeFetch.
>According to what I read this is standard behavior.
>
>So, I'd have to say it isn't a "bug" in this case.

Well, 'bug' can mean many things.  :)  Months ago, I used a DTS incident
on this topic, and was told by DTS that the 'item appearing twice in the
table if you fetch in awakeFromInsert' situation (that you saw) is a bug
in NSArrayController.

I agree with you that it is kludgy to have to use
performSelector:withObject:afterDelay:.  Such a situation is exactly
when you should file a bug/enhancement request.

Have you tested undo after switching to
performSelector:withObject:afterDelay:?  You may find that undo will
only undo the setting of the 'auto-incremented' integer attribute.  I
suspect this is because performSelector:withObject:afterDelay: runs on a
different pass through the event loop.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

Please do not post admin requests or moderator comments to the list.
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: Send events to AppleScript

2009-03-20 Thread has

Re: Send events to AppleScript


Is it at all possible to have an application send actions to a
particular AppleScript script,


Yes. See NSAppleScript/OSAKit/Carbon OSA APIs. There's a sample  
project in the objc-appscript repository, CallAppleScriptHandler, that  
provides a simple demonstration of calling script handlers from ObjC,  
using appscript's AEM APIs to simplify the process of converting Cocoa  
objects to/from NSAppleEventDescriptors.




or set that script as a delegate of that application


Depends exactly what you mean by 'delegation'. The OSA API provides a  
whole bunch of arcane selectors and callbacks for two-way intra- 
process integration between application and scripts, but whether it's  
appropriate/how to use it will depend on exactly what you're trying to  
achieve.




or to have an AppleScript as a means of communication
between two applications (one of which is mine, and the other isn't)?


Yes, although if you don't need the IPC code to be user-configurable,  
you'll likely find it simpler to use an ObjC-Apple event bridge:  
either Scripting Bridge, which is included in 10.5+, or objc- 
appscript, which you'll need to build yourself, but is more capable,  
compatible and portable, and doesn't obfuscate everything to heck.


HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

Please do not post admin requests or moderator comments to the list.
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: q's regarding appropriate use of core data?

2009-03-20 Thread Darren Minifie
Thanks for the reply charles.  Yeah I thought about doing this as a web
service and that is an option.  Our main concern is the case where web
access isn't available.  Here it would be good to have a local copy.

On Fri, Mar 20, 2009 at 5:02 PM, Ben Trumbull  wrote:

> I have made my way through the documentation to core data and am really
>> excited to start using it.  I have a couple of Q's about if my particular
>> scenario is appropriate for core data, or if I'm forcing the wrong
>> technology for the job.  I suspect that discussing anything related to sdk
>> iphone 3.0 is off limits, so i will skirt around that.
>>
>
> Questions pertaining to any pre-release or NDA material should be addressed
> on the Apple Developer Forums intended for that express purpose.
>
> - Ben
>
>


-- 
Darren Minifie
Graduate Studies: Computer Science
www.myavalon.ca
www.ohsnapmusic.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: Is there an iPhone mailing list?

2009-03-20 Thread Roland King
if it's Cocoa Touch and it's to do with released iPhone software (ie  
up to 2.2.1) you can ask it here too, although the expertise here is  
more about classic cocoa than Cocoa Touch so you may not get a reply.  
If it's unreleased software (ie 3.0 beta) the only legitimate place to  
ask it is on the apple developer lists.


On Mar 21, 2009, at 6:39 AM, Steve Wetzel wrote:

Hey, I have a UITouch question and I am wondering if there is a mail  
list specifically for the iPhone.  Is there?


Steve
___

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

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

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

This email sent to r...@rols.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: Is there an iPhone mailing list?

2009-03-20 Thread Dave DeLong
He means the Apple Developer Forums.  Talking about unreleased  
software on this list is strictly moderated by the List Gods.


Dave

On Mar 20, 2009, at 7:54 PM, Roland King wrote:

...If it's unreleased software (ie 3.0 beta) the only legitimate  
place to ask it is on the apple developer lists.

___

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

Please do not post admin requests or moderator comments to the list.
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: Is there an iPhone mailing list?

2009-03-20 Thread Roland King

True - I do - sloppy terminology

I mean this one

https://devforums.apple.com/community/iphone

is the only place for talking about unreleased software and may or may  
not be a good place for talking about released iPhone software too.


On Mar 21, 2009, at 9:56 AM, Dave DeLong wrote:

He means the Apple Developer Forums.  Talking about unreleased  
software on this list is strictly moderated by the List Gods.


Dave

On Mar 20, 2009, at 7:54 PM, Roland King wrote:

...If it's unreleased software (ie 3.0 beta) the only legitimate  
place to ask it is on the apple developer lists.

___

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

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

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

This email sent to r...@rols.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: Send events to AppleScript

2009-03-20 Thread has


On Mar 21, 2009, at 1:06 AM, Тимофей Даньшин wrote:


On Mar 21, 2009, at 3:34 AM, has wrote:


Is it at all possible to have an application send actions to a
particular AppleScript script,


Yes. See NSAppleScript/OSAKit/Carbon OSA APIs. There's a sample  
project in the objc-appscript repository, CallAppleScriptHandler,  
that provides a simple demonstration of calling script handlers  
from ObjC, using appscript's AEM APIs to simplify the process of  
converting Cocoa objects to/from NSAppleEventDescriptors.


Sorry for misleading you, i rather meant "receive events" from third  
party applications.


If you want to run an AppleScript as a standalone application and send  
it events from other applications, save your script in Script Editor  
as a 'stay open' application. As for sending events from Cocoa(?) apps  
to this applet; there's a couple ways you could arrange that, but  
you'd need to provide more details on what the setup needs to do if  
you want specific advice.


Or do you mean that you want to write a Cocoa application that  
forwards some/all incoming events to an embedded AppleScript? In that  
case you want either NSAppleEventManager, or possibly Cocoa Scripting,  
to handle incoming events, and NSAppleScript or OSAKit to host the  
script, and write some glue code to go inbetween.




or set that script as a delegate of that application


Depends exactly what you mean by 'delegation'. The OSA API provides  
a whole bunch of arcane selectors and callbacks for two-way intra- 
process integration between application and scripts, but whether  
it's appropriate/how to use it will depend on exactly what you're  
trying to achieve.


By delegation I mean the form of delegation that is present in  
Objective-C, when one can register one's object with another object  
as it's delegate and receive messages from in on certain occasions,  
such as textViewDidChangeSelection:


That's pretty much what the OSA API was designed to do [1] - allow a C/ 
C++/ObjC application to load a script and invoke its handlers (what  
AppleScripters call 'attachability'). See Folder actions, Mail rule  
scripts, etc. Satimage Smile, for example, provides a great  
demonstration of just how far you can go with this sort of thing.


HTH

has

[1] With the caveat that the OSA API is somewhat over-complicated,  
under-documented, lame in parts, and only really practical for  
AppleScript despite being theoretically language agnostic.


--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

Please do not post admin requests or moderator comments to the list.
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


NSWorkspace -launchApplication fails to launch, but no error

2009-03-20 Thread Erg Consultant
I try to launch an application by passing a full POSIX path to NSWorkspace 
-launchApplication: on 10.3.9 but it fails.

I have built my app using the 10.4 SDK and tried it targeting both 10.3 & 10.4 
as deployment since I have some newer 10.4 routines which won't work on 10.3. I 
also check each API for NULL before calling it.

When NSWorkspace -launchApplication:runs, it returns YES indicating launch, but 
my app never runs. Double-clicking my app runs it and then it quits immediately 
with no errors. I've checked all my frameworks and weak linking, but 
-launchApplication doesn't work.

My app runs fine on 10.4. and 10.5. But on 10.3 won't launch.

What gives?

Erg



  
___

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

Please do not post admin requests or moderator comments to the list.
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