CoteData pagination

2008-06-23 Thread Ian

Hi all,

I know this has been asked before... I've been searching and searching  
and RTFMing so I've seen the paper-trail of askees over the years...


Anyway, is there any way to query CoreData in chunks? I have a very  
large CoreData SQl store (>1 million) of managed objects and it's  
taking for ever (well, tens of minutes) to load it all in, never mind  
to search through it all.


NSFetchRequest has a very handy setFetchLimit selector but it's fairly  
useless (to my particular problem anyhow) without being able to  
specify an offset.


Being able to say "give me the first 1 rows" is cool and all, but  
not being able to say "give me the NEXT 1 rows" is a real pain.


I know CoreData is supposed to be able to handle billions (citation: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html 
 [search page text for "billions"]) of rows, but seriously, I'm not  
getting these results. Any more than a few tens of thousands of  
results and it's slow down city.


I think I have a solution... I'm about to embark on a testing run with  
using multiple stores... if I hit more than umpteen thousand records,  
I'll just create a new store and stick the new rows in there... this  
way, when the user performs a search, I can query the first store,  
present the results, then append the results of searching subsequent  
stores as they become available. At least in this way the user has  
something to be looking at while the rest of the search is performed.


I know this way of doing things is tantamount to spinning plates, but  
it's gotta be worth a shot right?


So, my question is... does any bright soul have any light to shed, any  
experiences to share, etc etc, with manipulating very large data sets  
in CoreData?


Yours, extremely grateful for any advice,
Ian



___

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

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

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

This email sent to [EMAIL PROTECTED]


CoreData pagination [was: CoteData pagination]

2008-06-23 Thread Ian

LOL - CoreData, not CoteData, you knew what I meant I'm sure!

On 24 Jun 2008, at 01:11, Ian wrote:


Hi all,

I know this has been asked before... I've been searching and  
searching and RTFMing so I've seen the paper-trail of askees over  
the years...


Anyway, is there any way to query CoreData in chunks? I have a very  
large CoreData SQl store (>1 million) of managed objects and it's  
taking for ever (well, tens of minutes) to load it all in, never  
mind to search through it all.


NSFetchRequest has a very handy setFetchLimit selector but it's  
fairly useless (to my particular problem anyhow) without being able  
to specify an offset.


Being able to say "give me the first 1 rows" is cool and all,  
but not being able to say "give me the NEXT 1 rows" is a real  
pain.


I know CoreData is supposed to be able to handle billions (citation: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html 
 [search page text for "billions"]) of rows, but seriously, I'm not  
getting these results. Any more than a few tens of thousands of  
results and it's slow down city.


I think I have a solution... I'm about to embark on a testing run  
with using multiple stores... if I hit more than umpteen thousand  
records, I'll just create a new store and stick the new rows in  
there... this way, when the user performs a search, I can query the  
first store, present the results, then append the results of  
searching subsequent stores as they become available. At least in  
this way the user has something to be looking at while the rest of  
the search is performed.


I know this way of doing things is tantamount to spinning plates,  
but it's gotta be worth a shot right?


So, my question is... does any bright soul have any light to shed,  
any experiences to share, etc etc, with manipulating very large data  
sets in CoreData?


Yours, extremely grateful for any advice,
Ian



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData pagination

2008-06-24 Thread Ian
Here are my findings thanks to the great advice to all those that  
answered.


First and foremost - I was testing on an elderly G5 iMac, so fetching  
~million objects was taking 4 minutes.

I think this is definitely down to paging the VM as someone suggested.
Here on my main machine (8 cores, gigs of ram) the same fetch takes  
around 9 seconds.


Unbelievably I hadn't [request setIncludesPropertyValues:NO], so was  
getting properties on everything.
As I'm fetching primarily to feed an IKImageBrowserView, it makes  
sense to fault the data in when needed.

This brings my fetch down from 9 seconds to 0.5 - much nicer.

I was pulling in all objects with a predicateWithValue:YES.
Changing this to a predicate on an indexed UID (eg to get all, fetch  
where > 0) brings the query time down to 0.3 seconds.


Bringing in just IDs speeds things up even more.

All of the above is obvious I'm sure but great thanks are due for your  
suggestions and advice - I may not be a CoreData newbie but I  
certainly am rank amateur!


Thanks again to all,
Ian
___

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

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

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

This email sent to [EMAIL PROTECTED]


Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-06-30 Thread Ian

Hi all,

I've got a CoreData object graph with an outline view showing  
instances of an NSManagedObject subclass called "Group".
The Group class has the standard to-one relation 'parent' and to-many  
'children'.

The outline view is working perfectly.

I've set autosaveExpandedItems to YES and when I expand or unexpand  
(contract?) a group my outline view's data source gets sent the  
persistentObjectForItem message.


I can see in the prefs plist for my app that the expanded Group itmes  
are being saved, and when my application launches, the outline view's  
data source object gets sent the itemForPersistentObject message.


Below is what I'm doing for each of these messages:

- (id)outlineView:(NSOutlineView*)outlineView persistentObjectForItem: 
(id)item

{
NSNumber *uid=[[item representedObject] valueForKeyPath:@"uid"];
id archivedObject=[NSKeyedArchiver archivedDataWithRootObject:uid];
return archivedObject;
}

- (id)outlineView:(NSOutlineView *)outlineView itemForPersistentObject: 
(id)object

{
NSNumber *uid=[NSKeyedUnarchiver unarchiveObjectWithData:object];
NSManagedObjectContext *context=[self managedObjectContext];
NSFetchRequest *request=[[NSFetchRequest alloc] init];
	NSEntityDescription *groupEntityDescription=[NSEntityDescription  
entityForName:@"Group" inManagedObjectContext:context];

[request setEntity:groupEntityDescription];
	NSPredicate *predicate=[NSPredicate predicateWithFormat:@"uid== 
%@",uid];

[request setPredicate:predicate];
NSError *error;
	NSArray *fetchResults=[context executeFetchRequest:request  
error:&error];

if ([fetchResults count])
return [fetchResults objectAtIndex:0];
return nil;
}

The persistentObjectForItem method successfully archives and returns  
the 'uid' property for the item's represented object - this is a  
unique identifier for each of my Groups.


The itemForPersistentObject successfully reconstitutes the archived  
uid and correctly finds the Group with the unique 'uid' property and  
returns it.


Expanded items in the outline view are not being restored however.

Is itemForPersistentObject expecting me to return something else?
My guess would be that it was expecting an instance of NSTreeNode,  
since this is what I first got as 'item' in persistentObjectForItem.

Sadly though, I can't see a way to get an NSTreeNode from an object.
I have [item representedObject] for archival, but not [object  
representingItem], if you see what I mean.


Obviously I've tried returning an the 'item' archived but it doesn't  
respond to archiving.
Neither (obviously) does my NSManagedObject subclass... should I  
implement archiving in my subclass to get this to work?


Does anyone have any clue they can distribute my way? (citation: 
http://www.bofhcam.org/co-larters/distributing-clue/index.html)
I've seen lots in the usual places (lists.apple.com, cocoabuilder.com  
et al) about this but no actual solutions shout out at me. Perhaps I'm  
not looking hard enough. (most likely).


Many TIA
Ian

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-06-30 Thread Ian


On 1 Jul 2008, at 04:41, Andy Kim wrote:


Hi Ian,

I've got a CoreData object graph with an outline view showing  
instances of an NSManagedObject subclass called "Group".
The Group class has the standard to-one relation 'parent' and to- 
many 'children'.

The outline view is working perfectly.

I've set autosaveExpandedItems to YES and when I expand or unexpand  
(contract?) a group my outline view's data source gets sent the  
persistentObjectForItem message.


Collapse is the word used in the docs.

I can see in the prefs plist for my app that the expanded Group  
itmes are being saved, and when my application launches, the  
outline view's data source object gets sent the  
itemForPersistentObject message.


Below is what I'm doing for each of these messages:

- (id)outlineView:(NSOutlineView*)outlineView  
persistentObjectForItem:(id)item

{
NSNumber *uid=[[item representedObject] valueForKeyPath:@"uid"];
id archivedObject=[NSKeyedArchiver archivedDataWithRootObject:uid];
return archivedObject;
}

- (id)outlineView:(NSOutlineView *)outlineView  
itemForPersistentObject:(id)object

{
NSNumber *uid=[NSKeyedUnarchiver unarchiveObjectWithData:object];
NSManagedObjectContext *context=[self managedObjectContext];
NSFetchRequest *request=[[NSFetchRequest alloc] init];
	NSEntityDescription *groupEntityDescription=[NSEntityDescription  
entityForName:@"Group" inManagedObjectContext:context];

[request setEntity:groupEntityDescription];
	NSPredicate *predicate=[NSPredicate predicateWithFormat:@"uid== 
%@",uid];

[request setPredicate:predicate];
NSError *error;
	NSArray *fetchResults=[context executeFetchRequest:request  
error:&error];

if ([fetchResults count])
return [fetchResults objectAtIndex:0];
return nil;
}


The request object is not being released.


Thanks - that one slipped my notice.




The persistentObjectForItem method successfully archives and  
returns the 'uid' property for the item's represented object - this  
is a unique identifier for each of my Groups.


The itemForPersistentObject successfully reconstitutes the archived  
uid and correctly finds the Group with the unique 'uid' property  
and returns it.


Expanded items in the outline view are not being restored however.

Is itemForPersistentObject expecting me to return something else?
My guess would be that it was expecting an instance of NSTreeNode,  
since this is what I first got as 'item' in persistentObjectForItem.

Sadly though, I can't see a way to get an NSTreeNode from an object.
I have [item representedObject] for archival, but not [object  
representingItem], if you see what I mean.


Obviously I've tried returning an the 'item' archived but it  
doesn't respond to archiving.
Neither (obviously) does my NSManagedObject subclass... should I  
implement archiving in my subclass to get this to work?


Does anyone have any clue they can distribute my way? (citation: 
http://www.bofhcam.org/co-larters/distributing-clue/index.html)
I've seen lots in the usual places (lists.apple.com,  
cocoabuilder.com et al) about this but no actual solutions shout  
out at me. Perhaps I'm not looking hard enough. (most likely).


Many TIA
Ian


I have this working in my app and I'm doing almost exactly the same  
thing. I'm also using the UID as the persistent object so you don't  
have to return an archived version of your whole model object or the  
tree node.


I would check two things:

1. Are you setting the autosaveName to the outline view?


Yeah - I can se it in my app's prefs plist.




2. Maybe the outline view is trying to restore the expanded state  
before your tree controller has content? You said  
itemForPersistentObject returns the correct Group, but this actually  
happened to me before, so just making sure :)


No, it's fine:

(gdb) po fetchResults
<_PFArray 0x711bb90>(
 (entity: Group; id: 0x1dd560 > ; data: )

)





Beyond those two, if you still can't figure out why it's not  
working, saving and restoring expanded state of an outline view is a  
trivial task. I use the following bit of code in an NSOutlineView  
subclass to do just that:


- (id)expandedState
{
NSMutableArray *state = [NSMutableArray array];
NSInteger count = [self numberOfRows];
for (NSInteger row = 0; row < count; row++) {
id item = [self itemAtRow:row];
if ([self isItemExpanded:item])
			[state addObject:[[self dataSource] outlineView:self  
persistentObjectForItem:item]];

}
return state;
}

- (void)setExpandedState:(id)state
{
if ([state isKindOfClass:[NSArray class]] == NO) return;

// Collapse everything first
[self collapseItem:nil col

Re: Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-07-02 Thread Ian

On 1 Jul 2008, at 17:19, Ron Lue-Sang wrote:



On Jul 1, 2008, at 12:05 AM, Andy Kim wrote:

Thanks - I've seen solutions like this before, I just wanted to  
get it working the regular way!


I totally understand the sentiment.

Is itemForPersistentObject expecting an NSTreeNode? You say you  
have it working in a similar way - what does your  
itemForPersistentObject method return?


Many thanks
Ian


Here's what I do:

- (id)outlineView:(NSOutlineView *)ov itemForPersistentObject: 
(id)object

{
	return [[gAppDelegate library] groupWithUID:object]; // This  
fetches the group from the managed object context

}

- (id)outlineView:(NSOutlineView *)ov persistentObjectForItem: 
(id)item

{
return [item uid];
}

According to the docs I'm supposed to archive the persistent object  
before returning it, but in my case, it doesn't matter because it's  
just a string and it all goes into a plist anyway. I have tried it  
both ways after seeing your implementation though, and there are  
indeed no differences.


I see why you're thinking that you need to return a NSTreeNode  
though. I don't need to do that because I don't use a  
NSTreeController and instead implement the data source protocol in  
my custom controller. So for me the item is the model object itself.


In your case, I'm fairly positive that you do need to return the  
NSTreeNode object. Instead of fetching the model object, walk the  
controller's content tree looking for the right representedObject  
with the UID.


- Andy Kim



Andy, you're right.
Ian's code needs to return an NSTreeNode. Please file a bug that  
this is too hard.



I played around some more with this and came to the conclusion that  
it's impossible to implement auto saving of expanded items using  
itemForPersistentObject and persistentObjectForItem NSOutlineView  
delegate methods, when the outlineview has an NSTreeController as it's  
datasource.


The reason I think this, is that the outlineview is populated with  
instances of NSTreeNode. At application launch,  
persistentObjectForItem is called before the tree has been populated.  
I think what goes on behind the scenes, is that a record of which  
nodes are expanded and which are collapsed is saved in the app  
defaults, persistentObjectForItem is called to get the object in  
question and next time the outlineview 'sees' that object from it's  
datasource it knows whether to expand that node or not.


The trouble is, the outlineview will never 'see' *anything* you return  
in persistentObjectForItem since all it will ever see are NSTreeNode  
instances none of which exist yet.


Hope that makes sense! AFAIK, it's not just hard, but un-doable!

Thanks everyone for your help - I've gone over to the regular  
datasource way of doing things and everything's swell.


Cheers
Ian

___

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

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

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

This email sent to [EMAIL PROTECTED]


Nesting IKImageBrowser GroupStyles

2008-07-09 Thread Ian
The grouping feature of IKImageBrowserView seems to be one of the  
least documented but most powerful features I've seen in a while.
The only references I can find to using groups with IKImageBrowserView  
all point back to the scant info in the API docs.


Anyway, after getting it working with minimal effort, I wondered if it  
was possible to nest groups within each other?


The obvious example use would be to have IKGroupBezelStyle groups of  
"versions" of images (a la Aperture) inside IKGroupDisclosureStyle  
groups of "rolls" (a la iPhoto).


Judging by the silence on Google and the list archives I'm not  
expecting a flood of answers but if the people responsible for this  
cool IKImageBrowserView behavior are listening then at least this post  
will serve to let them know someone is using and appreciating their  
good work!


Cheers
Ian

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Nesting IKImageBrowser GroupStyles

2008-07-09 Thread Ian

On 10 Jul 2008, at 00:49, thomas goossens wrote:


Hi Ian,

On Jul 10, 2008, at 1:07 AM, Ian wrote:

The grouping feature of IKImageBrowserView seems to be one of the  
least documented but most powerful features I've seen in a while.





It is possible to add one or more bezel groups inside a disclosure  
group. But you can't have groups inside a bezel group or disclosure  
groups inside a group.




OK, my first thought was "rhhhtt, but how?".
Then it occurred to me - overlapping ranges!
Works perfectly.
I suppose it just took someone to say it was possible before I tried  
it myself. Shame on me.

Mind you - there wasn't exactly a lot to go on ;-)

Thanks a lot thomas, this is sweet stuff.

Cheers
Ian

___

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

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

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

This email sent to [EMAIL PROTECTED]


Core Data migration from xml to sqlite

2009-09-02 Thread Ian Kennedy

Hi all,

How would I go about doing a one-time migration of application data  
from an xml persistent store to a sqlite persistent store? i.e. the  
model stays the same, the data is migrated, and the app uses the  
sqlite store from there on out.


I've been unsuccessfully trying to do it inside of the  
persistentStoreCoordinator method by working with the example from  
here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingPersistentStores.html


Here is what I've tried, which doesn't migrate any data, just provides  
me with an empty sqlite store:


http://pastie.textmate.org/602152

Thanks for any help,
Ian
___

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

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


EXC_BAD_ACCESS in a Core Data application

2009-09-04 Thread Ian Piper

Hi all,

I have been putting together a Core Data application that has three  
windows. I wanted to control the appearance and disappearance of these  
windows during the course of the application, so added menu items and  
buttons with the action makeKeyAndOrderFront. However, I found that  
the program hung while running: specifically while re-opening a window  
that I had previously closed. The GDB message was 'Program received  
signal:  “EXC_BAD_ACCESS”.' I couldn't get very far with this: Tech  
Q&A 1367 said that it was probably the result of over-releasing an  
object. I couldn't see how that had happened, since I had really just  
gone with the code generated by Xcode: so I wasn't knowlingly  
releasing anything that I could see. However, after a bit more digging  
I realised that the problem was in IB: in the Window attributes I  
noticed that the Behaviour option "Release When Closed" was checked.  
When I unchecked this option the application ran fine - no hang.


I suppose that when I close the window it is released, so when I try  
to open it again there is nothing to open.


My questions are:

1. Why does a window default to having this option checked? It seems  
odd, since the auto-generated code seems to look after memory  
management and therefore this is more or less guaranteeing a problem.
2. What is the best strategy for tracking down this kind of problem? I  
tried using Instruments and that indeed showed a memory leak at the  
point that I tried to load this window, but I couldn't see how to use  
this information to zero in on the root cause.
3. Is there a way to attach a breakpoint to a UI action (such as  
clicking on the File menu, which is where the freeze happened)?
4. Without wishing to open any cans of worms, a Core Data application  
like this seems like a sensible place to use GC. Is that right?


Any illumination will be joyfully received.


Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383






___

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

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


Extract plain text content from a Text View

2009-10-16 Thread Ian Piper

Hi all,

Is there a way to get the plain text content out of an NSTextStorage  
object (displaying using a Text View) that contains rich text and  
images? I want to figure out a way to build a search predicate that  
will allow me to search a Text View and I think this is likely to be  
the only way.


Thanks,


Ian.
--

___

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

Please do not post admin requests or moderator comments to the list.
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: Extract plain text content from a Text View

2009-10-16 Thread Ian Piper


On 16 Oct 2009, at 20:51, I. Savant wrote:


On Oct 16, 2009, at 3:44 PM, I. Savant wrote:

I want to figure out a way to build a search predicate that will  
allow me to search a Text View and I think this is likely to be  
the only way.


Seems a bit odd. Could you elaborate?


 Let *me* elaborate on *that*. :-) You normally use predicates to  
filter objects in the model layer of your application. Note  
"normally". If you're trying to provide a way to search within a  
text view, this is a very strange way of going about it:


1 - NSTextView already takes advantage of the Find field.

2 - Searching for a substring inside a string with a predicate  
searches the *whole* string as one ... this is only really useful if  
your text view's content is made up of a bunch of smaller units, but  
then again ... see 1 above.


3 - The predicate would be used to filter an array of  
NSTextStorages, not one NSTextStorage, returning those which contain  
your search string.


4 - Related to 3: if you're searching text storages because you  
treat them as individual subunits in your model, it would likely  
make more sense to apply this filter to the model layer.


I will elaborate...

I have a Core Data application that has a Text View in its main  
window, and also has a Find field. I want to create a search field  
predicate to allow the user to search the text in the Text View. I'm  
interested in point 1 above, because I initially thought it made sense  
for an NSTextView to just work with the Find field, but I couldn't  
seem to get it working. That is what led me to wondering whether I  
could get at the string content in the NSTextView and search that  
instead. I'm happy to just use the inherent capabilities of  
NSTextField but I can't figure out what they are!


The Text View is simply used as a place for the user to put any rich  
text and or images. Is there a way either to search or to get all of  
the plain text out from such a Text View? It's probably a simplistic  
question and I rather suspect that ultimately the answer is no!



Ian.
--
___

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

Please do not post admin requests or moderator comments to the list.
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: Extract plain text content from a Text View

2009-10-16 Thread Ian Piper


On 17 Oct 2009, at 00:46, Charles Srstka wrote:


On Oct 16, 2009, at 5:42 PM, Ian Piper wrote:

The Text View is simply used as a place for the user to put any  
rich text and or images. Is there a way either to search or to get  
all of the plain text out from such a Text View? It's probably a  
simplistic question and I rather suspect that ultimately the answer  
is no!


As others have already said, you can get the plain text by just  
sending the -string message to the NSTextStorage object.


Charles


Yes - I had read the other comments. However I am not sure that I am  
communicating the problem effectively here. I don't think I have an  
NSTextStorage object. I am trying to build a search predicate binding  
in the Bindings Inspector. I seem to be able to add predicates like  
this (to enable filtering of entities containing a String attribute  
called entryName):


entryName contains[c] $value

This works fine and so my find panel finds records in my database that  
have appropriate text in those attributes. The problem comes with  
another attribute called entryContent. This is expressed in the user  
interface as an NSTextView and displays content stored in an NSData  
attribute. I am trying to understand whether there is a  
filterpredicate format like the one above that I can add to enable  
finding records that contain the specified text in that entryContent  
attribute. I have tried things like


entryContent contains[c] $value

but this renders the find box useless.

It seems to me that the filterPredicates that you build in IB's  
Inspector are referring to the attributes in the data model rather  
than the objects in the user interface, so I suppose I need to  
understand how you get text data out of an NSData attribute using a  
filterPredicate.


Failing that, a colleague has suggested to me that I could create a  
new Managed Object, write a custom accessor method to get out the text  
and then use that method in the filterpredicate definition. That is  
where I have been trying to understand how to get a string object out  
of the NSData attribute. When I create a custom Managed Object class I  
see these in the .h and .m files respectively:


@property (nonatomic, retain) NSData * entryContent;

@dynamic entryContent;

However I don't seem to be able to get at the string content of  
entryContent.


I'm sure I am complicating this unduly, but if someone could just  
spell this out I'd be grateful. I have looked with increasing  
bafflement at the Developer Documentation.


Regards,


Ian.
--

___

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

Please do not post admin requests or moderator comments to the list.
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: Extract plain text content from a Text View

2009-10-16 Thread Ian Piper


On 17 Oct 2009, at 05:18, Jens Alfke wrote:



On Oct 16, 2009, at 3:42 PM, Ian Piper wrote:

The Text View is simply used as a place for the user to put any  
rich text and or images. Is there a way either to search or to get  
all of the plain text out from such a Text View? It's probably a  
simplistic question and I rather suspect that ultimately the answer  
is no!


NSTextView (and its parent class NSText) have methods for doing find  
and replace, which is what the commands in the Find submenu are  
wired up to. They even select the target text, scroll to it and  
blink it for you.


That would suit me well if I could just understand how to tap into it.  
I can set up filterPredicates in IB for other attributes in my data  
model but not for the one that is displaying its content in the  
NSTextView.



If that's too high level, just get the string property of the  
NSTextStorage and use NSString methods for searching for substrings.


—Jens


I'd be equally happy to do this if I could see how to (see my other  
posting this morning)!



Ian.
--___

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

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


Calculating a total from a collection of numeric attributes

2009-10-17 Thread Ian Piper

Hi all,

I have a Core Data entity that has an attribute called charge (stored  
as a float). So I am storing a number of records each of which has a  
charge. I simply want to be able to show a running total of charges as  
I add or remove items. I was hoping that I might be able to use a  
simple binding for this: I created a label and thought I might be able  
to bind its value to array controller.arrangedObjects.charge.sum or  
something like that. No luck though.


I cannot see anything in the documentation or from searches. Can  
anyone point me towards either examples or documentation?



Thanks,


Ian.
--
___

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

Please do not post admin requests or moderator comments to the list.
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: Calculating a total from a collection of numeric attributes

2009-10-18 Thread Ian Piper


On 18 Oct 2009, at 15:45, I. Savant wrote:


On Oct 17, 2009, at 7:40 PM, Ian Piper wrote:

I have a Core Data entity that has an attribute called charge  
(stored as a float). So I am storing a number of records each of  
which has a charge. I simply want to be able to show a running  
total of charges as I add or remove items. I was hoping that I  
might be able to use a simple binding for this: I created a label  
and thought I might be able to bind its value to array  
controller.arrangedObjects.charge.sum or something like that. No  
luck though.


I cannot see anything in the documentation or from searches. Can  
anyone point me towards either examples or documentation?


 You want set and array operators:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html

 You really should read the KVC, KVO, Bindings, and Core Data guides  
front to back since there are terms you wouldn't otherwise know to  
search for. It's best to know you read about something but forget  
the specifics then to not read it at all and have no idea. :-)


Thanks for the reply. Since posting the message I found and read those  
documents and have that chapter open on my desktop right now. In case  
anyone else wants to do something similar the simplest description of  
the answer is to set a binding for the label like this:


[name of array controller].arrangedobjec...@sum.charge



Ian.
--

___

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

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

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

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


Problem writing unit tests - "Incompatible types in initialization"

2009-10-25 Thread Ian Piper

Hi,

I'm having a problem getting a unit test to run. It's quite a simple  
one, based on a sample project that I developed and that does actually  
work. It's loosely based on the Apple Temperature Converter project.


I have a Converter class that has a float property called  
originalTemperature. It also has a method called convertCToF that  
takes an originalTemperature and returns the converted temperature,  
also as a float. So I am calling this using temperatureInF =  
instanceOfConverter.convertCToF. As I say, this works fine.


I created a test case that creates an instance of Converter, then sets  
its originalTemp value, then tries to get back the converted  value:


testConverter = Converter.new;

[testConverter setValue:[NSNumber numberWithFloat:25.0]  
forKey:@"originalTemp"]; 	// Builds OK to here


NSNumber *newTemperatureInF = [testConverter convertCToF];	// This is  
where I get the error "Incompatible types in initialization"


STAssertEquals(77.0f, [newTemperatureInF floatValue], @"F value should  
be 25, and test value was %f", [newTemperatureInF floatValue]);


I am importing Converter.h in my TCTests.m file (where this method is  
located) and I have selected it for linking in the Detail pane for the  
project.
I'm confused because I am passing in a float, the method takes in and  
returns a float. NSNumber ought to be able to cope with a returned  
float. I'm clearly making a very basic error but have bashed my head  
against it to the point where I have the phrase "Incompatible types"  
in reverse burned onto my forehead. Google was not my friend on this  
occasion.


Can anyone guide me out of this black hole?

Thanks,


Ian.
--
___

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

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

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

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


Re: Problem writing unit tests - "Incompatible types in initialization"

2009-10-25 Thread Ian Piper

On 25 Oct 2009, at 20:13, Dave DeLong wrote:



On Oct 25, 2009, at 2:08 PM, Ian Piper wrote:

It also has a method called convertCToF that ... returns the  
converted temperature, also as a float.


NSNumber *newTemperatureInF = [testConverter convertCToF];	// This  
is where I get the error "Incompatible types in initialization"


An NSNumber (an object) is not the same thing as a float (a  
primitive).  The latter is a raw numerical value, and the former is  
an object that encapsulates a numerical value.


*Slaps forehead*. Thanks very much.


Ian.
--
___

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

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

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

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


Getting a handle on inf

2009-10-26 Thread Ian Piper

Hi all,

Following up on my query about unit tests yesterday... I am writing  
another test checking boundary conditions for a calculation. In the  
normal running program I am feeding a very large number  
(1000) into one text field and the  
result displayed in the other text field is "inf". I want to write a  
test to explore this, so I did this:


- (void)testVeryLargeNumberShouldReturnInf {
testConverter = Converter.new;

	[testConverter setValue:[NSNumber numberWithFloat: 
1000.0] forKey:@"originalTemp"];


	NSNumber *newTemperatureInC = [NSNumber numberWithFloat:(float) 
[testConverter convertFToC]];


	STAssertEquals("inf", [newTemperatureInC floatValue], @"Expecting  
inf; we got %f", [newTemperatureInC floatValue]);

[testTempConverter release];

}

When I run this test I see this message: Expecting inf; we got inf

I tried this:

STAssertEquals("inf", [newTemperatureInC stringValue], @"Expecting  
inf; we got %s", [newTemperatureInC stringValue]);


and saw this message: Expecting inf; we got ¿√Ωpˇ

So I am guessing that when I get a float displayed as "inf" this is  
not the string it seems to be. Also, it looks like the string value of  
whatever is coming back is not something that I can use. Can anyone  
suggest how I might handle a test case like this?


Thanks,


Ian.
--___

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

Please do not post admin requests or moderator comments to the list.
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: Getting a handle on inf

2009-10-26 Thread Ian Piper

On 26 Oct 2009, at 18:45, Greg Parker wrote:


On Oct 26, 2009, at 11:26 AM, Ian Piper wrote:
So I am guessing that when I get a float displayed as "inf" this is  
not the string it seems to be. Also, it looks like the string value  
of whatever is coming back is not something that I can use. Can  
anyone suggest how I might handle a test case like this?


As Kyle noted, -stringValue returns an NSString, not a char*. You'd  
need to compare to @"inf" and print with %...@.


Kyle, Greg,

Thanks for that. I tried it out:

- (void)testVeryLargeNumberShouldReturnInf {
testConverter = Converter.new;
	[testConverter setValue:[NSNumber numberWithFloat: 
1000.0] forKey:@"originalTemp"];
	NSNumber *newTemperatureInF = [NSNumber numberWithFloat:(float) 
[testConverter convertCToF]];
	STAssertEquals(@"inf", [newTemperatureInF stringValue], @"Expecting  
inf; we got %@", [newTemperatureInF stringValue]);

[testConverter release];
}

...and I still get a failed build with this message:

Expecting inf; we got inf

Which seems odd. When I look at the transcript for the test result it  
looks like this:


TCTests.m:58: error: -[TCTests testVeryLargeNumberShouldReturnInf] :  
'<28810c00 0100>' should be equal to '':  
Expecting inf; we got inf


So I am still not comparing apples with apples...


A better way to check for floating-point +infinity and -infinity is  
to use the isinf() macro.


   if (isinf([number floatValue])) {
   NSLog(@"number is +inf or -inf");
   }


That macro isn't part of OCUnit is it? I don't see it in the  
Documentation.



Ian.
--
___

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

Please do not post admin requests or moderator comments to the list.
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: Getting a handle on inf

2009-10-26 Thread Ian Piper

On 26 Oct 2009, at 19:46, Ken Thomases wrote:

You want STAssertEqualObjects, here.  You want to compare for equal  
value, not identity, which is what STAssertEquals does.


Greg, Ken,

Thanks, that is what I was looking for. Great help, thank you.


Ian.
--
___

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

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


Handling calculations with many decimal places

2009-11-03 Thread Ian Piper

Hi,

I am writing an implementation of the Brent-Salamin algorithm for  
calculating pi. I want to be able to display potentially a large  
number of decimal places in the result (hundreds at least). However I  
am finding that even using long double values in my calculation gives  
me only the first 50 or so decimal places. Is this a limitation of  
long double that I am running into here?


Should I be using NSDecimal instead to do this kind of calculation? If  
so, can anyone point me at a good example of its use as I am  
struggling with how to use it?


Thanks,


Ian.
--
___

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

Please do not post admin requests or moderator comments to the list.
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: Handling calculations with many decimal places

2009-11-03 Thread Ian Piper

On 3 Nov 2009, at 21:22, Greg Guerin wrote:


Ian Piper wrote:

I want to be able to display potentially a large number of decimal  
places in the result (hundreds at least).


Explanation and many links to libs:

http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

Any lib written in C or with C bindings would work in Objective-C.


Or look at the source for 'dc':

http://en.wikipedia.org/wiki/Dc_(computer_program)


Thanks - interesting stuff. Definitely beyond my capabilities at the  
moment! I have taken a look at the MAPM homepage (http://www.tc.umn.edu/~ringx004/mapm-main.html 
) and if I have some time I may try to see if I can compile that  
library on my Mac.


For now, I think I will rethink my ambitions in this area!


Ian.
--
___

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

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


AHGoToPage function

2009-11-07 Thread Ian Piper

Hi all,

I hope someone can illuminate me. I have been trying to follow the  
Developer Documentation example for AHGoToPage. I have connected a  
help button in the UI to an action called loadHelpForJournalEntry.  
This is intended to load a help file called index.html. The help files  
themselves work fine BTW. I have added this function and IBAction:



OSStatus MyGotoHelpPage (CFStringRef pagePath, CFStringRef anchorName)
{
CFBundleRef myApplicationBundle = NULL;
CFStringRef myBookName = NULL;
OSStatus err = noErr;

myApplicationBundle = CFBundleGetMainBundle();// 1
if (myApplicationBundle == NULL) {err = fnfErr; goto bail;}// 2

myBookName = CFBundleGetValueForInfoDictionaryKey(// 3


myApplicationBundle,
  
  
CFSTR("CFBundleHelpBookName"));
if (myBookName == NULL) {err = fnfErr; goto bail;}

if (CFGetTypeID(myBookName) != CFStringGetTypeID()) {// 4
err = paramErr;
}

	if (err == noErr) err = AHGotoPage (myBookName, pagePath,  
anchorName);// 5

bail:
return err;

}

- (IBAction) loadHelpForJournalEntry:(id)sender {
MyGoToHelpPage(CFSTR("index.html"), NULL);
}

The above is copied from the docs, though I had to add the bail: line.  
Anyway, this fails with the Build results errors shown below this  
message. I think the problem might be that I am not loading the  
appropriate library, but I can't figure out what that library is. The  
documentation seems to mention AppleHelp.h and refers to importing  
 but surely I don't need the Carbon Framework for  
implementing help do I?


I'm clearly misunderstanding something - any guidance would be  
appreciated.


Thanks,


Ian.
--



Build results errors

Build DailyJournal of project DailyJournal with configuration Debug

CompileC build/DailyJournal.build/Debug/DailyJournal.build/Objects- 
normal/x86_64/DailyJournal_AppDelegate.o DailyJournal_AppDelegate.m  
normal x86_64 objective-c com.apple.compilers.gcc.4_2

cd "/Volumes/repository/scratch/FileMerge tests/Fixed copy"
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x objective-c -arch x86_64 -fmessage- 
length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks  
-O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/ 
MacOSX10.6.sdk -mfix-and-continue -mmacosx-version-min=10.6 -gdwarf-2  
"-I/Volumes/repository/scratch/FileMerge tests/Fixed copy/build/ 
DailyJournal.build/Debug/DailyJournal.build/DailyJournal.hmap" "-F/ 
Volumes/repository/scratch/FileMerge tests/Fixed copy/build/Debug" "-I/ 
Volumes/repository/scratch/FileMerge tests/Fixed copy/build/Debug/ 
include" "-I/Volumes/repository/scratch/FileMerge tests/Fixed copy/ 
build/DailyJournal.build/Debug/DailyJournal.build/DerivedSources/ 
x86_64" "-I/Volumes/repository/scratch/FileMerge tests/Fixed copy/ 
build/DailyJournal.build/Debug/DailyJournal.build/DerivedSources" - 
include /var/folders/QW/QWESFte3FhWdBYEpGcMlAU+++TI/-Caches-/ 
com.apple.Xcode.501/SharedPrecompiledHeaders/DailyJournal_Prefix- 
fhphnkdzsgowcjfzywnbpghwpikg/DailyJournal_Prefix.pch -c "/Volumes/ 
repository/scratch/FileMerge tests/Fixed copy/ 
DailyJournal_AppDelegate.m" -o "/Volumes/repository/scratch/FileMerge  
tests/Fixed copy/build/DailyJournal.build/Debug/DailyJournal.build/ 
Objects-normal/x86_64/DailyJournal_AppDelegate.o"


/Volumes/repository/scratch/FileMerge tests/Fixed copy/ 
DailyJournal_AppDelegate.m: In function 'MyGotoHelpPage':
/Volumes/repository/scratch/FileMerge tests/Fixed copy/ 
DailyJournal_AppDelegate.m:214: warning: implicit declaration of  
function 'AHGotoPage'
/Volumes/repository/scratch/FileMerge tests/Fixed copy/ 
DailyJournal_AppDelegate.m: In function '-[DailyJournal_AppDelegate  
loadHelpForJournalEntry:]':
/Volumes/repository/scratch/FileMerge tests/Fixed copy/ 
DailyJournal_AppDelegate.m:221: warning: implicit declaration of  
function 'MyGoToHelpPage'


Ld build/Debug/DailyJournal.app/Contents/MacOS/DailyJournal normal  
x86_64

cd "/Volumes/repository/scratch/FileMerge tests/Fixed copy"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch x86_64 -isysroot /Developer/SDKs/ 
MacOSX10.6.sdk "-L/Volumes/repository/scratch/FileMerge tests/Fixed  
copy/build/Debug" "-F/Volumes/repository/scratch/FileMerge tests/Fixed  
copy/build/Debug" -filelist &

Re: AHGoToPage function

2009-11-07 Thread Ian Piper

On 8 Nov 2009, at 01:47, Ian Piper wrote:


Hi all,

I hope someone can illuminate me.


Erm, I just illuminated myself. First, I was typing AHGoToPage, not  
AHGotoPage (though I think my version looks nicer). Second, I hadn't  
added the Carbon Framework. Now that I have done both, it works fine.


If you have been, thanks for reading.


Ian.
--
___

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

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


Adding a vertical scrollbar to a multiline textfield

2009-11-10 Thread Ian Piper

Hi all,

I hope someon can advise as to the best way to do what I want. I have  
a multiline textfield that receives a very long piece of text. I  
wanted to add a vertical scrollbar. I tried putting the multiline  
textfield inside a scroll view but I'm not sure how you would tell the  
latter when to provide a scrollbar. Presumably the textfield has to be  
a descendant of the scrollview but I thought that putting one inside  
the other would do that.


I also tried to use a textview but in that case I got an error saying  
that NSTextView may not respond to setStringValue.


What is the best way to do this?


Ian.
--

___

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

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


EXC_BAD_ACCESS mystery

2009-11-10 Thread Ian Piper

Hi all,

Can anyone advise a good strategy for tracking down EXC_BAD_ACCESS  
crashes? I have an application that I can run quite happily two out of  
three times. Then it will crash with this error. By this I mean I can  
do Build and Run successively with no problems and then it will crash  
- no code or other changes.


It's a mystery and I wonder if anyone can advise how I can get to the  
root cause.




Ian.
--
___

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

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

2009-11-10 Thread Ian Piper

To Jens and Ryan,

Thanks for the pointers - very helpful.


Ian.
--

___

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

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


Example of categorized lists in a Mail-type interface

2009-11-15 Thread Ian Piper
Hi all,

I would appreciate it if someone could point me at an example that I could use 
as the basis for building a categorized list similar to the mail folders 
display in Mail.

I have a data model that has an entity called category and another called item. 
These have a one to many relationship (an item is in just one category, while a 
category can have many items). I want to have a list of categories in the left 
panel, with a disclosure arrow to open up for a list of items in that category. 
Selecting each item shows the detail to the right. As with Mail the category 
titles should not be selectable, but only open or close via the arrow. BTW I am 
only looking for one level of hierarchy below the category, so it is different 
from Mail in that respect.

I'm probably missing something obvious but I can't see how to start with 
building or coding this.

Anyway, I'm not looking for a complete solution, obviously, but some pointers 
or examples to use as a starting point.

Thanks for any guidance you can offer.

Regards,


Ian.
--
___

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

Please do not post admin requests or moderator comments to the list.
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: Example of categorized lists in a Mail-type interface

2009-11-15 Thread Ian Piper
On 16 Nov 2009, at 01:09, Rob Keniger wrote:

> 
> On 16/11/2009, at 4:38 AM, Ian Piper wrote:
> 
>> I would appreciate it if someone could point me at an example that I could 
>> use as the basis for building a categorized list similar to the mail folders 
>> display in Mail.
> 
> This should help:
> 
> http://developer.apple.com/mac/library/samplecode/SourceView
> 
> --
> Rob Keniger

It does... thanks Rob.


Ian.
--
___

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

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


How do you use an Application ID for an iPhone application

2009-11-24 Thread Ian Piper
Hi,

I am a bit baffled by how I am supposed to use an Application ID for an iPhone 
app. I have registered on the portal and have an Application ID which I can see 
within Xcode in my provisioning profile. It is a 10-character string followed 
by ".*"

>From the Developer documents it appears that this should be added to the 
>bundle identifier information in the application info.plist file in Xcode. At 
>present this is just the default of 
>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}. So I'm confused by the fact 
>that I can deploy my app to my iPhone with no problem - if the Application ID 
>is essential how am I able to send my app to my iPhone?

If I read it right (and I probably don't) I think I need to put this in my 
bundle identifier in the plist file:

GFWOTNXFIY.com.skeyn.IPNeatApp

Is that correct? If so, how come I can deploy my app? If it is not correct, 
what is the Application ID for?

The second confusion is also in the docs, where it says:

"Note: Regardless of the format used by the iPhone application ID, application 
bundles must always include
the application name in their bundle identifier."

Does this mean that I have to explicitly put the real name of my app (IPNeatApp 
in the bogus example above) into the bundle identifier rather than 
${PRODUCT_NAME:rfc1034identifier}?

Any illumination gratefully received.



Ian.
--

___

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

Please do not post admin requests or moderator comments to the list.
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 use an Application ID for an iPhone application

2009-11-24 Thread Ian Piper
Matthew,

Thanks - that seems a bit clearer. I'm still not clear though what, if any, use 
I need to make of the Application ID. From your reply it appears that I don't 
use it as a prefix in the bundle identifier after all. Is that right?


Ian.


On 25 Nov 2009, at 04:18, Matthew Mashyna wrote:

> It's simple once you get it to work the first time. If you made your 
> provision for the domain com.skeyn then in the properties tab your identifier 
> should be com.skeyn.${PRODUCT_NAME:rfc1034identifier}   The last part of this 
> is a macro that xcode will use to figure out what it needs to properly sign 
> it.
> 
> Xcode should make a good guess what provision you want to use but you need to 
> check the build settings. Look at the Code Signing Identity setting. From the 
> pop up list you can make sure that it wants to use the right one and you can 
> correct it if you need to. You typically have at least one for development 
> and another for ad hoc builds. Later you'll need another for store or 
> enterprise distribution.
> 
> On Nov 24, 2009, at 6:07 PM, Ian Piper wrote:
> 
>> Hi,
>> 
>> I am a bit baffled by how I am supposed to use an Application ID for an 
>> iPhone app. I have registered on the portal and have an Application ID which 
>> I can see within Xcode in my provisioning profile. It is a 10-character 
>> string followed by ".*"
>> 
>>> From the Developer documents it appears that this should be added to the 
>>> bundle identifier information in the application info.plist file in Xcode. 
>>> At present this is just the default of 
>>> com.yourcompany.${PRODUCT_NAME:rfc1034identifier}. So I'm confused by the 
>>> fact that I can deploy my app to my iPhone with no problem - if the 
>>> Application ID is essential how am I able to send my app to my iPhone?
>> 
>> If I read it right (and I probably don't) I think I need to put this in my 
>> bundle identifier in the plist file:
>> 
>> GFWOTNXFIY.com.skeyn.IPNeatApp
>> 
>> Is that correct? If so, how come I can deploy my app? If it is not correct, 
>> what is the Application ID for?
>> 
>> The second confusion is also in the docs, where it says:
>> 
>> "Note: Regardless of the format used by the iPhone application ID, 
>> application bundles must always include
>> the application name in their bundle identifier."
>> 
>> Does this mean that I have to explicitly put the real name of my app 
>> (IPNeatApp in the bogus example above) into the bundle identifier rather 
>> than ${PRODUCT_NAME:rfc1034identifier}?
>> 
>> Any illumination gratefully received.
>> 
>> 
>> 
>> Ian.
>> --
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/adc%40frodis.com
>> 
>> This email sent to a...@frodis.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: Introductions to OOP?

2011-09-02 Thread Ian Joyner
To understand the why of OO there is Bertrand Meyer's book Object-Oriented 
Software Construction:

http://docs.eiffel.com/book/method/object-oriented-software-construction-2nd-edition

It is big, but maybe the most complete and easy-to-read book on the subject. 
But you have to hang up any addiction to c-like syntax. But it will help 
understand many OO languages from the concepts down.

Another more recent book from Meyer is Touch of Class:

http://docs.eiffel.com/book/method/touch-class-learning-program-well-objects-and-contracts

but I don't have this yet.

For managers there is his Object Success book:

http://www.amazon.com/Object-Success-Object-Oriented-Technology-Corporation/dp/0131928333

which I used recently to try to convince an old-style manager that waterfall is 
mainly wrong and goes into many issues that need to be addressed in today's 
software development environments.

Ian

On 3 Sep 2011, at 09:04, koko wrote:

> Just stay away from th e1986 Byte Magazine article describing OOP ... pretty 
> funny actually.
> 
> -koko
> 
> On Sep 2, 2011, at 11:04 AM, Jens Alfke wrote:
> 
>> 
>> On Sep 1, 2011, at 9:26 PM, Julie Porter wrote:
>> 
>>> Again I am impressed with the help I received here.   Hopefully others will 
>>> be able to read these threads and learn from the experience of others.
>> 
>> Julie: You’re welcome!
>> 
>> Gang: One result of this is that I’m realizing how difficult it is to 
>> explain the basic concepts of object-oriented programming to someone who’s 
>> confused by them. I’ve been using them so long, that it’s like a fish trying 
>> to explain how to swim. I’d like to be able to point people to a good 
>> introduction, either online or in a book, but unfortunately I don’t know of 
>> any. Can anyone recommend something? (It doesn’t have to be Objective-C 
>> specific, although ideally it would describe dynamic languages, not static 
>> ones like C++ or Java.)
>> 
>> Another common stumbling block seems to be nib loading, and the concept of 
>> wiring up your non-view objects so they can find each other at runtime. I 
>> think I’m better at explaining this because I still remember learning it 
>> myself, but it would still be good to bookmark some clear descriptions.
>> 
>> —Jens___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
>> 
>> This email sent to k...@highrolls.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/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com

___

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

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

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

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


Re: ObjC's flat and all-exported namespace, help!

2011-11-08 Thread Ian Joyner
On 9 Nov 2011, at 05:21, Greg Parker wrote:

> On Nov 8, 2011, at 9:57 AM, Andy O'Meara wrote:
>> Yes, I know that one workaround is to mangle all objC class names based on 
>> something unique in the project (we are forced to do this with our 
>> screensaver products).  I'd be more accepting of this if Xcode facilitated 
>> this (with perhaps a macro of or the introduction of @privateinterface or 
>> something), but I don't fancy the idea of having to stick nasty and limiting 
>> #includes, #defines, or #ifdefs all over our code to make sure stuff 
>> compiles and links correctly just to workaround the fact that objC seems 
>> like it should really allow classes to not be exported by default into a 
>> single/shared namespace.
> 
> This is the only solution.
> 
> 
>> I suppose if there's no solution to this, then someone is going to describe 
>> how it can't be done because it would somehow break the loading of bundles.  
>> Well if that's the case, then I'm thinking that a radar is still worth 
>> filing because I'd be pretty surprised if the senior engineering level is 
>> going to agree that this whole flat objC namespace business is consistent 
>> with the precept that software should 'just work', rather than 'usually 
>> work' and emit user-attention-getting log messages as long as two internally 
>> private class names don't happen to have the same name.
> 
> 
>  ER: Objective-C namespaces
> 
> If you're familiar with Radar numbers, you'll recognize that the bug is very 
> old. The name is a bit misleading - C++ namespaces or Java packages are 
> little better than adding name prefixes by hand. (For example, they don't 
> solve the problem of two developers importing the same static archive.) A 
> real solution for class name collisions needs to be (1) automatic or nearly 
> so, (2) predictable so nib references work, and (3) not incompatible with 
> existing classes. It's a hard problem.

I agree, in NS::class, just substitute the ugly :: with _ and you see it's just 
a trick: NS_class. There should be a decent solution that doesn't need to put 
extra bookkeeping constructs in the language, and so that the clash is avoided 
in one place. Another point is that code in a class should not be bound to the 
environment and the C++ and Java way of doing it says 'environment' all over 
the place.

A different approach is in Eiffel that identifies the problem as being when you 
try to use two libraries together and handles clashes in one place by renaming 
(in a configuration file separate from code). Thus it becomes a linker concern. 
Language design should keep compilation concerns separate from linking concerns 
(and indeed not just static linking, but dynamic run-time linking). On the 
other hand most Unix style C linkers really don't do enough to make sure things 
can be sensibly linked together, so the basic languages and compilers get bent 
instead and then programmers are forced to think of all these things at a lower 
level than they should need to.

Similarly, imports and #includes are really bad, because they couple modules to 
their environment, rather than this kind of linkage being done externally in 
one place and handled by the linker. This means that if any import changes, you 
have to go through all the files and change all the imports and it looks like 
you are programming, but really you are not. So we invent a refactoring to take 
care of something that shouldn't exist.

Anyway, that's my argument for not doing namespaces in Objective-C the Java or 
C++ way. There's not so much clutter in Java, but there is so much clutter in 
C++ it looks like Windows! I'm sure Apple will come up with a better solution 
and things they have done over the last few years with Objective-C (and tagged 
pointers in Lion as we have just discussed in the Obj-C group) have been very 
nice and simplifying (even for a language based on C). We should not force them 
into doing anything the same bad old way that everything else does.

Ian
___

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

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

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

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


Re: ObjC's flat and all-exported namespace, help!

2011-11-09 Thread Ian Joyner
On 9 Nov 2011, at 22:44, Andreas Grosam wrote:

> 
> On Nov 9, 2011, at 12:11 PM, Karl Goiser wrote:
> 
>> Your first option looks better to me!
>> :-)
>> 
>> All I’m saying is that Objective C is a very mature language now
> Depending on your perspective, you can say this for many languages. But only 
> the dead ones do not evolve (Objective-C, does it, though)
> 
>> and if it has been able to get by
> You should ask the *developers*, not the *language*, if they experience 
> issues and if they feel comfortable to workaround these issues.
> 
>> without adding this extra layer of complexity, why introduce it for an edge 
>> case to address a situation where people are expecting it to act like C++?
> I wouldn't say it is an edge case. If you develop small applications in a 
> one-man company, and no plugins, you may feel this as a minor issue.
> Others won't agree, and actually have a big problem.
> 
> Namespaces for Objective-C will likely not require the same feature set than 
> what is available in C++ (e.g., no argument dependent lookup). There is also 
> no need to do this. The only thing that should be considered when introducing 
> namespaces in my opinion is, that it should be seamlessly integrated into 
> Objective-C++. The negative asset against C++ made from a few posters here, 
> is futile - Objective-C will have and be Objective-C++ as well. This requires 
> to consider C++ syntax - and IMHO, regarding namespaces, it isn't ugly at all.

Well, a lot of folk consider that Windows isn't ugly, after all they find it 
useful to do some work. But it is ugly!

Let's forget the subjective term ugly. Why is it not good? The same reasoning 
is like the goto argument. Dijkstra pointed out gotos considered harmful, and 
Knuth said you could do structured programming with gotos. Both were correct.

The problem with C is that it exposes too much low-level stuff that makes code 
inflexible and doesn't add anything to the power of the language. For example C 
pointers are the data structure equivalent of gotos. That is coming from the 
bottom up, so that stuff that is at a lower level than should be in an 
algorithmic language is exposed.

The problem with C++'s namespace mechanism, is it's exposing the opposite, the 
higher-level organizational aspects, and putting these in the programming 
language. Thus the higher level that should also not be in a programming 
language is exposed. This complicates the programming activity and hides the 
true purpose of a computation. This is a concern.

A parallel with aspect-oriented programming is that AOP attempts to remove 
cross-cutting concerns from regular code, so that the real purpose of a 
computation is clear.

Modularization aspects (at least the mixing of modules) really should not be a 
part of the language. We program a module, but it should be as independent from 
its environment as possible. That is essential to reuse. Imports and #includes 
expose the environment internally in a module.

We are progressing towards this and C++'s implementation of namespaces really 
goes in the opposite direction.

It's the old I have a hammer so everything looks like a nail, but in C++'s case 
it's I have a programming language, so everything gets put in that. We really 
need to get away from that kind of thinking about programming languages and get 
back towards the Smalltalk ideal. Objective-C does that, which makes it the 
nicest flavour of C. The programming community needs to learn what the phrase 
'separation of concerns' really means.
> 
>> 
>> Apple, after all is all about being simple and clean, and its language of 
>> choice should reflect that because, after all, it’s the developers who 
>> create the simple and clean.  In my opinion, Objective C is an embodiment of 
>> the Apple attitude.
> From the developers view, using namespaces shouldn't appear to be complex and 
> its usage should be certainly optional. IMHO, Objective-C could stay without 
> having namespaces. C is required to use the same approach to avoid name 
> conflicts: prefixes. However, introducing namespaces to Objective-C++ could 
> be worthwhile to investigate if this is feasable. IFF, then integrating 
> namespaces with C++ possibly could be done seamlessly.
> 
> Andreas
> 
>> 
>> My favourite saying of all time is, “to a person with a hammer, everything 
>> looks like a nail.”  Objective C is a screw, and you use a screwdriver on 
>> it, nor a hammer.
>> 
>> 
>> As far as versioning issues from the same class in two bundles is concerned, 
>> if the class works to spec, there’s no problem.  If it doesn’t, that’s a 
>> bug, and wouldn’t the bundles have to be updated anyway?
>> 
>> Karl
>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lis

Re: ObjC's flat and all-exported namespace, help!

2011-11-10 Thread Ian Joyner

On 10 Nov 2011, at 21:13, Karl Goiser wrote:

> 
> On 10/11/2011, at 12:04 PM, Ian Joyner wrote:
> 
>> It's the old I have a hammer so everything looks like a nail, but in C++'s 
>> case it's I have a programming language, so everything gets put in that. We 
>> really need to get away from that kind of thinking about programming 
>> languages and get back towards the Smalltalk ideal. Objective-C does that, 
>> which makes it the nicest flavour of C. The programming community needs to 
>> learn what the phrase 'separation of concerns' really means.
> 
> Hear hear!
> 
> 
> Sure, Objective C exposes a lot of internals for those who are looking for it.

Yes, that's troubling in a way, but if it is separated it is maybe alright. 
However, I have problems with systems that seem to say "here is nice high-level 
programming", but here's a way to subvert it. Layers and paradigms should be 
kept separate. If one paradigm is cross-bred with another, both paradigms lose 
their meaning and things begin to break down.

> So does any language to somebody with a good debugger.

Yes, there's no problem with knowing the lower level. On B5000 machines I knew 
the runtime well, could pretty much say what machine code any line of ALGOL 
would generate, could find my way around system dumps, far easier than on any 
other machine I have coded on. But did ALGOL ever need the programmer to 
subvert it at an assembler level? No. There WASN'T even an assembler. Thus the 
whole system was a self-contained package and you never needed to subvert the 
paradigm. Now that's a cohesive system. Seems when we need to dig around in 
internals the system is not actually cohesive.

> Don’t think you’re safe if you program in C or C++.

Never. C and C++ are the biggest reason for the sorry state of security we have 
on systems these days. As Bob Barton noted "Systems programmers are the high 
priests of a low cult"

http://www.computer.org/portal/web/csdl/doi/10.1109/MC.1980.1653540


___

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

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

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

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


Re: ObjC's flat and all-exported namespace, help!

2011-11-10 Thread Ian Joyner
On 10 Nov 2011, at 21:22, Andreas Grosam wrote:

> 
> On Nov 10, 2011, at 2:04 AM, Ian Joyner wrote:
> 
> 
> So, in other words, you prefer "polymorphic runtime resolved" symbols over 
> "compile-time resolved symbols" (like in C++).

Not saying that at all, and don't really agree with that. If a compiler can 
statically analyze things and resolve at compile time, that's good for 
optimization and statically-typed languages can do that. But for full type 
flexibility, we need to defer some cases until run time.
> 
> I just don't understand, why this makes C++ namespace syntax ugly, and why 
> you still state that C++ namespace is inflexible and problematic, and inflict 
> more issues than it solves.

Because this is trying to solve a problem at the programming level that should 
not be at the programming level. It's putting the concern of name clash 
avoidance throughout the code. That's not a good place to solve this problem. 
It's an ugly solution. Eiffel solves these kinds of problems externally to the 
language, so that program code is kept clean.

> While this is not true (IMO), I don't understand what this (and  Windows, C 
> pointers, and gotos, etc.) has to do with a new namespace feature for 
> Objective-C/C++.

Because like badly done gotos, you get this concern interwoven throughout the 
code. That is just not clean code. That's why aspect-oriented programming 
removes certain aspects from the code and uses the technique of weaving to 
automatically put it back in.

C++ does everything the bone-headed way. "We have a problem, so let's solve it 
with another language construct". No programming languages should be kept 
simple and issues of organization kept external.

John Backus has a nice quote in:

http://www.stanford.edu/class/cs242/readings/backus.pdf

"For twenty years programming languages have been steadily progressing toward 
their present condition of obesity; as a result, the study and invention of 
programming languages has lost much of its excitement. Instead, it is now the 
province of those who prefer to work with thick compendia of details rather 
than wrestle with new ideas. Discussions about programming languages often 
resemble medieval debates about the number of angels that can dance on the head 
of a pin instead of exciting contests between fundamentally differing concepts."

Namespaces is just trying to make something else dance on the head of this pin.

> I fear these divagations are contra-productive.

Why? Because someone points out that namespaces are a bad idea and tells you 
why?
> 
> 
>> The programming community needs to learn what the phrase 'separation of 
>> concerns' really means.
> 
> I would certainly agree about some "polymorphic dynamically resolved" 
> namespace feature in Objective-C. I'm awaiting your lecture.

No, I've given enough lectures in the last few days. Undergrads seem to enjoy 
"thinking differently" with heretical ideas and why in a class on software 
project management I'm telling them management is a bad idea and is a doomed 
class!

We really should be in the obj-c newsgroup.

Ian
___

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

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

2011-12-09 Thread Ian Joyner
You are probably looking for something like Dahm locks (invented by Dave Dahm 
on the Burroughs B5000 in the 1960s). Here is a long paper on locks including 
this origin:

http://pages.cs.wisc.edu/~remzi/OSFEP/threads-locks.pdf

Here is an idea of the ALGOL define for acquire:

DEFINE
 ACQUIRELOCK (ID) =
 BEGIN
   IF READLOCK (PROCESSID, CONTENDERS[ID]) ^= 0 THEN
  DO
 PROCURE (LOCKS[ID])
  UNTIL READLOCK (-1, CONTENDERS[ID]) = 0;
   OWNERS  [ID] :=  PROCESSID;
 END #


On 7 Dec 2011, at 10:28, koko wrote:

> In windows we have:
> 
> LONG volatile Mylock = 0;
> InterlockedIncrement(&Mylock);
> InterlockedDecrement(&Mylock);
> 
> 
> What should these be replaced with for OSX  as in :
> 
> #ifndef MAC
> LONG volatile Mylock = 0;
> #else
> // Mac 
> #endif
> 
> 
> void SetLock()
> {
> //EnterCriticalSection(&m_cs);
> #ifndef MAC
>   while(Mylock){Sleep(0);};   // Give up timeslice
>   InterlockedIncrement(&Mylock);
> #else
> // Mac
> #endif
> }
> 
> 
> void FreeLock()
> {
> //LeaveCriticalSection(&m_cs);
> #ifndef MAC
>   InterlockedDecrement(&Mylock);
> #else
> // Mac
> #endif
> }
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com

___

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

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

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

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


Re: Locks

2011-12-10 Thread Ian Joyner
On 11 Dec 2011, at 01:50, Scott Ribe wrote:

> On Dec 9, 2011, at 4:48 PM, Ian Joyner wrote:
> 
>> You are probably looking for something like Dahm locks (invented by Dave 
>> Dahm on the Burroughs B5000 in the 1960s). Here is a long paper on locks 
>> including this origin:
>> 
>> http://pages.cs.wisc.edu/~remzi/OSFEP/threads-locks.pdf
>> 
>> Here is an idea of the ALGOL define for acquire:
>> 
>> DEFINE
>> ACQUIRELOCK (ID) =
>>BEGIN
>>  IF READLOCK (PROCESSID, CONTENDERS[ID]) ^= 0 THEN
>> DO
>>PROCURE (LOCKS[ID])
>> UNTIL READLOCK (-1, CONTENDERS[ID]) = 0;
>>  OWNERS  [ID] :=  PROCESSID;
>>END #
> 
> I seriously, seriously, seriously doubt that he wants to be implementing 
> locks by translating Algol, *especially* when key, tricky to get correct, 
> routines are not provided.

I doubt that as well and that was not my suggestion or intention or I could 
have posted the whole file and suggested he do that (although that code is very 
old and apparently not in current implementations).

> But then again, based on the Windows code he presented, OP has nothing 
> against re-implementing these functions poorly ;-)
> 
> OSAtomic functions could replace the Interlocked functions. But seriously, 
> what's wrong with the available lock functions? Why in the world would you 
> implement your own locks???

That was the intention to get OS X equivalent and to throw in a bit of 
background and accreditation to Dave Dahm and other visionaries at Burroughs 
who truly thought different or we'd still be coding machine language.

Ian
___

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

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

2012-03-01 Thread Ian Joyner
Another 2c. I had a product called MacEiffel, which brought the Eiffel 
programming language to Mac native development environments, first CodeWarrior 
where it was easy to interface reasonably to CW, but then to ProjectBuilder 
where I couldn't do the neat things I could with CW, but then to Xcode. Xcode 
changed so radically, it really was impossible to keep up, and was even dropped 
for languages like Java.

So one of the factors in letting MacEiffel go was the speed of change of the 
development environment. To run Eiffel on Mac now you have to use EiffelStudio, 
which is really good, but runs under X11, and does not generate the best OS X 
applications.

It would be nice to target languages apart from Objective-C to Xcode, but it is 
too much of a moving target.

Ian

On 2 Mar 2012, at 10:27, Gene Crucean wrote:

> Man I don't know why there is soo much hate towards v4... but I personally
> love it. I think it's one of the best IDE's available on any platform. Yes
> there are bugs... but there are bugs in every IDE. Go try and use Visual
> Studio. Gah.
> 
> To be honest, it seems that the majority of the noise is about a slightly
> different workflow than what is used to from v3. My answer to that is,
> adapt or di... err I mean, or get fired.
> 
> My $0.02 anyway.
> 
> -Gene
> 
> 
> On Thu, Mar 1, 2012 at 6:01 AM, George Toledo  wrote:
> 
>> I'm not sure how/why this has spilled over to the Cocoa list, but out of
>> curiosity Wade, did you work there after Xcode 4's release? If not, I think
>> the argument is slightly specious.
>> 
>> Does anyone require devs at Apple to use Xcode 4, or conform to the broken
>> technologies that are foisted upon outside Developers? I don't know...
>> totally rhetorical, but I'd hope not, because as bad as it is to have this
>> put upon us, I'd hate to think they're using this trash across the board.
>> 
>> -gt
>> 
>>> Message: 4
>>> Date: Wed, 29 Feb 2012 16:41:27 -0800
>>> From: Wade Tregaskis 
>>> To: Matt Neuburg 
>>> Cc: "cocoa-dev@lists.apple.com" ,  Joar
>>>  Wingfors 
>>> Subject: Re: Xcode - An Apple Embarrassment
>>> Message-ID: 
>>> Content-Type: text/plain; CHARSET=US-ASCII
>>> 
>>>> *No*. I've said it before (right here) and I'll say it again; this is
>> *not* jumping to the documentation, and it is *not* doing what Xcode 3 did.
>> It switches to the documentation window and it enters the double-clicked
>> word into the search field, and it does the search, but it doesn't
>> display the actual documentation on the double-clicked word.
>>> 
>>> Indeed, the regressions around this simple piece of functionality are
>> disturbing.  I also find that it rarely handles double clicks correctly.  I
>> have to triple or quadruple-click much of the time.  It's often faster to
>> just bring up the organiser (command-shift-2, obviously) and navigate to
>> the desired docs directly, than play some kind of bizarro skill game with
>> my mouse button.
>>> 
>>>> Once again I put forward my pet wild-and-crazy "dog food" theory that
>> the people at Apple do not actually *use* Xcode for serious work. I know it
>> sounds wild and crazy, but I have two kinds of evidence for this theory:
>>> 
>>> Occam's razor (and my own nearly four years working on developer tools
>> at Apple) will present a different explanation:  Xcode is used exhaustively
>> within Apple, but the Xcode team just aren't good at producing a solid
>> product.  I'm not sure why that is; all the people I know on the Xcode team
>> are very good developers, at least individually.
>>> 
>>> Someone else pretty well hit the nail on the head earlier when they
>> suggested that developer tools just aren't given much top-level interest.
>> I don't know if that can be blamed for the end result though.
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> 
>> https://lists.apple.com/mailman/options/cocoa-dev/emailgeneonthelist%40gmail.com
>> 
>> This email sent to emailgeneonthel...@gmail.com
>> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
&

Best practice example for a setup wizard?

2010-01-13 Thread Ian Piper
Hi all,

For one of my applications I want to do a check at startup to see whether a 
profile and password has been set for the current user, and if not to take them 
through a setup wizard. I'm sure I can mug my way through writing this but it 
feels like the kind of thing for which there might be an example illustrating 
best practice. Can anyone point me at some documentation or examples that might 
help?

Thanks,


Ian.
--
Ian Piper
ianpi...@mac.com
--
If I'd asked people what they wanted, they would have said faster horses (Henry 
Ford)





___

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

Please do not post admin requests or moderator comments to the list.
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: Best practice example for a setup wizard?

2010-01-14 Thread Ian Piper
Thanks for all the replies. I am inclined to agree - the last thing I want is 
to build something that looks like a Windows application! And I get the issue 
of not bugging the user with a tedious setup process. The idea of having preset 
values that the user can change if he wants to is the way to go, I'm sure.

OK, perhaps I need to rethink how this works. Given that the underlying purpose 
is to authenticate the user to allow access to an encrypted database, would it 
make more sense for me to use the user's Mac OS X account credentials? Is there 
a way (I hesitate to use the phrase "best practice" again) for my program to 
authenticate the user that way?

Regards,


Ian.
--


On 13 Jan 2010, at 22:54, Marcel Weiher wrote:

> Hi Ian,
> 
> well, in a sense the lack of examples *is* illustrating the best practices 
> concerning setup wizards :-)
> 
> Cheers,
> 
> Marcel
> 
> 
> On Jan 13, 2010, at 9:54 , Ian Piper wrote:
> 
>> For one of my applications I want to do a check at startup to see whether a 
>> profile and password has been set for the current user, and if not to take 
>> them through a setup wizard. I'm sure I can mug my way through writing this 
>> but it feels like the kind of thing for which there might be an example 
>> illustrating best practice. Can anyone point me at some documentation or 
>> examples that might help?
> 

___

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

Please do not post admin requests or moderator comments to the list.
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: Carbon is C++?

2010-02-28 Thread Ian Joyner
Carbon was originally Pascal based, at least as far as the APIs. It does not 
essentially matter what it is written in, just what APIs it supports. If it has 
been rewritten in C++ (are they mad?), that should make no difference to 
whatever developer language is used, and would not be an argument to write in 
C++.

Should you write any high-level applications in C++ - probably not. If you are 
just writing Cocoa apps - don't use it. Just stick to Objective-C.

The idea of Objective-C++ is really to port things from other platforms more 
easily, or perhaps do cross-platform development.

Ian

On 26 Feb 2010, at 10:40, Chunk 1978 wrote:

> is Apple's Carbon basically code written in C++, while Cocoa is
> written in Objective-C?  should developers avoid using frameworks
> written in C++ (like some sound frameworks)?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com

___

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

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

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

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


Reading and writing rtf(d) files

2009-07-01 Thread Ian Piper

Hi all,

I have a question about reading and writing file types. I have been  
following an old Apple text editor example (http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Tasks/TextEditor.html 
), and want to extend it to allow me to read and write rtf files. At  
least, I want it to be able to round-trip rich text files with  
TextEdit. From the example:


"At this stage of its development, your editor opens and saves  
documents only with an extension of . To enable your application  
to save and open documents with a recognized file type, you need to  
use Xcode to configure the application’s document types settings as  
described in “Storing Document Types Information in the Application's  
Property List” in Document-Based Applications Overview. For complete  
details about application property lists, see Runtime Configuration  
Guidelines."


I read the documents, and an example from 2001 by Mike Beam () and  
also looked at the settings for the TextEdit example. I ended up  
setting it like so:


Creator: ttxt

Name: DocumentType
Extensions: rtfd
MIME Types: text/rtfd
OS Types: rtfd

My program writes files with rich content and reads them OK. But it  
won't read rtfd files that I have created elsewhere (I can select such  
files but they just don't open - nothing happens). Also, TextEdit will  
read files that I have created using my editor, but they are in plain  
text with lots of tutti-frutti.


Can anyone point me to an example that describes how I am supposed to  
tell my application that it should read and write rtf (or rtfd) files?


Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383




___

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

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


Reading and writing rtf(d) files

2009-07-02 Thread Ian Piper

bump bump :-)

Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383


Begin forwarded message:


From: Ian Piper 
Date: 1 July 2009 3:53:52 pmBST
To: Cocoa-dev@lists.apple.com
Subject: Reading and writing rtf(d) files

Hi all,

I have a question about reading and writing file types. I have been  
following an old Apple text editor example (http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Tasks/TextEditor.html 
), and want to extend it to allow me to read and write rtf files. At  
least, I want it to be able to round-trip rich text files with  
TextEdit. From the example:


"At this stage of its development, your editor opens and saves  
documents only with an extension of . To enable your application  
to save and open documents with a recognized file type, you need to  
use Xcode to configure the application’s document types settings as  
described in “Storing Document Types Information in the  
Application's Property List” in Document-Based Applications  
Overview. For complete details about application property lists, see  
Runtime Configuration Guidelines."


I read the documents, and an example from 2001 by Mike Beam () and  
also looked at the settings for the TextEdit example. I ended up  
setting it like so:


Creator: ttxt

Name: DocumentType
Extensions: rtfd
MIME Types: text/rtfd
OS Types: rtfd

My program writes files with rich content and reads them OK. But it  
won't read rtfd files that I have created elsewhere (I can select  
such files but they just don't open - nothing happens). Also,  
TextEdit will read files that I have created using my editor, but  
they are in plain text with lots of tutti-frutti.


Can anyone point me to an example that describes how I am supposed  
to tell my application that it should read and write rtf (or rtfd)  
files?


Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383


___

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

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


EXC_BAD_ACCESS on returning an int?

2009-07-04 Thread Ian Havelock

Hi All,

I've just started to learn my way around Cocoa but I've come across an  
error message that I don't understand and googling hasn't really shed  
any light on the subject.


I have defined a simple polygon class with 3 int's, called  
PolygonShape.  When debugging I can see that I am setting the  
properties correctly, but when I try to output the object's variables  
using NSLog I receive an EXC_BAD_ACCESS error?


When it hits the NSLog line in 'PolygonShape Testing.m', it goes  
through (from the right) returning maximumNumberOfSides,  
minimumNumberOfSides and numberOfSides, but when it hits the closing }  
after return numberOfSides I get the EXC_BAD_ACCESS error?


As I'm using int's and not string Objects such as NSString I don't see  
how it could be memory management related unless there is something  
I'm missing?



Running…
Program received signal:  “EXC_BAD_ACCESS”.
(gdb)




I apologise for posting such a lengthy email.




//  PolygonShape.h

#import 

@interface PolygonShape : NSObject

{
int numberOfSides;
int minimumNumberOfSides;
int maximumNumberOfSides;
}

@property int numberOfSides;
@property int minimumNumberOfSides;
@property int maximumNumberOfSides;


- (int)numberOfSides;
- (void)setNumberOfSides:(int)numberOfSides;

- (int)minimumNumberOfSides;
- (void)setMinimumNumberOfSides:(int)minimumNumberOfSides;

- (int)maximumNumberOfSides;
- (void)setMaximumNumberOfSides:(int)maximumNumberOfSides;

@end







// PolygonShape.m


#import "PolygonShape.h"


@implementation PolygonShape

@synthesize numberOfSides;
@synthesize minimumNumberOfSides;
@synthesize maximumNumberOfSides;


- (int)numberOfSides {
return numberOfSides;
}

- (void)setNumberOfSides:(int)value {
numberOfSides = value;
}


- (int)minimumNumberOfSides {
return minimumNumberOfSides;
}

- (void)setMinimumNumberOfSides:(int)value {
minimumNumberOfSides = value;
}


- (int)maximumNumberOfSides {
return maximumNumberOfSides;
}

- (void)setMaximumNumberOfSides:(int)value {
maximumNumberOfSides = value;
}

@end










// PolygonShape Testing.m

#import 
#import "PolygonShape.h"


void PrintPolygonInfo()
{
PolygonShape *poly1 = [[PolygonShape alloc] init];

[poly1 setMinimumNumberOfSides:3];
[poly1 setMaximumNumberOfSides:12];
[poly1 setNumberOfSides:6];

	NSLog(@"Number of Sides: %@,  Min: %@,  Max: %@", [poly1  
numberOfSides], [poly1 minimumNumberOfSides], [poly1  
maximumNumberOfSides]);


}


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

PrintPolygonInfo(); 

[pool drain];
return 0;
}






Many Thanks,
Ian___

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

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


Implementing previous, next, first, last controls in Core Data applications

2009-07-12 Thread Ian Piper

Hi all,

Can anyone tell me whether there are any plug-ins or examples that  
show how to implement buttons to move forward and backward through a  
record set in a Core Data application? I am thinking of having a  
window that simply presents one record from a collection, with  
forward, backward, first and last buttons.


Thanks,


Ian.
--
ianpi...@mac.com





___

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

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

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

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


Solved: Implementing previous, next, first, last controls in Core Data applications

2009-07-13 Thread Ian Piper

Hi all,

Thanks for the response to this question. After a bit of digging in  
Interface Builder I realised that the basic bindings for Next and  
Previous buttons are there, as well as the actions in the  
NSArrayController. I'm not sure whether this is what the reply below  
was trying to tell me! Anyway, it turns out to be really easy to do  
the next and previous buttons. In case it is of use to anyone else,  
here is what to do. If this is all blindingly obvious, forgive the  
intrusion!


Suppose you have an NSArrayController in a window that you have  
created as a result of dragging in a Core Data Entity. Add two buttons  
from the Library to provide the Next and Previous UI controls. Then,  
taking the Next button as an example, you can set the binding as  
follows: In the Availability>Enabled section in the Inspector Bindings  
tab, bind to the appropriate NSArrayController. and choose  
canSelectNext as the Controller Key. Then control-drag from the button  
to the controller in the main window and choose the selectNext:  
action. The process for Previous is similar.


Anyway, I hope someone else finds this useful.

Regards,


Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383






On 12 Jul 2009, at 2:48pm, I. Savant wrote:


On Jul 12, 2009, at 8:51 AM, Ian Piper wrote:

Can anyone tell me whether there are any plug-ins or examples that  
show how to implement buttons to move forward and backward through  
a record set in a Core Data application? I am thinking of having a  
window that simply presents one record from a collection, with  
forward, backward, first and last buttons.


 This isn't really a "Core Data" question, but rather a bindings  
question.


 Read up on Cocoa Bindings and NSArrayController. All you need to do  
is modify the selection as desired when these buttons are pressed  
via -[NSArrayController setSelectionIndex:] or -[NSArrayController  
setSelectionIndexes:], keeping in mind the array controller's - 
arrangedObjects (and the count thereof).


 If the rest of your detail view is bound to this array controller's  
selectedObjects.whateverKeys, you're 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: Ideas required on testing an application install

2009-07-19 Thread Ian Piper

On 26 Jun 2009, at 5:30am, Bill Bumgarner wrote:
It'll be interested to see what kind of performance one achieves  
when booting from an SD card.  Given their price ($40 for a class-6  
SDHC card), it would be an attractive and convenient option.


Certainly, I know that when I have a moment, I'm going to prep a  
16GB card with two bootable partitions; one containing an emergency  
Leopard boot image configured to use my user account on the internal  
drive and one that contains DiskWarrior and a couple of other tools.



I was intrigued to read this and thought I would give it a go. I  
installed the latest Snow Leopard (10A411) onto a 16GB card that was  
hanging off my MacBook Pro using a USB2 card reader. It installed onto  
the card OK and it even appears as an available startup disk, but the  
Mac doesn't seem to want to boot off this "disk": just comes up with  
the question-mark-in-a-folder symbol. How do you get the SD card to  
act as a bootable drive?



Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383






___

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

Please do not post admin requests or moderator comments to the list.
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: Ideas required on testing an application install

2009-07-19 Thread Ian Piper

On 19 Jul 2009, at 6:46pm, Andy Lee wrote:


On Jul 19, 2009, at 7:45 AM, Ian Piper wrote:

How do you get the SD card to act as a bootable drive?


Did you try Google?  A search for "boot sd card macbook" turned up  
this as the first hit:


<http://arstechnica.com/apple/news/2009/06/boot-from-the-sd-card-slot-in-new-macbook-pros.ars 
>


Did you set the SD card's default partition table to GUID?  If that  
didn't work I'd submit a bug.


--Andy




Yes, I set it to GUID. It wouldn't even install on the SD card until I  
did that.


I'm afraid I don't know the procedure for submitting a bug -  
presumably you mean to Apple?



Ian.
--
ianpi...@mac.com
07590 685840 | 01926 811383



___

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

Please do not post admin requests or moderator comments to the list.
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: iOS: Monospaced fonts aren't?

2010-12-10 Thread Ian Joyner
On 11 Dec 2010, at 07:16, Murat Konar wrote:

> Maybe CourierNewPS-BoldMT is not a monospaced font?

It sounds like one of those rip-off fonts that have polluted the font space. Is 
plain Courier not available on iOS?

I have some links about fonts from one of my pages (click the 'here' links):

http://www.ianjoyner.name/Ian_Joyner/Fonts.html

> 
> _murat
> 
> On Dec 10, 2010, at 11:39 AM, Phillip Mills wrote:
> 
>> I've been having one of those "I must be doing something stupid" days.  The 
>> code I'm trying to write needs to pad one string with spaces so that certain 
>> characters line up visually with selected characters in a different string 
>> (within a view).  It seemed like a relatively easy task as long as I could 
>> require the use of a monospaced font.  However, it comes out looking various 
>> kinds of wrong depending on how many spaces I add.  I've tried this with a 
>> number of Courier variants with the same result.
>> 
>> The following test seems to confirm that a string of spaces does not render 
>> in the same bounding box as a string of alphanumeric characters or 
>> punctuation marks.  (Also, that there may not be a neat and obvious formula 
>> for how to compensate.)  Are these results reproducible?  Was a fixed-size 
>> character width a bad assumption?  Or is it a bug?
>> 
>> - (void)debugFont {
>>  UIFont *font = [UIFont fontWithName:@"CourierNewPS-BoldMT" size:24];
>>  
>>  // With 22 characters, there's a width difference of 9
>>  NSString *s1 = @"1234567890123456789012";
>>  NSString *s2 = @"  ";
>>  
>>  // The choice of non-space character doesn't seem to matter
>>  NSString *s5 = @"..";
>>  
>>  // With 23 characters, there's a width difference of 10
>>  NSString *s3 = @"12345678901234567890123";
>>  NSString *s4 = @"   ";
>>  
>>  NSLog(@"@. size: %f", s1, [s1 sizeWithFont:font].width);
>>  NSLog(@"@. size: %f", s2, [s2 sizeWithFont:font].width);
>>  NSLog(@"@. size: %f", s5, [s5 sizeWithFont:font].width);
>>  NSLog(@"@. size: %f", s3, [s3 sizeWithFont:font].width);
>>  NSLog(@"@. size: %f", s4, [s4 sizeWithFont:font].width);
>> }
>> 
>> 2010-12-10 14:19:03.936 FontTest[1834:207] .1234567890123456789012. size: 
>> 317.00
>> 2010-12-10 14:19:03.937 FontTest[1834:207] .  . size: 
>> 308.00
>> 2010-12-10 14:19:03.938 FontTest[1834:207]  size: 
>> 317.00
>> 2010-12-10 14:19:03.938 FontTest[1834:207] .12345678901234567890123. size: 
>> 332.00
>> 2010-12-10 14:19:03.939 FontTest[1834:207] .   . size: 
>> 322.00
>> 

___

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

Please do not post admin requests or moderator comments to the list.
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: iOS: Monospaced fonts aren't?

2010-12-10 Thread Ian Joyner
On 11 Dec 2010, at 11:02, Phillip Mills wrote:

> On 2010-12-10, at 5:38 PM, Ian Joyner wrote:
> 
>> Is plain Courier not available on iOS?
> 
> Courier is there but with the same problem.

How about other monospaced fonts? Monaco is the only other common one I can 
think of (or Andale Mono):

http://en.wikipedia.org/wiki/Samples_of_monospaced_typefaces

Do you have any italics? Strange characters you can boil it down to?

Still begs the question as to what are the official sanctioned/recommended 
fonts?

Ian
___

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

Please do not post admin requests or moderator comments to the list.
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: iOS: Monospaced fonts aren't?

2010-12-10 Thread Ian Joyner
I just heard an interesting program on "Fighting for Authentic Design":

http://www.abc.net.au/rn/bydesign/stories/2010/3087247.htm

Some of the links on my page were broken. Does anyone know what has happened to 
the excellent screenfonts.ca site?

I have also added Courier to Courier New comparison.

While font issues aren't exactly specific to Cocoa, this is an issue that 
should be much more widely known about, especially among developers. But I also 
have the question about which fonts are officially sanctioned by Apple to use?

Ian

On 11 Dec 2010, at 09:38, Ian Joyner wrote:

> On 11 Dec 2010, at 07:16, Murat Konar wrote:
> 
>> Maybe CourierNewPS-BoldMT is not a monospaced font?
> 
> It sounds like one of those rip-off fonts that have polluted the font space. 
> Is plain Courier not available on iOS?
> 
> I have some links about fonts from one of my pages (click the 'here' links):
> 
> http://www.ianjoyner.name/Ian_Joyner/Fonts.html
> 
>> 
>> _murat
>> 
>> On Dec 10, 2010, at 11:39 AM, Phillip Mills wrote:
>> 
>>> I've been having one of those "I must be doing something stupid" days.  The 
>>> code I'm trying to write needs to pad one string with spaces so that 
>>> certain characters line up visually with selected characters in a different 
>>> string (within a view).  It seemed like a relatively easy task as long as I 
>>> could require the use of a monospaced font.  However, it comes out looking 
>>> various kinds of wrong depending on how many spaces I add.  I've tried this 
>>> with a number of Courier variants with the same result.
>>> 
>>> The following test seems to confirm that a string of spaces does not render 
>>> in the same bounding box as a string of alphanumeric characters or 
>>> punctuation marks.  (Also, that there may not be a neat and obvious formula 
>>> for how to compensate.)  Are these results reproducible?  Was a fixed-size 
>>> character width a bad assumption?  Or is it a bug?
>>> 
>>> - (void)debugFont {
>>> UIFont *font = [UIFont fontWithName:@"CourierNewPS-BoldMT" size:24];
>>> 
>>> // With 22 characters, there's a width difference of 9
>>> NSString *s1 = @"1234567890123456789012";
>>> NSString *s2 = @"  ";
>>> 
>>> // The choice of non-space character doesn't seem to matter
>>> NSString *s5 = @"..";
>>> 
>>> // With 23 characters, there's a width difference of 10
>>> NSString *s3 = @"12345678901234567890123";
>>> NSString *s4 = @"   ";
>>> 
>>> NSLog(@"@. size: %f", s1, [s1 sizeWithFont:font].width);
>>> NSLog(@"@. size: %f", s2, [s2 sizeWithFont:font].width);
>>> NSLog(@"@. size: %f", s5, [s5 sizeWithFont:font].width);
>>> NSLog(@"@. size: %f", s3, [s3 sizeWithFont:font].width);
>>> NSLog(@"@. size: %f", s4, [s4 sizeWithFont:font].width);
>>> }
>>> 
>>> 2010-12-10 14:19:03.936 FontTest[1834:207] .1234567890123456789012. size: 
>>> 317.00
>>> 2010-12-10 14:19:03.937 FontTest[1834:207] .  . size: 
>>> 308.00
>>> 2010-12-10 14:19:03.938 FontTest[1834:207]  size: 
>>> 317.00
>>> 2010-12-10 14:19:03.938 FontTest[1834:207] .12345678901234567890123. size: 
>>> 332.00
>>> 2010-12-10 14:19:03.939 FontTest[1834:207] .   . size: 
>>> 322.00
>>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com

___

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

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

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

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


Re: strategies for working w/ large amounts of text

2010-12-13 Thread Ian Joyner
On 13 Dec 2010, at 14:03, Shane wrote:

>> Are you building a concordance database first ?
>> 
> 
> I have no thoughts whatsoever on how I'm building anything as of yet.
> Just researching how something of this size would be manipulated.

In the case of large texts like the Bible, you have a data source that is 
pretty much static. That is, if you put it in a database you won't run update 
operations against it.

The big question is, if you go to the trouble of breaking it into database 
records - maybe one per verse, what does that get you. Even putting it into XML 
might be a lot of work, and what happens when the next technology comes along.

Text is fairly flexible and searchable. You don't actually need a concordance 
(index). Searching through text is pretty fast (probably a modern processor 
will have found all occurrences of the word 'the' before you have got the 
concordance off the shelf. Spotlight technology could also help there to 
generate an index for you.

That said, what can you do with Cocoa? Why don't you model what you want in 
Core Data. That is data store agnostic so you could use a database (SQLite) or 
XML later. Once you have a model, this might help you see potential 
applications.

Having said that, I believe we are at the beginning of rearranging many linear 
texts into more immediately and easily useful forms, particularly teaching 
texts.

Ian
___

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

Please do not post admin requests or moderator comments to the list.
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: Why so many public properties all up in my grizzle?

2012-03-16 Thread Ian Joyner
This is an interesting discussion, but there is a lot of misunderstanding of 
the concept of information hiding if not in what has been said here, but 
generally in the industry. This term was introduced by David Parnas, and I 
think it is a bit unfortunate because if you read his papers on this he really 
means implementation hiding:

On the Criteria to be used in Decomposing Systems into Modules (1972):

http://www-sst.informatik.tu-cottbus.de/~db/doc/People/Broy/Software-Pioneers/Parnas_hist.pdf

The Secret History of Information Hiding (2002):

http://www-sst.informatik.tu-cottbus.de/~db/doc/People/Broy/Software-Pioneers/Parnas_new.pdf

There is something deeper to this than simply hiding variables. A lot of people 
using C++, Java, etc think it means hiding data behind get and set routines. 
However, in reality we are trying to expose data, we are just trying to do it 
in an implementation independent manner. Thus it is the interface (API) is the 
important part of the design.

A corollary of this is Bertrand Meyer's Principle of Uniform Access, which says 
values should be provided to a caller in a uniform way, no matter whether the 
data comes from storage (variable), is computed either in an expression or a 
function:

http://en.wikipedia.org/wiki/Uniform_access_principle

http://martinfowler.com/bliki/UniformAccessPrinciple.html

I think Martin Fowler's article clearly shows Parnas's ideas.

Objective-C implements this principle of uniform access with properties.

Ian

On 17 Mar 2012, at 08:56, Conrad Shultz wrote:

> On 3/16/12 2:00 PM, Brian Lambert wrote:
>> This means that my UILabel called labelMyLabel is publicly available.
>> Anyone who has access to an instance of MyViewController can do anything
>> they want to with my label, including replacing it.
>> 
>> Also, anyone who has an instance of MyViewController can call my
>> buttonDoItTouchUpInside action.
> 
> In addition to David's remarks, it should also be noted that there isn't
> really any concept of "private" properties or methods (in the enforced
> sense) in Objective-C due to the dynamic nature of the language and
> runtime.  No matter where you *declare* your properties and/or methods,
> what you state above would always be possible.
> 
> (As an aside, major features in Cocoa rely on fairly crazy runtime
> manipulation.  For example, key-value observing:
> http://mikeash.com/pyblog/friday-qa-2009-01-23.html)
> 
> Suppose you wanted to peek under a class' hood (for curiosity's sake, of
> course; private API usage is generally a bad idea and is explicitly
> forbidden in the App Stores and from discussion on the official mailing
> lists).  To see a class' properties (both from itself and its protocols)
> you could try something along the lines of (warning: a thrown together
> quick hack, probably has bugs):
> 
>unsigned int propertyCount;
>objc_property_t *allProperties = class_copyPropertyList([MyClassName
> class], &propertyCount);
>for (NSUInteger i = 0; i < propertyCount; i++) {
>const char *name = property_getName(allProperties[i]);
>NSLog(@"%s", name);
>}
> 
>unsigned int protocolCount;
>Protocol **allProtocols = class_copyProtocolList([MyClassName
> class], &protocolCount);
>for (NSUInteger i = 0; i < protocolCount; i++) {
>const char *protocol = protocol_getName(allProtocols[i]);
>NSLog(@"PROTOCOL %s", protocol);
>unsigned int protoPropertyCount;
>objc_property_t *protoProperties =
> protocol_copyPropertyList(allProtocols[i], &protoPropertyCount);
>for (NSUInteger j = 0; j < protoPropertyCount; j++) {
>const char *propName = property_getName(protoProperties[j]);
>NSLog(@"\t%s", propName);
>}
>}
> 
> This and other fun hackery is documented in the Runtime Programming
> Guide:
> https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide
> 
> 
> 
> -- 
> Conrad Shultz
> 
> Synthetiq Solutions
> www.synthetiqsolutions.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:
> https://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com

___

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

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

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

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


Re: const correctness

2012-03-18 Thread Ian Joyner
I think you've nailed it. Immutability is certainly a good concept, but 
including ideas from C++ is not a good idea because concepts are usually 
perverted in C++ (and even C - ALGOL carefully removed the junk out of FORTRAN 
and assembler but C, just put that garbage back in.) Concepts need very careful 
understanding of how they interact with the rest of a language before putting 
them in. With C pointers, you can just about subvert any good practice (even 
any good practice that got put in C++).

If people haven't seen this series, Douglas Crockford has a series on 
Javascript (ugh, I know, off topic..., don't tune out, please read on):

http://net.tutsplus.com/tutorials/javascript-ajax/crockford-on-javascript-the-complete-series/

which is about far more than just Javascript. It is about why programmers are 
resistant to new ideas, how we usually end up with messes (JS in particular), 
language design, and subtly why C and C++ are poor languages. Oh, yeah, and why 
the web is such a mess (just bad ideas done quickly and a great perspective on 
the lasting effect of the browser wars). This series is well worth watching for 
the insights it has into our profession.

Ian

On 19 Mar 2012, at 05:39, Jens Alfke wrote:

> 
> On Mar 18, 2012, at 11:01 AM, Luther Baker wrote:
> 
>> Obj-C and Cocoa don't support "const" because they are older?
> 
> More because they weren’t designed around it. And because the way C++ does 
> ‘const’ gets really problematic in a dynamic OOP language like Obj-C.
> 
> Say you added ‘const’ object pointers to Obj-C. The direct meaning is that 
> the caller isn’t allowed to modify instance variables through a const 
> pointer. But touching another object’s ivars is almost unheard-of in Obj-C. 
> So the significant meaning would be that the only methods you can call on 
> such a pointer are those declared ‘const’; and inside a method declared 
> ‘const’, ‘self’ is a const pointer, so the method isn’t allowed to modify 
> instance variables. So far so good.
> 
> The problem is how you declare a method as const. In Objective-C method names 
> aren’t tightly bound to classes; they’re selectors and they exist 
> independently. So different classes might implement methods with the same 
> selector even though they aren’t related to each other, and you can send a 
> message to an object using a particular selector without knowing what class 
> of object it is (if the pointer is typed as ‘id’, or if you’re calling 
> something like -performSelector:.)
> 
> So things would start to get really messy if two unrelated classes 
> implemented the same method name (i.e. same selector) but one made it const 
> and one didn’t. Now if you send that message to an ‘id’ variable, the 
> compiler doesn’t know whether it’s const or not and whether to allow or deny 
> the call.
> 
> Anyway. This is digressing, and probably belongs on the objc-language list if 
> anyone wants to pursue it further. My guess is it isn’t worth pursuing, 
> because Obj-C already has a different mechanism for handling mutable vs 
> immutable state, and it works very differently (it’s the objects that are 
> mutable/immutable, not just the pointers thereto), and trying to add in the 
> C++ notion would probably be very ugly even if it could be done.
> 
> —Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com


___

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

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

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

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

Re: const correctness

2012-03-19 Thread Ian Joyner
On 19 Mar 2012, at 09:31, Shawn Bakhtiar wrote:

> "...subtly why C and C++ are poor languages..."
> 
> 1) Is that why most modern operating systems, especially the ones that run in 
> data centers are written in C?
> 
Popularity is more a proof of mass stupidity rather than quality. The cult of C 
followed on from what Bob Barton called the cult of FORTRAN in 1963 and also 
noted that systems programmers are high priests of a low cult.

> 2) Isn't Objective-"C" a supper set of C, so does that make Objective-C a bad 
> language as well?

Unfortunately OC is C-based, but it changed C in a completely different way to 
C++ in a way that OC is almost a decent language, in fact the best dialect of C 
that exists.
> 
> Isn't Mutability just another word for constant-ability?

No, that's immutability. C it's already confusing talking about things in see 
:-)
> 
> I hate to use Wiki for citation but:
> 
> http://en.wikipedia.org/wiki/Const-correctness
> 
> "In computer science, const-correctness is the form of program correctness 
> that deals with the proper declaration of objects as mutable or immutable. 
> The term is mostly used in a C or C++ context, and takes its name from the 
> const keyword in those languages."

Well, it's more instructive to follow the link to immutable objects.
> 
> Doesn't const void ** = NSMutableArray in meaning,

Actually NSArray. Note NSMutableArray inherits from NSArray because it adds 
extra functionality in methods that can change the object. You can assign an 
NSMutableArray object to an NSArray reference, thereby making it unchangeable 
via that path, but you can't assign an NSArray object to an NSMutableArray.

> with the first being a simple way for the programmer to avoid clobbering data 
> that SHOULD not be changed, and the latter being a compiler enforced one?

Well, const void ** (what gobbledegook, let me get my head around it), means 
you cannot change the pointed to objects (haven't they got the message C 
pointers are bad) via that pointer. An NSArray reference to an NSArray object 
means you can't change that object, ever vs., an NSArray reference (note 
references are different to pointers) to an NSMutableArray means you can't 
change the NSMutableArray via that reference. As already said you can't have an 
NSMutableArray reference to an NSArray object.

Still suggest watching Crockford where he traces C's ancestry to ALGOL with the 
junk from FORTRAN and assembler put back in, the junk the ALGOL people (many of 
whom had previously designed FORTRAN, like Backus) had deliberately left out. 
An extension of ALGOL then brought us OO – Simula. Crockford also advises on 
how to avoid the bad parts of JavaScript, a lesson we need in avoiding the bad 
parts of C. C has more to do with assembler programming than HLL and structured 
programming. You don't need assembler to write operating systems - I'd hardly 
call them modern. (The only truly modern OS I can think of actually predates 
them all.)
> 
> 
> 
> 
>> Subject: Re: const correctness
>> From: ianjoy...@me.com
>> Date: Mon, 19 Mar 2012 09:16:52 +1100
>> To: Cocoa-dev@lists.apple.com
>> 
>> I think you've nailed it. Immutability is certainly a good concept, but 
>> including ideas from C++ is not a good idea because concepts are usually 
>> perverted in C++ (and even C - ALGOL carefully removed the junk out of 
>> FORTRAN and assembler but C, just put that garbage back in.) Concepts need 
>> very careful understanding of how they interact with the rest of a language 
>> before putting them in. With C pointers, you can just about subvert any good 
>> practice (even any good practice that got put in C++).
>> 
>> If people haven't seen this series, Douglas Crockford has a series on 
>> Javascript (ugh, I know, off topic..., don't tune out, please read on):
>> 
>> http://net.tutsplus.com/tutorials/javascript-ajax/crockford-on-javascript-the-complete-series/
>> 
>> which is about far more than just Javascript. It is about why programmers 
>> are resistant to new ideas, how we usually end up with messes (JS in 
>> particular), language design, and subtly why C and C++ are poor languages. 
>> Oh, yeah, and why the web is such a mess (just bad ideas done quickly and a 
>> great perspective on the lasting effect of the browser wars). This series is 
>> well worth watching for the insights it has into our profession.
>> 
>> Ian
>> 
>> On 19 Mar 2012, at 05:39, Jens Alfke wrote:
>> 
>>> 
>>> On Mar 18, 2012, at 11:01 AM, Luther Baker wrote:
>>> 
>>>> Obj-C and Cocoa don't support "const" because they 

Re: const correctness

2012-03-19 Thread Ian Joyner
On 20 Mar 2012, at 02:43, Nick Zitzmann wrote:

> On Mar 19, 2012, at 5:51 AM, Ian Joyner wrote:
> 
>> Actually NSArray. Note NSMutableArray inherits from NSArray because it adds 
>> extra functionality in methods that can change the object. You can assign an 
>> NSMutableArray object to an NSArray reference, thereby making it 
>> unchangeable via that path, but you can't assign an NSArray object to an 
>> NSMutableArray.
> 
> Declaring an NSMutableArray as an NSArray doesn't make it immutable, because 
> you can still send NSMutableArray messages to the array and they'll still 
> work (though the compiler will complain unless you mask them or send the 
> message indirectly). The only way to make a mutable array immutable is to 
> make an immutable copy of the array.

I think we agree. The point is that we have two types involved, the type of the 
object itself and the type of the pathway to it (reference). That's why you 
should not (and cannot I hope) assign an NSArray (immutable) object to an 
NSMutableArray. The general case is that you cannot assign an object of a 
supertype to a reference to a subtype, because then you can do inappropriate 
things to the object.

The interesting case is when you have a supertype reference to an object of a 
subtype and then try assigning that object back to a reference of the same 
subtype. This is a legitimate case, but type systems would usually preclude it, 
which is why those who like dynamic typing don't like static typing. But this 
case can be handled in a typed language. Eiffel calls it the assignment 
attempt, which happens at run time by ensuring that the actual run time type of 
an object conforms to the type of the reference, else the reference is just set 
to nothing.

Ian
___

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

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

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

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


Re: const correctness

2012-03-19 Thread Ian Joyner
Really const correctness in the first place belonged in the Objective-C group.


If you read the rest of my post I'm talking about immutability and const 
correctness, so although this comment on popularity came first it was just a 
subtopic and you have picked on this as a sub topic of the post rather than the 
meat in the rest of it. Perhaps if I'd made a point about Windows and mass 
stupidity it would have been better.


Really, what I am concerned about is the thought that we should add things to 
Obj-C just because C++ has it. Language features require much more thought than 
that. While all the flaws of C are necessarily preserved in Obj-C, Obj-C 
defines a much more disciplined use of the language. Almost all of the bad 
features are avoided in normal practice and an OC programmer almost has to go 
out of their way to use the garbage. That's one of the staggeringly good things 
about OC as designed by Brad Cox and adapted by NeXT/Apple. C++ is just one of 
the biggest messes in the programming world. Why? Complexity, complexity, 
complexity.

I mentioned the Crockford series for three reasons - 1) his thesis that 
programmers have always been resistant to better things; 2) his showing how to 
avoid deficiencies in a language (the example is JavaScript); 3) how most 
deficiencies in JavaScript actually come from C (via Java in some cases) and 
how C had bad things included from FORTRAN and assembler that should not have 
been (because of (1)).

In the context of security, Crockford makes the point that complexity is the 
tool of the enemy. With simplicity we can solve the problems. So my concern 
with the way this thread was going was that it became "Let's just add the 
complexity of C++ into OC." That is not healthy and if followed could destroy 
the relative simplicity and power of OC.

Crockford is a very friendly and subtle speaker, but pulls no punches about the 
state of the Web and why most of it is rubbish, filled with security holes, 
etc. He has so many lessons on so many levels and I recommend it to the Cocoa 
community, even though not directly Cocoa related, but his thinking is relevant 
to so many things and most of us have to be involved in the web in one way or 
the other.

Thanks
Ian

P.S sounds like you still need to go and study up some material on the B5000 to 
see how a really elegant design of 50 years ago is still way ahead of its time 
and would solve many of the security and other problems of today. I apologize 
if I have helped close your mind to this.

http://www.bitsavers.org/pdf/burroughs/B5000_5500_5700/Organick_B5700_B6700_1973.pdf
Stories of the B5000 and People Who Were There

On 20 Mar 2012, at 02:55, Jens Alfke wrote:

> 
> On Mar 19, 2012, at 4:51 AM, Ian Joyner wrote:
> 
> 
> Please take this off-list, or to some more appropriate list (I think it’s 
> already deep-ended past objc-language; is there an algol-like-language list?) 
> Otherwise we’ll be hearing about the Burroughs B500 soon, and I don’t think I 
> can take that again.
> 
> I don’t mean to be rude, but I’m about at my personal limit of patience with 
> the amount of off-topic stuff one has to wade through on the Apple lists 
> lately (especially xcode-users, but here too.) I’m not a moderator and I’m 
> not here as part of my job description; I hang out when I have time to and 
> mostly try to answer questions to help people out. If the list gets too noisy 
> I tend to give up and ignore it for weeks or months before coming back. I’m 
> sure there are other experienced people here who do the same. It’s to 
> everyone’s benefit if the list stays on topic so that people who need help 
> can get it and people who want to offer help can give it.
> 
> —Jens

___

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

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

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

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

Re: Displaying "Trebuchet MS" font

2013-05-13 Thread Ian Joyner
On 14 May 2013, at 04:37, Appa Rao Mulpuri  wrote:

> Any specific reason not to use "Trebuchet MS"?  I faced some issues with the 
> few components (ilke Table Header cell, NS Button) text vertical center 
> alignment except that Look and feel wise its equivalent to "Lucida Grande". 
> And also both the fonts is taking the equal size for the same text.

Yes there is now a confusion of very similar fonts. Many were done by Microsoft 
with tweaks to original fonts made to make them look 'good' (in someone's 
opinion, or was it just marketing) on the computer screens of the 1990s. This 
shows the MS philosophy of bending the natural world to suit their technology, 
not improving technology to suit the world. So they designed fonts to look good 
on crappy screens. Apple on the other hand came along and said "we like these 
beautiful fonts, we don't want to change them, so let's make the screens 
better".

Another reason MS designed all these wacky fonts was licence fees. While 
bleating on about people stealing software with copies and depriving them of 
fees, they copied fonts, subtly changing a few pixels and the name to avoid 
licence fees.

Arial it should be noted is just Helvetica, but you will notice some of the 
tops of letters are sloped instead of straight, actually making Arial less 
readable. Arial is now everywhere, it's a horrible font:

http://www.marksimonson.com/notebook/view/the-scourge-of-arial

There was another site screenfont.ca but it seems to have disappeared. I 
suspect trebuchet (a medieval catapult) is in the same category, and is a font, 
like Arial that will take years to kill off.

We need to put font design back into the hands of artists, not technical 
people... or artists (like Matthew Carter) constrained by technologists.

> 
> - Apparao
> 
> From: Jens Alfke mailto:j...@mooseyard.com>>
> Date: Mon, 13 May 2013 10:35:33 -0700
> To: Apparao mailto:appar...@ivycomptech.com>>
> Cc: "cocoa-dev@lists.apple.com" 
> mailto:cocoa-dev@lists.apple.com>>
> Subject: Re: Displaying "Trebuchet MS" font
> 
> 
> On May 13, 2013, at 7:07 AM, Appa Rao Mulpuri 
> mailto:appar...@ivycomptech.com>> wrote:
> 
> I am working on an application which will display Same font (Trebuchet MS) 
> throughout the Application. I have changed in all places except the following 
> ones
> 
> Window Tool bar items text
> Text in NSAlert panels
> Tooltip text
> 
> Please don’t do this. Unless you actually want your app to look like a 
> careless port, and give lots of people a bad first impression of it.
> 
> —Jens
> This email and any attachments are confidential, and may be legally 
> privileged and protected by copyright. If you are not the intended recipient 
> dissemination or copying of this email is prohibited. If you have received 
> this in error, please notify the sender by replying by email and then delete 
> the email completely from your system. Any views or opinions are solely those 
> of the sender. This communication is not intended to form a binding contract 
> unless expressly indicated to the contrary and properly authorised. Any 
> actions taken on the basis of this email are at the recipient's own risk.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com


___

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

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

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

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

Re: Displaying "Trebuchet MS" font

2013-05-15 Thread Ian Joyner
Thanks for the clarifications Jens, but I don't think what I was saying is so 
far removed from your more detailed story. I did realise after I posted that MS 
probably was somewhat justified in avoiding Adobe's outrageous licence fees. 
And it is certainly true that Matthew Carter is highly regarded and made good 
contributions. Perhaps my concerns are about the careless ways people use fonts 
and just lazily use Arial by default (when they should use a serif font). I 
think there is something of a war between Monotype and Linotype, so this seems 
to have blurred the situation somewhat. Although designed by Carter, I don't 
really like Georgia or Verdana (too wide and blocky), and I think he has done 
better. But like Arial they seem to just be everywhere because too many people 
just do what MS says.

I do think we now have too many fonts and many of these have been designed 
around technological constraints that are disappearing, but they will continue 
to be used by default. I'm continually researching for good fonts and what 
should be used where (a taste I got while working in music publishing, also in 
the late 80s).

So if you have any suggestions of good resource sites making such 
recommendations please pass them on. The many books on typography I have don't 
actually make this very clear.

Ian

On 15 May 2013, at 05:46, Jens Alfke  wrote:

> 
> On May 13, 2013, at 6:43 PM, Ian Joyner  wrote:
> 
>> Yes there is now a confusion of very similar fonts. Many were done by 
>> Microsoft with tweaks to original fonts made to make them look 'good' (in 
>> someone's opinion, or was it just marketing) on the computer screens of the 
>> 1990s. 
> 
> Most of what you say in this email is simply not true. (Watch out, I worked 
> in font technology in the late ‘80s through 1990, and have kept tabs on it 
> since.)
> 
> The initial fonts in Windows were existing ones licensed from Bitstream, 
> including Arial (which is indeed a legal knockoff of Helvetica; for some 
> weird reason typeface designs are not protected by copyright law.) I’m not 
> sure why they went with these instead of getting the originals from Linotype 
> the way Adobe did; cost was probably a factor, also Bitstream had a lot of 
> font technology that Microsoft would have needed at the time.
> 
>> This shows the MS philosophy of bending the natural world to suit their 
>> technology, not improving technology to suit the world. So they designed 
>> fonts to look good on crappy screens. Apple on the other hand came along and 
>> said "we like these beautiful fonts, we don't want to change them, so let's 
>> make the screens better”.
> 
> Um, no. Everyone worked on adjusting fonts to crappy screens and 
> low-resolution printers. “Hinting” was one of the hardest parts of font 
> technology; Adobe tried to keep their algorithms in PostScript proprietary, 
> forcing people to buy very expensive licenses, until Apple did an end-run 
> around it by developing TrueType which had its own hinting scheme.
> 
> In the 1990s you simply could not get away with rendering unhinted fonts, 
> because most people’s displays didn’t support enough color depth to use 
> antialiasing. OS X 10.0 made a break with the past by requiring 16-bit or 
> higher color depth, in part because that was necessary for good antialiased 
> text.
> 
> Another factor that allowed good-looking antialiased unhinted text was 
> sub-pixel antialiasing, aka ClearType, invented by … Microsoft.
> 
>> Another reason MS designed all these wacky fonts was licence fees. While 
>> bleating on about people stealing software with copies and depriving them of 
>> fees, they copied fonts, subtly changing a few pixels and the name to avoid 
>> licence fees.
> 
> Bitstream did that, not Microsoft, back in the ‘70s and ‘80s. They’re far 
> from the only ones who did: other big vendors like Compugraphic made 
> knock-off fonts too, and it goes on today — any of those CD-ROMs with 
> zillions of cheap fonts are loaded with badly-drawn imitations of famous 
> designs.
> 
> Microsoft has since developed/published a lot of original high-quality fonts 
> including Georgia, Verdana, Trebuchet, Calibri, etc. Most of these were 
> designed by very competent highly-regarded type designers like Matthew 
> Carter. Yes, they were designed to look good on low-resolution computer 
> screens with hinting. There’s nothing wrong with that — type has always been 
> designed around the limitations of printing/display technology. Newspaper 
> fonts like Times Roman are specially tweaked to be legible at small sizes on 
> crappy newsprint. Older fonts had tweaks like “ink traps” to work around the 
> way that ink smears around the edge of the glyph dur

Re: NSMapTable with C strings as keys

2013-05-29 Thread Ian Joyner
On 29 May 2013, at 14:14, Oleg Krupnov  wrote:

> While I generally agree that premature optimization is evil,

That seems to come out of a belief that well-structured code is code that runs 
poorly (this belief came out of an IBM system of the 50s/60s that had really 
poorly running subroutine calls - so the recommendation was not to structure 
things).

In one sense I think we should always be optimizing code. That is in the sense 
that we write well structured and correct code. Usually optimization naturally 
follows. There seems to be a school of thought that writing poorly structured 
code must be optimized, but I have usually seen that most badly running code is 
a result of poor structure and refactoring makes it both structured and 
optimized. Once you have got to such a structured state then you might be able 
to see where further optimizations can be made to profiled areas of code which 
might result in more complex, but still structured and optimized. Where 
something simple is replaced by a more complex algorithm it should be well 
documented.

That is the subject of Dijkstra's book "A Discipline of Programming". Once a 
well-structured algorithm is developed, better optimizations can then be seen. 
This is the 'engineering' part of software development - making software run 
practically (not the drawing diagrams part). For particular computations (that 
is where the algorithm works on particular data sets), an algorithm might not 
be optimal, so needs to cater to those cases.

In summary - we should be producing well-structured code early on. This will 
usually result in well-optimized code. However, this is not a guarantee and 
particular cases may need to be addressed later (that is the premature 
optimization case). But we should always aim to produce well-structured code.


___

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

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

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

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


Re: NSMapTable with C strings as keys

2013-05-30 Thread Ian Joyner
On 30 May 2013, at 12:33, Jens Alfke  wrote:
> 
> On May 29, 2013, at 6:30 PM, Ian Joyner  wrote:
> 
>> That seems to come out of a belief that well-structured code is code that 
>> runs poorly
> 
> No, it’s a paraphrase of a famous quote by Don Knuth ("We should forget about 
> small efficiencies, say about 97% of the time: premature optimization is the 
> root of all evil.”[1]) He later attributed this to C.A.R. Hoare.

OK, thanks, it was badly put on my part. I have Knuth's paper and will give it 
another read (after rereading Structured Programming (Dahl, Dijkstra, Hoare) 
which Knuth says will change your life).

What I am trying to point out though is that there is a misapprehension that 
premature optimization means writing structured code early on so don't 
structure it because you can always go and clean it up later. Rather I think we 
should write well-structured code as we go. Often that will result in efficient 
code (invariant statements not being in loops, etc), but that is not what is 
meant by premature optimization.

This kind of optimization is more about changing the algorithm than the code. 
We should beware not to lump well-structured code writing with premature 
optimization just because well-structured code usually ends up being optimized 
code. Well-structured code also ends up being more correct and more easily 
changed and refactored.

___

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

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

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

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

Re: NSMapTable with C strings as keys

2013-05-30 Thread Ian Joyner
On 31 May 2013, at 01:43, Jens Alfke  wrote:
> 
> On May 30, 2013, at 3:52 AM, Ian Joyner  wrote:
> 
>> What I am trying to point out though is that there is a misapprehension that 
>> premature optimization means writing structured code early on so don't 
>> structure it because you can always go and clean it up later. Rather I think 
>> we should write well-structured code as we go.
> 
> I agree 100% with that. Structured code is easier to benchmark and optimize 
> later on, anyway — as I said, if you repeat a piece of code ten times, none 
> of the ten instances may show up individually as hot spots, whereas if you 
> called a common function/method in ten places, it may show up and then be 
> easy to fix.
> 
> I would add, though, that the perfect structure (class hierarchy, API, 
> factoring…) may not be apparent right away, especially since you’ll often end 
> up refactoring as you go along. So trying too hard to structure code as 
> you’re initially writing it can end up being a rathole.

Absolutely. It's often the case that we try to get everything ultra-structured 
before writing any code. This can be a writer's block. We often have to use the 
process of coding as an exploratory process. That is the very essence of 
software. It also means that software can be refined as we go. But often we 
need to know when to stop.

Structured (and OO) languages directly support the paradigms. This seems not 
well understood since we attempt to structure code (code is a term I don't 
like) by the use of diagrams because we treat the act of programming as 
translating this into a machine-oriented artefact. But in fact a text-based 
programming language is often more malleable than such diagrams (in terms of 
both tool and mental attitudes that a diagram is fixed, even if a programmer 
comes up with better designs).
___

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

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

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

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

Re: Why is it wrong to have relationships without an inverse in Core Data?

2013-06-23 Thread Ian Joyner
On 23 Jun 2013, at 13:32, "Reaves, Timothy"  
wrote:

> What the docs state that is meaningless (although inaccurate); the
> Objectice-C manual could very easily state that Objective-C is not a
> programing language; it is.  CoreData is a database.

OK, what the Apple doc 
http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/CoreData/Articles/cdTechnologyOverview.html%23//apple_ref/doc/uid/TP40009296-SW1
 says:

"Core Data is not a relational database or a relational database management 
system (RDBMS).

"Core Data provides an infrastructure for change management and for saving 
objects to and retrieving them from storage. It can use SQLite as one of its 
persistent store types. It is not, though, in and of itself a database"

I agree with you in the general sense, but I think the docs are speaking in the 
more specific sense. CoreData is really the middleman which can interface to a 
number of data stores. To think of a database as a data store is also 
misleading because the relational model is very high-level and very abstract 
and about as far away from data store as you could get.

CoreData is more a modelling system (I could say data model... but it's not 
that either). Thus programmers should be abstracted away from the physical 
storage medium (which I think is a point you are making).

However, CD does rather look like the entity-relationship model, which is 
fundamentally broken by distinguishing between entities and relationships and 
lacks precision and formality (correctness and flexibility) which the 
relational model has.

So in one sense you are right it is a database, but I'd say more a definer of 
data models and these happen to get stored somewhere in a database. But CD is 
not that database itself - it is the glue between the DB (or in-memory store) 
and an application program.

>  A database need never
> write anything to a file.  There are - in fact - several examples, of all
> manor, of in-memeory data bases that never bother to persist to a file.  As
> the documentation points out, there are five(?)(XML, plist, SQLite, iCould,
> in-memory) supported backing stores.  Four will cause a file to be created,
> and one will not.
> 
> Yes, it's fully possible for CoreData to be broken into two components; one
> that manages object graphs, and one that manages persisting them.  But
> until that time, CoreData is a framework/library/module with the intention
> of causing data to be stored, even if only in memory. That, by definition,
> makes it a database, and when at least one particular backing stores is
> used, it also makes it an ORM.  That it can do other things is irrelevant.
> 
> Now, enough with the philosophy!  :-D
> 
> 
> 
> 
> 
> On Sat, Jun 22, 2013 at 4:19 PM, Luther Baker  wrote:
> 
>> ... yes, and if you are going to be pedantic, please be somehow consistent
>> with the docs:
>> 
>>> Core Data provides an infrastructure for change management and for
>> saving objects to and retrieving them from storage. It can use SQLite as
>> one of its persistent store types. *It is not, though, in and of itself a
>> database.* (To emphasize this point: you could for example use just an
>> in-memory store in your application. You could use Core Data for change
>> tracking and management, but never actually save any data in a file.)
>> 
>> 
>> http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/CoreData/Articles/cdTechnologyOverview.html#//apple_ref/doc/uid/TP40009296-SW1
>> 
>> 
>> 
>> 
>> On Sat, Jun 22, 2013 at 1:26 PM, Timothy Reaves <
>> trea...@silverfieldstech.com> wrote:
>> 
>>> Yes, CoreData is a database, and it does do ORM.  It's not just an ORM,
>>> and it's not an RDBMS.
>>> 
>>> If it wasn't a database, it couldn't store data; that is the definition
>>> of a database. A database is not something that has row, columns, etc; it's
>>> something that stores data in an unspecified manor.  Yes, and ASCII file
>>> can be a database, as many, many are on the mainframe.  You seem to be
>>> confused as to what a database is.
>>> 
>>> If CoreData didn't do ORM, it couldn't persist objects into a SQL
>>> database, which it does with SQLite.  It is not 'just' an ORM, and the ORM
>>> features may be optional, but they are still there.
>>> 
>>> If you are going to be pedantic, be accurate in your pedanticism.
>>> 
>>> 
>>> 
>>> 
>>> On Jun 22, 2013, at 10:37 AM, Kyle Sluder  wrote:
>>> 
 On Jun 22, 2013, at 12:55 AM, Rick Mann  wrote:
 
> 
> On Jun 22, 2013, at 00:50 , Keith J. Schultz 
>>> wrote:
> 
>> Core data helps in setting up the database, but deleting is another
>>> matter.
>> You should do that manually for consistency. Core Data has no
>>> knowledge of the
>> semantics of your database. so use prepareToDelete.
 
 I'm sorry, but what?
 
 1. Core Data is NOT a database. It is NOT an ORM. Core Data is a model
>>> object persistence and management framework. It just so happens that it can
>>> use a SQLit

Re: Why is it wrong to have relationships without an inverse in Core Data?

2013-06-23 Thread Ian Joyner
Thanks for the reference to Codd's early paper. I'm researching the relational 
model now since I'm giving a course in distributed systems soon. In fact, I'm 
reading Codd's 1990 book "The Relational Model for Database Management Version 
2". It is available as a pdf (although I have had the physical book for years. 
Also good are any C.J. Data writings.

"An Introduction to Database Systems" says "SQL is not perfect. SQL is very far 
from being the perfect relational language - it suffers from numerous sins of 
both omission and commission". In particular it allows duplicate rows which 
lead to anomalies. It is a shame the relational model has come to be judged by 
SQL (rather like one could judge OO by C++). While Codd was a researcher at 
IBM, SQL was done by a committee at IBM, and is fundamentally tasteless. SQL 
also breaks the terminology and confuses tables with relations.

Codd 1990 has chapter 23 "Serious Flaws in SQL".

Other models have come along, like Entity-Relationship (ER) and OODBs, 
supposedly addressing the 'weaknesses' of relational. But they fail for all 
their heavy marketing. OO really gets back to network and hierarchical data 
models. It is also record-at-a-time oriented which was the pre-relational 
approach. This makes applications and users far more dependent on the structure 
of the data. While the relational model well expresses semantics, building in 
too much semantics is a mistake and makes what you might think of tomorrow more 
difficult because you built today's assumptions into the model. The approach of 
Hammer and McLeod (which resulted in Unisys SIM, which seemed a good idea at 
the time) really failed.

ER distinguishes entities and relationships. However, relationships are just 
modelled by the single notion of relation. For example, 'marriage' is a 
relationship between two people, but this is just as well modelled by a 
relation as an arrow between two people in the people relation. You can also 
add extra information like date-of-marriage and date-of-end, reason-for-end, 
etc in a relation, which you can't to an arrow. ER is imprecise in these 
matters. Codd covers this well in chapter 30 and Date in chapter 14. ER 
diagrams can be useful, but we should not confuse diagrams with goodness, 
especially when they lack formality (like UML).

Another book available for free online is Hugh Darwen's:

http://bookboon.com/en/an-introduction-to-relational-database-theory-ebook

He has done a lot of writing with Date on marrying relational with OO the 
correct way (The Third Manifesto).

Perhaps all this answers the original "inverse relationship" question by saying 
relational doesn't have relationships other than by relating data values. That 
is there are no rat's nest pointers making the system brittle. I'd have to do 
some more thinking as to whether that is a weakness in CoreData or not, but it 
seems to be erring in the ER direction.

On 23 Jun 2013, at 11:04, Michael Crawford  wrote:

> Relational Databases and Databases in general are two different things.
> 
> E. F. Codd proposed Relational Databases in a 1970 Communications of
> the ACM paper that turned up instantly in a search.  Here's a PDF:
> 
>   http://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf
> 
> That paper itself says nothing at all about SQL, which is used to
> communicate between the database and either the end user, or software
> that acts on behalf of the end user.  Instead it discusses the logical
> structure of Relational Databases, with only databases that have that
> certain kind of structure being considered "Relational".
> 
> Part of that, for example, is the notion that there should be only one
> copy of any given item of data.  Say you stored Steve Wozniak's
> payroll information, and you put his salary in two different fields
> because it was convenient to do so, either because the client code was
> easier to write, or the data could be retrieved or stored more quickly
> that way.
> 
> Inevitably some innocuous error would result in the two copies
> becoming different from each other, and there would be Hell to pay.
> 
> There's a lot more to it than that.
> 
> Codd himself many years later - just a few years ago - spoke of his
> great disappointment with SQL, pointing out that SQL all by itself
> does not make any database at all Relational.  That's up to the
> database architect who designs its schema.  There are some things that
> the database vendors must implement, such as atomic and fault-tolerant
> storage, but any fool can create an Oracle or MySQL database that's
> not Relational by designing the tables, rows and columns in some
> manner of incorrect way.
> 
> There are many kinds of databases that are really great, but that
> don't even attempt to be Relational.
> 
> Mike
> 
> On Sat, Jun 22, 2013 at 3:03 PM, Charles Srstka
>  wrote:
>> On Jun 22, 2013, at 10:43 AM, Michael Crawford  wrote:
>> 
>> I don't use Core Data because it's not cross-platform.  In my honest
>> opinion

Re: Why is it wrong to have relationships without an inverse in Core Data?

2013-06-24 Thread Ian Joyner
The other reason I can think of for not classifying CoreData as a database is 
that CD is only meant for one application (at a time anyway), whereas specific 
databases (as in DB management systems DBMS) are meant to be shared on a 
massive scale.

Another interesting point from Codd is that he very much envisaged databases to 
be used by end users and not (just) by programmers. This was before Xerox PARC 
and Apple, and this is where SQL is a 'psychological' failure.

On 24 Jun 2013, at 11:23, Ian Joyner  wrote:

> On 23 Jun 2013, at 13:32, "Reaves, Timothy"  
> wrote:
> 
>> What the docs state that is meaningless (although inaccurate); the
>> Objectice-C manual could very easily state that Objective-C is not a
>> programing language; it is.  CoreData is a database.
> 
> OK, what the Apple doc 
> http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/CoreData/Articles/cdTechnologyOverview.html%23//apple_ref/doc/uid/TP40009296-SW1
>  says:
> 
> "Core Data is not a relational database or a relational database management 
> system (RDBMS).
> 
> "Core Data provides an infrastructure for change management and for saving 
> objects to and retrieving them from storage. It can use SQLite as one of its 
> persistent store types. It is not, though, in and of itself a database"
> 
> I agree with you in the general sense, but I think the docs are speaking in 
> the more specific sense. CoreData is really the middleman which can interface 
> to a number of data stores. To think of a database as a data store is also 
> misleading because the relational model is very high-level and very abstract 
> and about as far away from data store as you could get.
> 
> CoreData is more a modelling system (I could say data model... but it's not 
> that either). Thus programmers should be abstracted away from the physical 
> storage medium (which I think is a point you are making).
> 
> However, CD does rather look like the entity-relationship model, which is 
> fundamentally broken by distinguishing between entities and relationships and 
> lacks precision and formality (correctness and flexibility) which the 
> relational model has.
> 
> So in one sense you are right it is a database, but I'd say more a definer of 
> data models and these happen to get stored somewhere in a database. But CD is 
> not that database itself - it is the glue between the DB (or in-memory store) 
> and an application program.
> 
>> A database need never
>> write anything to a file.  There are - in fact - several examples, of all
>> manor, of in-memeory data bases that never bother to persist to a file.  As
>> the documentation points out, there are five(?)(XML, plist, SQLite, iCould,
>> in-memory) supported backing stores.  Four will cause a file to be created,
>> and one will not.
>> 
>> Yes, it's fully possible for CoreData to be broken into two components; one
>> that manages object graphs, and one that manages persisting them.  But
>> until that time, CoreData is a framework/library/module with the intention
>> of causing data to be stored, even if only in memory. That, by definition,
>> makes it a database, and when at least one particular backing stores is
>> used, it also makes it an ORM.  That it can do other things is irrelevant.
>> 
>> Now, enough with the philosophy!  :-D
>> 
>> 
>> 
>> 
>> 
>> On Sat, Jun 22, 2013 at 4:19 PM, Luther Baker  wrote:
>> 
>>> ... yes, and if you are going to be pedantic, please be somehow consistent
>>> with the docs:
>>> 
>>>> Core Data provides an infrastructure for change management and for
>>> saving objects to and retrieving them from storage. It can use SQLite as
>>> one of its persistent store types. *It is not, though, in and of itself a
>>> database.* (To emphasize this point: you could for example use just an
>>> in-memory store in your application. You could use Core Data for change
>>> tracking and management, but never actually save any data in a file.)
>>> 
>>> 
>>> http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/CoreData/Articles/cdTechnologyOverview.html#//apple_ref/doc/uid/TP40009296-SW1
>>> 
>>> 
>>> 
>>> 
>>> On Sat, Jun 22, 2013 at 1:26 PM, Timothy Reaves <
>>> trea...@silverfieldstech.com> wrote:
>>> 
>>>> Yes, CoreData is a database, and it does do ORM.  It's not just an ORM,
>>>> and it's not an RDBMS.
>>>> 
>>>> If it wasn't a database, it couldn't store data; that is the definition
>>>

Re: Why is it wrong to have relationships without an inverse

2013-06-24 Thread Ian Joyner
On 24 Jun 2013, at 02:11, Gordon Apple  wrote:

> You mentioned MacApp.  I was heavily involved in that for awhile and even
> got into the credits.  I don¹t know if you remember Bob Krause.  When I was
> running the developer sig at LA Mac Group, I had him down for a presentation
> on his object database backend, NeoAccess.  He had a version for MacApp, but
> I believe he also had one for Next Step.  

MacApp - I used to teach it as well. It was good in Object Pascal, but that got 
me into Eiffel to address the weaknesses of Object Pascal and the type system. 
But then Apple completely wrecked it by redoing it in C++. I'm still waiting 
for Eiffel to take off - it's not impossible - my wait for Apple (not Gordon 
:-)) finally paid off, but I seem to be old enough to be a teacher these 
days... oh well.

> I tried to get Apple, Inc. to look
> into it, but I guess they decided to go with their Enterprise Objects to do
> CoreData instead.  I wish they would take another look and consider doing a
> true object database engine using more of a CORBA-type interface, which, I
> believe, was attempted by Taligent, before Jobs killed it.

Enterprise Objects still is the best ORM around. The others mostly only do 
either new models or interfaces to legacy models, but not both. WebObjects is 
still worth a look at, although it was backed into the Java corner.

I can't comment on what you mean by 'true object' database engine, but it is my 
observation that most OODBs are based on extremely dubious foundations. Any DB 
really should be based on the relational model (Hmmm IBM got something right 
along with Fred Brooks), which can be extended with certain OO ideas like 
inheritance (EO does this rather well). In retrospect, I think Unisys made a 
huge mistake by not going more strongly with the relational model, although its 
DMSII could be used as a relational engine (and I did the Transparent Gateway 
interface to it), it was still rather record-at-a-time. Hammer and McLeod did a 
version of their Semantic Data Model (SDM) at Burroughs which was adapted to 
SIM (Semantic Information Manager), which also had inheritance. It was quite 
nice but didn't really get traction. Doug Tolbert, Randy Guck and others had a 
paper in Cardenas and McLeod 'Research Foundations in Object-Oriented and 
Semantic Database Systems'"

http://www.informatik.uni-trier.de/~ley/db/books/collections/cardenas90.html#JagannathanGFTT90

this is not a link to the paper - I can't find one, but here is another paper:

ftp://ftp.cs.utexas.edu/pub/techreports/tr03-43.pdf

I read some of the papers out of that book a few years ago, trying to clarify 
my thoughts on DBs and came to the conclusion that putting semantics at that 
level is a bad idea and that the level of semantics in the relational model is 
correct (although the OO and ER crowd frequently states that the relational 
model does not include semantics). I think the correct place to put semantics 
is in the applications - it is too hard (read non-agile) to predict all the 
possible uses of a DB up front and include it in the DB.

As for CORBA-type interface - that was one of the worst interfaces ever - a 
complete committee designed C++ mess. CORBA really is dead - the answer is 
REST. Michi Henning's article in ACM Queue is interesting reading on CORBA's 
fate.

http://queue.acm.org/detail.cfm?id=1142044

> 
> On 6/22/13 2:00 PM,  Michael Crawford  wrote:
> 
>> I don't use Core Data because it's not cross-platform.  In my honest opinion
>> no one in their right mind would bet their livelihood on platform-specific...

___

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

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

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

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

Re: Why is it wrong to have relationships without an inverse in Core Data?

2013-06-24 Thread Ian Joyner
So I think, if I understand what Graham is suggesting, that in a relational DB 
design you would model this with three relations 1) Parent 2) children (which 
could be the same as parent) 3) active_children. If a child is active you 
insert it in the active_children set (relation is a particular kind of set). 
When no longer active, delete it. That could be modelled in CD, but Rick could 
decide if that actually solves his requirement. In CD, you'd still need the 
relationships and inverse relationships via the intermediate relation, so I'm 
not sure if this does solve his problem. But I think it shows that the 
relationships of ER can all be modelled using entities and the lack of clarity 
of "what's an entity and what's a relationship" disappears.

On 25 Jun 2013, at 11:01, Graham Cox  wrote:

> 
> On 25/06/2013, at 12:49 AM, Flavio Donadio  wrote:
> 
>> Rick Mann, I don't understand why you need a separate relationship to 
>> retrieve the active Child objects. Please, consider doing this:
>> 
>> Parent
>> children to-many to Child
>> 
>> Child
>> parent   to-one to Parent
>> active  (boolean)
>> 
>> And then create an activeChildren: method in Parent with returns only the 
>> active children.
>> 
>> Sorry if this is not acceptable. I am just trying to help.
> 
> 
> In my experience, this is not a good design pattern.
> 
> It's common to want to maintain a subset of some collection (and it may be 
> that the subset can have at most a single member, as in Rick's case). Using a 
> boolean as a state variable in the objects to indicate membership of this set 
> is poor design because it a) requires a lot of management to turn off those 
> that become deselected, and b) requires much more time to iterate over the 
> collection to find the subset when needed, c) requires additional work if 
> there can be multiple, orthogonal sets of this nature.
> 
> Using the language of sets it becomes clear how to do this much more 
> efficiently: use a set! The NSSet class, and its cousin NSIndexSet, are ideal 
> for this purpose. If it's in the set it's a member, otherwise not. It's fast 
> and efficient, simple to extend without the member objects ever having to 
> care about it. Sometimes the member object will want to ask "am I a member of 
> such-and-such a set?", and this is where the child->parent relationship can 
> be used.
> 
> This is independent of Core Data, I'm not sure what features it has to 
> support this concept - maybe none, as typically this sort of subset 
> (selection) management is handled at the controller level.
> 
> I commend it to the house.
> 
> --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:
> https://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com


___

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

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

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

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

Re: Core Data Reverse Engineering KickStarter Project

2013-06-24 Thread Ian Joyner
On 23 Jun 2013, at 11:38, Michael Crawford  wrote:

>> To me, it's not that you'd have to write all the code from scratch that 
>> makes Core Data concerning, it's the fact that the format is undocumented.
> 
>> If Apple published a complete specification for the format, I'd be willing 
>> to use Core Data, but as it is, the prospect of having
>> one's own file format as a black box is a huge turn-off to me.
> 
> 
> Thanks for tip, I was unaware of that.
> 
> Sure I can see how it's nice to use the Core Data API, but one would
> have to be completely out of one's tree to save end-user documents in
> a completely undocumented format, even if it were cross-platform.

I don't think you would have to be completely out of your tree. The precedent 
is encapsulation - you should not care about internal layouts, only what the 
API exposes it. Seems that is exactly what CD does. And I think CD does give 
some extra discipline in modelling things correctly and making it easy to 
persist things, so I think it's doing a lot for you, notwithstanding my 
concerns that it might be more ER than relational. Most DBMSs also do not 
publish their internal file formats because these can change and if the 
abstraction is good - completely irrelevant. Thus application programmers 
should be encouraged to be loose coupled on the internals of a system, only 
using it in the published ways.

However, I can see your point that it is a concern that if Apple discontinues 
CD that suddenly we have a whole lot of unreadable data and really anything 
stored persistently should be cross-platform whether stored on disk, or 
transmitted across a network. But perhaps to do that, just a small utility 
program that uses to CD API to get the data will suffice.

But it is a little like the Carl Sagan records sent out on Voyager I (I think) 
for aliens to enjoy - now how are they going to do that without a record 
player? It will be like trying to decipher the Dravidian script of Mohinjo-Daro 
(we got lucky with Hieroglyphics with the Rosetta Stone). Vint Cerf recently 
stated that we might lose a lot of data because we lose the ability to 
interpret it (not such a new thought - one of the threads of Godel, escher, 
Bach).

> 
> I lost what would have otherwise been a really lucrative, really fun
> consulting gig in which I would have been able to use my Physics
> degree.  I'm afraid that I made it clear to the hiring manager that I
> considered him an idiot for even asking me whether I knew Core Data.
> I didn't come right out and say so, but I sure did make it clear that
> I considered him ill-advised.
> 
> Just now I'm about to register a KickStarter project that would
> compensate me for completely reverse-engineering the Core Data
> formats.
> 
> However I need to set a fixed price goal, as well as a finite delivery
> schedule.  One only gets money at all from kickstarter if both goals
> are met.  That kind of project estimation, in my own experience, is an
> as-yet unsolved problem, not just for me but for every software
> engineer.  If you claim you know how to estimate software development
> time and cost, I don't believe you.
> 
> Don't even _think_ about suggesting that such reverse-engineering is
> illegal.  Reverse-engineer is specifically protected under the law.
> 
> If you have some proprietary method you want legal protection for,
> that's what patents are for.
> 
> Trade secrets are used either when the invention is either not
> "novel", or not "unobvious" and so not legally patentable, or when one
> hopes to maintain the secret for longer than the patent's twenty-year
> term, such as the secret recipe for Coca-Cola.  There are only a very
> few, very trusted people who know what all the ingredients are.  Had
> they patented it, the recipe would have been placed into the public
> domain a hundred years ago.
> 
> I know this very well.  I've reverse-engineed a whole bunch of
> different kinds of things.
> 
> That resulted in a Senior Engineer position at Apple itself in the
> mid-90s, where in my role as a Debug Meister for the Traditional OS
> Integration team, I reverse-engineered a great many third-party
> applications that were found by QA to stimulate crashes in new builds
> of the Mac OS System.  I worked on 7.5.2 and 7.5.3.
> 
> For example, I once supplied Microsoft with the exact byte offset in
> the Word 6 binary, at which they started a one-shot timer, then after
> it fired, reset it, so it would tick continuously.  Unfortunately, the
> Classic Mac OS didn't have any really clear concept of a process -
> some other Apple engineer once described the System as just "a bunch
> of subroutines", so under a very heavy paging load, that timer would
> fire well after Word's executable code had been overwritten with some
> other data.
> 
> 
> My very first consulting gig when I hung out my shingle in April 1998,
> was to reverse engineer the Movie Magic Scheduling database format, so
> that Graphical Planet's handheld devices c

Re: Why is it wrong to have relationships without an inverse in Core Data?

2013-06-29 Thread Ian Joyner
Was there ever a satisfactory answer to this? I'm not sure what the CD 
modelling answer is, but this seems to be related to relational modelling 
referential integrity or in plainer language - no dangling pointers - in db 
language a foreign key must have a primary key in another relation.

For example if there is no inverse in the active child and the active child is 
deleted, the active_child foreign key will be left as such a dangling foreign 
key. (That is why your second solution clobbered original key.)  It needs to be 
set to nil (meaning value either not known or not applicable). This leads to 
Codd's 3- and 4-value logic, which is contentious in itself (Date does not like 
it and forbids null values). But you can answer that question 'Does the parent 
have to have an active child or not?'. That is an application-level integrity 
constraint.

The structure is not the only thing that needs to be considered, but what 
happens when changes are applied to that structure as well. (Reminds me of 
Steve Jobs quote of Design is not just how it looks, but how it works as well.)

On 22 Jun 2013, at 06:55, Rick Mann  wrote:

> I find myself frequently wanting to do something like this:
> 
> Parent
>  children to-many to Child
>  activeChild  to-one to Child
> 
> Child
>  parent   to-one to Parent
> 
> But Core Data complains that activeChild is misconfigured because it doesn't 
> have an inverse. But I have no need for an inverse, why does Core Data?
> 
> Thanks,
> 
> 
> -- 
> Rick
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/ianjoyner%40me.com
> 
> This email sent to ianjoy...@me.com


___

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

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

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

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

Re: Will programmers new to Cocoa benefit from a Cocoa Design Patterns Book ?

2008-06-02 Thread Ian Robinson

When is it published? Ian

__
Ian Robinson - Belfast - UK
Soapbox - <http://www.canicula.com/wp>

On 3 Jun 2008, at 00:05, Erik Buck <[EMAIL PROTECTED]> wrote:

In answering some private email about the forthcoming "Cocoa Design  
Patterns" book, I made the following observations.



 Design patterns describe high quality practical solutions to  
recurring programming problems and can sometimes be quite abstract.   
Design patterns state how to solve problems and why some solutions  
are preferred over others.  There are programming examples of  
patterns, but it is assumed that the patterns will be adapted as  
necessary on a case by case basis.  In other words, Design Patterns  
are not tutorials.



 The right time to introduce design patterns depends on the learning  
style of the individual programmer.  Some programmers are  
uncomfortable until they can see the "big picture".  Design patterns  
help show the big picture and provide rationale.  Other programmers  
are frustrated by theory and abstract ideas until they have mastered  
the details of a specific implementation.  For specific details,  
tutorials and focused sample programs are more satisfying than  
design patterns.



 To use an analogy, design patterns for construction/architecture  
describe the rationale for having more than one external door – e.g. 
 for emergency egress.   Design patterns for construction/architectu 
re identify and contrast the different styles of architecture such a 
s Queen Ann Victorian or Prairie Style or Neo-Classical.  A design p 
atterns book for construction/architecture might provide a few sampl 
e floor plans to illustrate the application of a pattern, but you wo 
n't find a complete design for your specific house in the book.  Nor 
 will you find instructions for how to nail two boards together.



 Why Focus on Design Patterns?


 I wrote “Cocoa Design Patterns” to help satisfy your  
intellectual curiosity.  It’s easy to lose sight of the overall arch 
itecture and rationale of Cocoa. Many programmers comment that they  
feel lost in the multitude of classes, functions, and data structure 
s that Cocoa provides. They can’t see the forest because they‘re  
concentrating too much on individual trees. The patterns used in Coc 
oa provide a structure and organization that will help you find your 
 way. The patterns show how to reuse groups of cooperating classes e 
ven when the relationships between the classes are not fully explain 
ed in the documentation for individual classes.



 So, will programmers new to Cocoa benefit from a Cocoa Design  
Patterns Book ?  I think all programmers will benefit from  
understanding design patterns at some point whether they use Cocoa  
or not.  How soon a new programmer should tackle design patterns  
depends a lot on the programmer.



 Any programmer who is familiar with the famous Design Patterns book  
by the Gang of Four and enjoyed that book will enjoy "Cocoa Design  
Patterns".


___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Have questions...

2008-06-13 Thread Ian Joyner

On 13/06/2008, at 2:09 PM, Rick Langschultz wrote:

Am I aloud to ask where I can submit my iPhone programming questions  
to?


Yes, much to loud!
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Dot Syntax docs missing?

2008-07-19 Thread Ian Joyner

On 19/07/2008, at 11:36 PM, Michael Ash wrote:

On Sat, Jul 19, 2008 at 1:14 AM, Rick Mann <[EMAIL PROTECTED]>  
wrote:


On Jul 18, 2008, at 21:51:57, Jerry Krinock wrote:

setEp1: should work.  The colon is significant and is a part of  
the method

name.


In fact, I do have the colon in the actual definition. Definitely  
something

else is going on, I think.

I would advise you to embrace and learn both the dot syntax and  
square

brackets.


Well, I'm forced to use the square brackets for method calls  
(excuse me,
"message sends"), and I love square brackets as array index  
operators. I

don't think I'll ever embrace them for method dispatch.


The universe of programming languages extends far beyond this little
island of ALGOL-lookalikes. Objective-C messaging syntax is utterly
mundane compared to many common, useful syntaxes used in practical
(but different) languages every day. IMO you do yourself a disservice
if you don't branch out and try some different things once in a while,
and remember that they're just programming languages, and syntax is
just syntax, nothing really all that important.


Except that syntax is the medium to convey meaning, thus to make it  
easier for others to understand what a program is about. If it were  
not so, we may as well have stuck to programming machine language in  
1s and 0s. Thus syntax is important... or at least the manifestation  
of that which is important.


I like a Steve Jobs quote from 1996: “Design is a funny word. Some  
people think design means how it looks. But of course, if you dig  
deeper, it’s really how it works.” Clean syntax reflects clean  
functionality. The bracket syntax of Objective-C reflects the fact  
that it was a preprocessor rather than compiler. C's syntax reflects  
the fact that much unnecessary implementation detail could not be  
handled by a 1960s PDP 8 compiler. Of course, C.A.R. Hoare did quip  
that ALGOL was an improvement not only on its predecessors, but on  
most of its successors as well.


Ian___

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

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

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

This email sent to [EMAIL PROTECTED]


Two Questions About Parsing a String

2008-07-22 Thread Ian Jackson

Hi,

I'm looking for some help parsing a string from a file.

Firstly, getting the string is causing some issues. I read the String  
Programming Guide for Cocoa, and got this:


NSString *path = ...;
NSData *data = [NSData dataWithContentsOfFile:path];

// assuming data is in UTF8
NSString *string = [NSString stringWithUTF8String:[data bytes]];

along with a warning that you must not use:

 stringWithContentsOfFile:

So, I tried to do as I was told, but using the first example, I find  
that successfully getting a string from the data is quite random. When  
I start the application, my first attempt to load the file may or may  
not result and a string being created, but if not, repeatedly trying  
to load the file eventually works and I get the string. I'm not sure  
what the encoding is, (I'm trying to create a .obj reader), but  
setting it at UTF8 in Xcode doesn't help.
So, I took a peek at the dark side, and tried the soon to be  
deprecated  stringWithContentsOfFile: which works fine all the time.  
Any thoughts on why the first example might be failing randomly?


My second question is NSScanner related. Going through the .obj file,  
I have managed to get a system going where it scans for key characters  
(e.g. "v" for vertex, "#" for commented text etc). Roughly:


while ([theScanner isAtEnd] == NO)
{
[theScanner scanUpToCharactersFromSet:vCharacters 
intoString:NULL];
[theScanner scanCharactersFromSet:vCharacters 
intoString:&testString];

if ([testString isEqualToString:@"#"]) {
[theScanner scanUpToString:@"\n" 
intoString:&dumpString];
NSLog(@"dumpString is %@", dumpString);
}

else if ([testString isEqualToString:@"o"]) {
[theScanner scanUpToString:@"\n" 
intoString:&theObjectName];
NSLog(@"name: %@", theObjectName);
}

else if ([testString isEqualToString:@"v"]) {
[theScanner scanFloat:&xVert];
[theScanner scanFloat:&yVert];
[theScanner scanFloat:&zVert];
			NSLog(@"Vertex %i is: x = %f, y = %f, z = %f", ++i, xVert, yVert,  
zVert);

}
}   
}

However, the files also include identifiers such as "usemtl", which  
could appear at any time. So any ideas how you go about searching for  
a set of characters, and a set of strings simultaneously? i.e. how do  
I search for the characters without momentarily ignoring the strings  
or vice versa? This seems to be quite straightforward with fscanf, but  
it seems a bit odd going to C, when I'm trying to do this in Objective- 
C.


Any help with either question would be much appreciated.

Thank you,

Ian.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Two Questions About Parsing a String

2008-07-22 Thread Ian Jackson

Thanks for your responses.

Looks like stringWithContentsOfFile:encoding:error:  does what I need.

Jens, at least I know not to pursue the NSScanner thing any further in  
this case.


Thanks,

Ian.


On 23/07/2008, at 3:39 AM, Jens Alfke wrote:



On 22 Jul '08, at 2:09 AM, Ian Jackson wrote:


NSString *path = ...;
NSData *data = [NSData dataWithContentsOfFile:path];
// assuming data is in UTF8
NSString *string = [NSString stringWithUTF8String:[data bytes]];


The reason this doesn't work is that -stringWithUTF8String: expects  
a NUL-terminated C string, but [data bytes] just returns the raw  
contents of the data block. So the string factory method will keep  
reading past the end of the data until it finds a zero byte in  
whatever happens to be randomly out there. That means it'll read  
garbage past the end of the string, and if that garbage doesn't look  
like valid UTF-8, it'll fail.


The correct call to make would be
[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]
although as Patrick already replied, the best way to read a string  
from a file is +stringWithContentsOfFile:usedEncoding:error:, which  
will attempt to determine the encoding.


However, the files also include identifiers such as "usemtl", which  
could appear at any time. So any ideas how you go about searching  
for a set of characters, and a set of strings simultaneously? i.e.  
how do I search for the characters without momentarily ignoring the  
strings or vice versa? This seems to be quite straightforward with  
fscanf, but it seems a bit odd going to C, when I'm trying to do  
this in Objective-C.


This is beyond what NSScanner can do. You have a number of options,  
like scanning the string character by character using a 'for' loop,  
using a parser generator like ANTLR, or simply calling fscanf.  
(There's nothing wrong with using C APIs, when appropriate.)


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a drop-shadow around a view

2008-07-25 Thread Ian Jackson

Hi Graham,

if I understand your question, then I wanted to do something like this  
a while back. I got something off the internet, though I can't  
remember where.  Here's the source that I incorporated into my code.  
It's been ages since I added it in, so I can't remember whether this  
takes care of everything or not. I think it does.


Ian.

P.S. if anyone recognises this code as theirs, then I apologise.



SEDrawingClipView.m
Description: Binary data




On 25/07/2008, at 1:43 PM, Graham Cox wrote:

I have a view embedded in a NSScrollView. When the view is small  
there's a large expanse of grey visible. I'd like to draw a drop- 
shadow around the view in this situation to help it stand out  
slightly from the background. What's a good approach to do this?



tia,

cheers, 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/bianface%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Drawing a drop-shadow around a view

2008-07-25 Thread Ian Jackson

Ah yes,

Perhaps I should add that address in the comments at the top of the  
class for future reference. I see that the shadow stuff isn't in that  
original code, but it all seems to go hand in hand. The complete lack  
of commenting in the drawRect method strongly implies that I am  
responsible for that part. Apologies to anyone looking at the code,  
for all the unrelated stuff that I added in for my app. It was 5 past  
bedtime when I sent it.


Anyway, hopefully with that link, along with the extra bit at the  
bottom about how to incorporate the code, this should all help draw  
shadows.


Ian.

On 26/07/2008, at 7:36 AM, Jonathan Dann wrote:

How odd I came across this yesterday on my travels! The site for  
this source is


http://www.bergdesign.com/missing_cocoa_docs/nsclipview.html

Jonathan

www.espresso-served-here.com

On 25 Jul 2008, at 11:13, Ian Jackson wrote:


Hi Graham,

if I understand your question, then I wanted to do something like  
this a while back. I got something off the internet, though I can't  
remember where.  Here's the source that I incorporated into my  
code. It's been ages since I added it in, so I can't remember  
whether this takes care of everything or not. I think it does.


Ian.

P.S. if anyone recognises this code as theirs, then I apologise.




On 25/07/2008, at 1:43 PM, Graham Cox wrote:

I have a view embedded in a NSScrollView. When the view is small  
there's a large expanse of grey visible. I'd like to draw a drop- 
shadow around the view in this situation to help it stand out  
slightly from the background. What's a good approach to do this?



tia,

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


Re: Cocoa Dev Style: Using Class versus Object Methods

2008-08-08 Thread Ian Joyner
It's not style, but a technical consideration. Class-level things are  
shared and common between all object instances. They are thus like  
globals, but obviously better organized. Class-level methods cannot  
access things at the object level. Objects have their own different  
values of attributes.


Putting things on the stack is only an optimization which some OO  
languages let you do, if you know certain conditions will be met.


Ian

On 08/08/2008, at 3:08 AM, Lee, Frederick wrote:


Greetings:

   I just came across a NSObject subclass written by someone, that
contains a couple of date/Time-processing methods (stringToDate,
visa-versa).

The methods were all class-level methods (+) vs (-); and hence, didn't
require the familiar alloc & init instantiation methods.



I've been writing NSObjects via instantiation (requiring alloc & init)
that I use to model business logic (packing XML data vectors, etc.)  
and

hold a lot of common methods to use.



I can see a project using class methods instead of instantiated  
methods;

and hence, avoid the alloc/init memory hassles.



My question (which is ELEMENTARY), is

1)  why use instantiated objects versus classes (via class  
methods)?


2)  Are classes stored in the stack & instatiated objects on the
heap?





Ric.



___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ObjC 2.0, properties, KVC, special _ hacks etc.

2008-08-22 Thread Ian Joyner

On 22/08/2008, at 12:59 PM, Thomas Engelmeier wrote:


Am 22.08.2008 um 00:59 schrieb Dave MacLachlan:

Also, are the _ in front of member variables for Apple only (so we  
don't stomp on each other with member var names) or are they using  
them for the readability reason mentioned above? There is  
documentation where they have claimed _ at the beginning of method  
names as being Apple only, but nothing about method vars, and the  
KVC compliance docs seem to imply that it is fine to do.


Officially it is Apple only, but everybody and his dog uses it - in  
consistency to quite some Apple-provided samples.
Also, in C++ the _ variable prefix is reserved for stdlib- 
implementation.
The reasoning why many people do not consider it as problematic if  
there is a collision with an Apple defined _ prefixed ivar is you  
will see an compiler error once there is a collision.


Which pretty much means the preceding _ is just noise and gibberish  
and therefore plain bad style – something to avoid, it's not clever  
programming. Good style is to choose plain-language identifiers. The  
use of _ is to put white space between words in long identifiers, in  
contrast to poorly readable camelCase (maybe that should be hunchback  
case). (And note the spaces are outside the parentheses, not inside.)  
Why is it programmers generally choose the less-good way to do things,  
like programming Windows and C++!!


For methods OTOH, you don't get an warning but potential runtime  
crashes and undefined behavior.

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPersistentDocument Tutorial

2008-03-12 Thread Ian Jackson
I was happily plugging through the NSPersistentDocument Tutorial, when  
I got to the "Creating a Custom Class" chapter. The first strange  
thing is that when I created the files, the next instruction is to  
change the class name for the Employee entity from NSManagedObject to  
Employee, but this had already happened without me doing anything.  
That seemed like a good thing. I edited the class files as instructed,  
and came to the bit that says in the nib file, to change the model key  
path for the pop-up menu binding in contentValues to fullNameAndID.  
But the fullNameAndID option is not there. I tried dragging the  
Employee.h file into interface builder, but it didn't help (to start  
with it crashed IB in fact, when I had the bindings pane open). Is  
there a key part to this that I'm missing, getting IB to recognise  
that the Employee entity should be read from the Employee class?


Thanks in advance,

Ian.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPersistentDocument Tutorial (SOLVED)

2008-03-13 Thread Ian Jackson
I assumed that fullNameAndID would be available among the choices  
presented in the bindings pane. That not being the case, I tried  
typing it in, and it worked. Yay!


Ian.


On 13/03/2008, at 1:20 AM, Adam P Jenkins wrote:



On Mar 12, 2008, at 5:15 AM, Ian Jackson wrote:

I was happily plugging through the NSPersistentDocument Tutorial,  
when I got to the "Creating a Custom Class" chapter. The first  
strange thing is that when I created the files, the next  
instruction is to change the class name for the Employee entity  
from NSManagedObject to Employee, but this had already happened  
without me doing anything. That seemed like a good thing. I edited  
the class files as instructed, and came to the bit that says in the  
nib file, to change the model key path for the pop-up menu binding  
in contentValues to fullNameAndID. But the fullNameAndID option is  
not there. I tried dragging the Employee.h file into interface  
builder, but it didn't help (to start with it crashed IB in fact,  
when I had the bindings pane open). Is there a key part to this  
that I'm missing, getting IB to recognise that the Employee entity  
should be read from the Employee class?


Rather than dragging .h files onto IB like Apple's docs always  
suggest, I just use the "Synchronize With Xcode" command under the  
File menu in IB.   That said, I find that synchronization doesn't  
always make new properties appear as options in binding dialogs;  
sometimes you just have to type property names in by hand.  In  
general IB is pretty buggy, including its integration with Xcode, so  
don't be surprised when you run into other problems like inspector  
sheets which mysteriously blank out when you change a property.





___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTreeController & NSOutlineView bindings w/ Core Data

2008-03-17 Thread Ian Kennedy
I'm hoping this is simple, but everything I read makes it seem much  
more complicated than I think it should be.


I have this simple model: 
http://img.skitch.com/20080317-8wxj68njnsek652bnwaahm3t5b.png

In IB I instantiated an NSTreeController bound to the application  
delegate with a path of managedObjectContext. I set the entity to  
Course, checked 'Prepares Content' and added a key path for Children  
to 'sections'.


I can add courses, sections, and coursefiles, and the outlineview  
seems to recognize that the Course contains a Section, but it tells me  
that the entity Section is not kvc compliant for the key sections: http://img.skitch.com/20080317-qkmratwtpkfqx47rhqrtey4nqy.png


I've noted in the docs that:
 "All child objects for the tree must be key-value-coding compliant  
for the same child key path. If necessary you should implement  
accessor methods in your model classes, or categories on those  
classes, that map the child key to the appropriate class-specific  
method name."


I have set up NSManagedObject subclasses for each of my model objects.  
However, I am not able to find an example of which accessor methods I  
should add to map the children


Any help would be much appreciated, I've been struggling with this for  
days.


Thanks in advance,
Ian Kennedy
___

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

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

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

This email sent to [EMAIL PROTECTED]


xmldata: ContentTypeDeclaration *and* NodePrettyPrint?

2008-03-21 Thread Ian Kennedy
Hi all,

I'm hoping this is an easy question: is it possible to use both
NSXMLDocumentIncludeContentTypeDeclaration and NSXMLNodePrettyPrint as
options when converting an NSXMLDocument to NSData? I seem to only to
be able to do one or the other.

relevant code:
NSXMLDocument *manifestXML = [[NSXMLDocument alloc]
initWithRootElement:manifest];
[manifestXML setVersion:@"1.0"];
[manifestXML setCharacterEncoding:@"UTF-8"];
NSData *xmlData = [manifestXML
XMLDataWithOptions:NSXMLDocumentIncludeContentTypeDeclaration];
//NSData *xmlData = [manifestXML XMLDataWithOptions:NSXMLNodePrettyPrint];

Thanks in advance,
Ian Kennedy

-- 
nolite te bastardes carborundorum.
___

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

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

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

This email sent to [EMAIL PROTECTED]


XML to RTF transformation via XSL

2008-03-22 Thread Ian Jackson
I'd like to have my XML file read by my app, and save the file, or  
display it in a NSTextView, as RTF (with the appropriate formatting  
etc).


So I have been trying to use:

- (id)objectByApplyingXSLTAtURL:(NSURL *)xsltURL arguments: 
(NSDictionary *)argumentserror:(NSError **)error


Which is happily giving me the HTML document that would be expected.

The dev docs say that the return value for this method depends on the  
intended output. For RTF, an NSData object is returned.


So, how do I get this NSData object that I'd like?

I've tried:

 in my xsl file.

[xmlDoc setDocumentContentKind:NSXMLDocumentTextKind]; before doing   
the objectByApplyingXSLTAtURL


I've set the target properties to handle RTF.

I've cast the objectByApplyingXSLTAtURL message -

i.e. NSData *xmlData = (NSData *)[xmlDoc objectByApplyingXSLTAtURL: 
[NSURL fileURLWithPath:xsltPath] arguments:nil error:&err];


And these things either give an error in the console, or at best just  
give HTML. Also, I can't see how any of these settings (except the  
target properties) would give me RTF (rather than plain text).


Am I barking up the wrong tree here? I was expecting RTF output with  
bigger bolder text corresponding to  etc.


Ian.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data/IB questions

2008-03-27 Thread Ian Jackson
If I may be so bold, I'd like to jump in on this question. I have a  
similar situation, but I want to have a table representing a to-many  
relationship for entity1, which the user can populate by choosing any  
number of entries from a entity2.


e.g. entity2 has 50 entries.

entity1 1st entry refers to entries 1, 4, and 9 of entity 2.
entity1 2nd entry refers to entries 4, 8 and 26 of entity 2.

So I envisage that the table in entity1 should have add and remove  
buttons. When you click add, a new row is added to the table. The  
first column in the table is a NSCombobox, which can be used to select  
from the entries in entity 2.


The employee/department tutorial seems to come close to doing this,  
but as seems to be more the norm, it assumes that all entries in the  
relationship are wanted, which is not the case here.


So, I set up the interface as above (table with NSCombobox, and +/-  
buttons). I created a special array controller just for this to-many  
relationship, and bound its contentset to the relevant relationship in  
entity1.
The first column in the table is bound to the specially created array  
controller, arrangedObjects, but this is a dead end. I can't see how  
to make the combobox choose the entry. The combo box doesn't have the  
same binding options as a popup menu.


Any advice as to how to approach this would be great.

Ian.


On 27/03/2008, at 7:34 PM, Adam Gerson wrote:


I think that internally when you create a to-many core-data
relationship the group of objects is stored as an NSSet as opposed to
an array.


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/CntrlContent.html#/ 
/apple_ref/doc/uid/TP40002147-181724


http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#/ 
/apple_ref/doc/uid/20002174-178830-BAJEDEFB



On Thu, Mar 27, 2008 at 2:10 AM, Rick Mann <[EMAIL PROTECTED]>  
wrote:


On Mar 26, 2008, at 11:06 PM, Adam Gerson wrote:

Each table should have its own ArrayController if the two tables
represent the data from two different entities. Since you entities  
are

related I am assuming one entity has a property that is a to-many
relationship to the other entity. Set the ContentSet bindings for
ArrayController2 to be the selection of ArrayController1.

ArrayController2 ContentSet
Bind to = ArrayController1
Controller Key = selection
Model Key Path = (the name of the relationship that represents  
entity2

in entity1)

This will cause ArrayController2 to always populate the TableView  
with

the objects selected by ArrayController1

Let me know if that needs to be more clear.



Excellent! That was exactly what was missing. Thank you.

Why ContentSet, and not ContentArray or one of the other ContentXXX
things?

--
Rick



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data/IB questions

2008-03-28 Thread Ian Jackson

From a quick look at the app in action, I'd say no.

Say for example a school wanted to organise various clubs (chess club,  
debating club, objective-C club, etc). They could have an entity for  
each of the clubs, with venue, time, motto etc attributes.


Since the members of each club will come from the same pool (the  
pupils at the school), there could be another entity for pupils, with  
name, contact details etc attributes.


Now each of the club entities will need a to-many relationship to the  
pupils entity, so that rather than retyping member details each time,  
they can be selected from 'pupils'.  Since there's no way of knowing  
how many pupils will be in each club, they will have to be added to a  
set for that club as a reference, as needed. This would be a many-to- 
many relationship I imagine, since the people in the objective-C club  
might also be in the mountain biking club.


However, I leapt into the mailing list too quickly, seeing a similar  
topic popup, so I need to go and give it more thought, and if I'm  
still stuck, I'll send another message.


Thank you

Ian.


On 28/03/2008, at 5:11 AM, Adam Gerson wrote:


Is what you are describing similar to the "To Dos" example at:

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html


Adam



On Thu, Mar 27, 2008 at 5:33 AM, Ian Jackson <[EMAIL PROTECTED]>  
wrote:

If I may be so bold, I'd like to jump in on this question. I have a
similar situation, but I want to have a table representing a to-many
relationship for entity1, which the user can populate by choosing any
number of entries from a entity2.

e.g. entity2 has 50 entries.

   entity1 1st entry refers to entries 1, 4, and 9 of entity 2.
   entity1 2nd entry refers to entries 4, 8 and 26 of entity 2.

So I envisage that the table in entity1 should have add and remove
buttons. When you click add, a new row is added to the table. The
first column in the table is a NSCombobox, which can be used to  
select

from the entries in entity 2.

The employee/department tutorial seems to come close to doing this,
but as seems to be more the norm, it assumes that all entries in the
relationship are wanted, which is not the case here.

So, I set up the interface as above (table with NSCombobox, and +/-
buttons). I created a special array controller just for this to-many
relationship, and bound its contentset to the relevant relationship  
in

entity1.
The first column in the table is bound to the specially created array
controller, arrangedObjects, but this is a dead end. I can't see how
to make the combobox choose the entry. The combo box doesn't have the
same binding options as a popup menu.

Any advice as to how to approach this would be great.

Ian.




On 27/03/2008, at 7:34 PM, Adam Gerson wrote:


I think that internally when you create a to-many core-data
relationship the group of objects is stored as an NSSet as opposed  
to

an array.


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/CntrlContent.html#/
/apple_ref/doc/uid/TP40002147-181724

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#/
/apple_ref/doc/uid/20002174-178830-BAJEDEFB


On Thu, Mar 27, 2008 at 2:10 AM, Rick Mann <[EMAIL PROTECTED]>
wrote:


On Mar 26, 2008, at 11:06 PM, Adam Gerson wrote:

Each table should have its own ArrayController if the two tables
represent the data from two different entities. Since you entities
are
related I am assuming one entity has a property that is a to-many
relationship to the other entity. Set the ContentSet bindings for
ArrayController2 to be the selection of ArrayController1.

ArrayController2 ContentSet
Bind to = ArrayController1
Controller Key = selection
Model Key Path = (the name of the relationship that represents
entity2
in entity1)

This will cause ArrayController2 to always populate the TableView
with
the objects selected by ArrayController1

Let me know if that needs to be more clear.



Excellent! That was exactly what was missing. Thank you.

Why ContentSet, and not ContentArray or one of the other ContentXXX
things?

--
Rick





___

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

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

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


This email sent to [EMAIL PROTECTED]




___

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

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

Help/Unsubscribe/Update your Subs

Re: Untitled NSPersistentDocument has no persistent store

2008-04-02 Thread Ian Jackson

Have you done the tutorial?

http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/NSPersistentDocumentTutorial.pdf

You can add in the data as you like, and save when you've finished.

Ian.

On 2/04/2008, at 9:42 PM, Quincey Morris wrote:

It appears that a new (unsaved) NSPersistentDocument has no  
persistent store associated with it.


AFAICT, this makes it impossible to fault out any objects until the  
document is saved (there's nowhere to fault them back in from  
later). This effectively means it's impossible to put a lot of data  
into the document until after it's saved once -- until it's saved,  
all data has to be held in memory by the managed object context, and  
there just isn't enough memory.


Am I missing something here?. There seems to be nothing in the Core  
Data documentation that discusses memory management in an unsaved  
document. Forcing the user to save a document *before* putting  
things in it turns a very well established UI behavior on its head


(What I'm actually trying to do is import a lot of data from an  
external source into a new Core Data document. The smallest import  
is a couple of hundred MB. Larger imports could be several GB.  
Trying to use virtual memory to "cache" that much data will quickly  
bring a machine to its knees.)



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


to-Some Relationship (Core Data/IB questions)

2008-04-02 Thread Ian Jackson
Following on from a previous question (Core Data/IB questions), I am  
seeking advice again on how I should accomplish the following:


I need to select an arbitrary number (i.e. not necessarily 1 or all)  
of objects from a set of all objects belonging to another entity. I  
assumed this was a job for a to-many relationship, but I can't see how  
to use a to-many relationship, without having all the objects in the  
related entity included.


So will I need to write my own code to select objects via a to-one  
relationship, and add them to an array one by one? I guess the array  
would have to become a kind of property of the entity which is  
choosing from the relationship.


The point of this is to have a store of objects in the second entity,  
which can be picked from by objects of the second entity as needed.


I'd appreciate any advice, thank you.

Ian.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Untitled NSPersistentDocument has no persistent store

2008-04-02 Thread Ian Jackson

Ah OK, I see. But I can't help.

However the business of saving before you start happens with  
Garageband and iMovie. So on the plus side, it's not unheard of. On  
the downside, I agree it's a bit odd.


Ian.


On 2/04/2008, at 10:26 PM, Quincey Morris wrote:



On Apr 2, 2008, at 01:52, Ian Jackson wrote:


Have you done the tutorial?

http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/NSPersistentDocumentTutorial.pdf

You can add in the data as you like, and save when you've finished.


Yes, but the amount of data involved in the tutorial is tiny.  
There's no problem leaving it in memory until the document is saved.


What I'm doing is loading hundreds of megabytes (or more)  
sequentially into the new document. The earlier data needs to be  
saved persistently so that it can be faulted out to make room for  
later data.


This issue is complicated by the fact that "save" means somewhat  
different things in [NSManagedContext save] and [NSDocument save].



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bindings for NSComboBox?

2008-04-02 Thread Ian Jackson
Does this mean that you want to create a new object and add it to the  
array, by typing a new string into the combo box (and pressing enter)?  
My feeling is you'd need to write a bit of code yourself for that.


Ian.

On 1/04/2008, at 9:44 AM, David Springer wrote:


All,

I'm having trouble setting up the bindings for my NSComboBox.  I bind
the NSComboBox's content to NSArrayController's arrangedObjects.  This
works fine.

Now, I want to add to the content array when you enter a new string
into the combo box.  Say, for example, I start with an array of @"file
1", @"file 2", @"file 3".  Then, in the combo box, I enter "file foo".
I want to add this string to the content array, but I am at a loss as
to how to set up the bindings to do this.  Do I bind NSComboBox's
value to something?  My experiments in doing this so far are failing.

Help?
- Dave.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/bianface%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView - hiding columns

2008-04-11 Thread Ian Jackson

What is the effect of using:

- (void)removeTableColumn:(NSTableColumn *)aTableColumn   ?

I assume this just removes the column and doesn't affect the  
datasource. And you can use the corresponding method:


- (void)addTableColumn:(NSTableColumn *)aColumn

When the need arises to reshow it.

Ian.


On 11/04/2008, at 10:28 PM, Valentin Dan wrote:



The number of columns is dynamic as are the columns I need to  
hide ... it all depends on the settings & access rights of the user.


___
Valentin Dan, Software Developer Direct: +1 905 886  
1833 ext.3047
Email: [EMAIL PROTECTED] Office: +40  
356-710158
Masstech Group Inc.  Fax:+40  
256-220912

http://www.masstechgroup.com

THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN  
PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE  
IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR,  
PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS.  
PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.




-Original Message-----
From: Ian Jackson [mailto:[EMAIL PROTECTED]
Sent: 11 aprilie 2008 13:26
To: Valentin Dan
Subject: Re: NSTableView - hiding columns

Can't you just set the number of columns you want for your table in  
IB?


Ian.

On 11/04/2008, at 7:37 PM, Valentin Dan wrote:


Hi,



I have a table view that has visible vertical lines between columns.
I’m trying to hide a column and I’m probably / certainly going about
it the wrong way.



Currently the only way I found to hide it was to set it’s width &
minimum width to 0 (I still need to work with it’s data in the
background, I just don’t want the user to see the column so deleting
it from the dataSource is not an option).



The problem here is that the vertical lines do not disappear and
although the width is 0, a small space remains and the aspect of
multiple vertical column separators in the middle of the list is not
pleasant.



Is there a better way to do this?



Thanks !



___

Valentin Dan, Software Developer Direct: +1 905 886
1833 ext.3047

Email: HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]
Office: +40 356-710158

Masstech Group Inc.  Fax:+40
256-220912

HYPERLINK "http://www.masstechgroup.com/"http://www.masstechgroup.com



THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN
PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE
IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR,
PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS.
PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU.








No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:
10.04.2008 17:36

___

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

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

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

This email sent to [EMAIL PROTECTED]



No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:  
10.04.2008 17:36



No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.12/1372 - Release Date:  
10.04.2008 17:36




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView

2008-04-23 Thread Ian Jackson
Perhaps you have a good reason, but from your description, and being  
used to using Mail, I'd expect the lower part to display the content  
with a single click.
Have you used setTarget: and setAction: to coordinate this double  
click event?


Ian.

On 23/04/2008, at 8:33 PM, Ewan Delanoy wrote:



   Hello all,

 I'm trying to construct a Cocoa app that mimicks the Mail  
application,

with the difference
that it's not especially intended for mails : one the upper part a  
list of

titles, and on the lower
part exactly one title&text is shown. Double-clicking on a title in  
the

upper part makes the corresponding text displayed in the lower part.

I implement the upper part as a NSTableView subclass (which I call
UneditableTableView), with one column and all rows uneditable (by  
setting

the tableView:shouldEditTableColumn:row:
method to always return NO in the delegate). That main app controller
a signature of signature - 
(void)updateLowerPartAfterSelectionInUpperPart

that makes the lower part display
the text associated to the title just selected. Finally, in some  
place in

my code
I have the line

  [uneditableTableView
setDoubleAction:@selector(updateLowerPartAfterSelectionInUpperPart:)];


 Unfortunately, this doesn't work : although the rows are indeed
uneditable and I can select
any one of them, the "updateLowerPartAfterSelectionInUpperPart"  
method is

never called
when I double-click on a title. Does anyone have any idea of what I  
should

do to fix this?

TIA 
,



   Ewan


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Carriage returns and NSXMLParser

2008-04-23 Thread Ian Jackson
Whitespace is preserved, not ignored. But in your example, the new  
line is in the attribute value, so I don't suppose XML cares too much  
what's between the quotation marks.
So if you can obtain the value of the data attribute, and print the  
value to the console, does it come out with a space instead of the \n?


Ian.

On 23/04/2008, at 12:16 AM, Brad Peterson wrote:


Hi,

Have there been any recent changes to NSXMLParser with
respect to carriage returns?

I haven't noticed it previously, but I'm suddenly
seeing a lot of cases where carriage returns embedded
in data are returned as spaces by the parser.

That is:


Is read in as if it were:


I know that whitespace is technically ignored in XML,
but I didn't think it was necessarily discarded
either.

Is that the way it's supposed to be? Is there an
option I can set to change that?

Thanks!!


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Debugger at odds with reality? [SOLVED]

2008-04-27 Thread Ian Jackson
I've found that trashing the build folder is often a worthwhile step,  
and one other thing someone pointed out to me, is that you should do  
it when Xcode is not running. Otherwise it can still mysteriously  
remember some things that it's cached.


Ian.


On 27/04/2008, at 9:47 PM, Graham Cox wrote:


That explains the misalignment of the ivars in the debugger, but it  
*doesn't* explain the discrepancy between the actual layout of the  
class in the debugger compared with the latest version of the  
framework - the debugger was still using a layout which was last  
current about five weeks ago. That part I still haven't got to the  
bottom of, though basically throwing every build folder away that I  
could find and forcing a full rebuild ("clean" didn't do it) finally  
kicked into using the current version.


I'd still like to know more about how all this actually works - I  
feel I'm groping in the dark when things go wrong.


G.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa and the need for a dynamic language

2009-01-18 Thread Ian Joyner

On 18/01/2009, at 1:51 PM, Erik Buck wrote:


Both Objective-C message sending and C++ virtual function calls  
commonly prevent in-lining because the _compiler_ can not determine  
which code will actually be called.  If you use Objective-C message  
sending or C++ virtual member functions, you forego most low level  
optimizations at the call sites.


Nicely stated. Presumably, one is using a dynamic method because you  
are having to defer to runtime exactly what code will be executed. If  
you did not have dynamic method dispatch, you would have to explicitly  
write the decision mechanism in the code yourself (conditionals or  
case statements). That is, the complexity does not go away – it may be  
that the complexity of the method dispatch has to be explicitly coded.  
A recent article on computer architecture states this "complexity  
preservation principle" rather clearly:


http://www.embedded.com/columns/technicalinsights/29111964?_requestid=1581

Now in Objective-C, the compiler (or linker) can't do static analysis  
to remove unnecessary method dispatches because your system is  
effectively open (dynamic) to have various add ins (categories, etc)  
that can happen at runtime. If a system is closed (as with Eiffel), a  
compiler can be much more ruthless in its optimization attempts, but  
of course you lose the ability to dynamically add functionality. With C 
++, the complexity is to a very large extent left inelegantly up to  
the coder. Many programmers seem to feel safer that way.


Ian___

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

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


Job posting for Cocoa developer

2009-02-06 Thread Ian Marsh

Hi all,

Xsilva Systems is looking for a full-time Cocoa developer to help us  
develop next-generation versions of the LightSpeed Point-of-Sale  
software, Xsilva's flagship product for Mac OS X! The ideal candidate  
has proficiency and experience with Cocoa and Objective-C and business  
logic, and enjoys working in a fast-paced environment with an  
aggressive development cycle.  This position is open to remote  
developers from the US and Canada, with preference given to candidate  
to candidates on the East coast.


Requirements:
- 3+ years experience with Cocoa via Objective-C
- Familiarity with low level Mac OS X APIs
- Familiarity with the Objective-C runtime
- Familiarity with gdb
- Ability to travel to Canada as needed

Assets:
- Experience working on a database-driven application that has reached  
production status

- Core Animation experience a plus
- Python experience a plus
- Experience with business logic
- Knowledge of x86 assembly

Remuneration based on experience.

All interested applications are invited to submit their C.V. and code  
samples to care...@xsilva.com



Thanks!


Ian Marsh
Xsilva Systems
ian.ma...@xsilva.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: NSNull and @""

2008-10-10 Thread Ian Joyner

On 11/10/2008, at 9:33 AM, Seth Willits wrote:


On Oct 10, 2008, at 3:20 PM, DKJ wrote:

I've made an NSDictionary where the values are strings. Is there a  
difference between setting a value as [NSNull null] and setting it  
as @""? (I've been using the former.)


Is there a difference? Definitely. One is an instance of NSString,  
the other is an instance of NSNull. NSNull is not special. It's an  
object just like any other.


I'm just trying to work out what NSNull really is in the Cocoa  
context. Is it an object in Cocoa? I think (from other environments)  
that it is a type signifying "no object". Since NSNull may be a  
"valid" value of any other type, is it counted as a subtype of every  
other type (hence the ultimate subclass)? I think a good and simple  
(one that doesn't make my brain hurt) definition of NSNull is  
important in order to ensure software correctness.


"Passing paths that climb half way into the void"

Whether you want to use an empty string or an NSNull is up to you.  
If an empty string is a legal value, then you could use NSNull to  
represent there being no value given. (Or just simply don't have  
anything in the dictionary.)



--
Seth Willits


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSNull and @""

2008-10-10 Thread Ian Joyner

On 11/10/2008, at 11:58 AM, Seth Willits wrote:


On Oct 10, 2008, at 5:40 PM, Ian Joyner wrote:

I'm just trying to work out what NSNull really is in the Cocoa  
context. Is it an object in Cocoa?



As I said, yes. It's truly an object. (A singleton, as well.)



Since NSNull may be a "valid" value of any other type, is it  
counted as a subtype of every other type (hence the ultimate  
subclass)? I think a good and simple (one that doesn't make my  
brain hurt) definition of NSNull is important in order to ensure  
software correctness.


Woah. Talk about brain hurt. You're thinking about this far too much.


I don't think you can think about anything too much. If one doesn't  
have a clear understanding of the semantics of programming constructs  
then resultant software full of bugs (I'm sure Confuscious said  
something like this several thousand years ago). Perhaps that's why we  
have become so test dependent – don't think, just test. Well, I'll  
refrain from going further into a philosophical debate at this point.


There's no inheritance, there's no nothing. It's an object. It's  
absolutely in no way different than you creating your own IJNull  
class, and sticking an instance of it anywhere. It doesn't behave  
any differently.


As for use, the documentation says it pretty clearly:

"The NSNull class defines a singleton object used to represent null  
values in collection objects (which don’t allow nil values)."



You can't stick nil into dictionaries and arrays. So either you  
stick an empty string, an NSNumber with 0, etc if those are OK, or  
you can use NSNull.


So it's really a workaround for this situation. I think therefore  
there are several constructs to represent the same concept of "lack of  
presence" – nil, Nil, Null, and NSNull.


Sorry, but NULL values need very careful reasoning and handling. (See  
C.J. Date "Database Systems" 5.6 Nulls (A Digression).) Thanks for  
your insights.


Ian___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSNull and @""

2008-10-10 Thread Ian Joyner

On 11/10/2008, at 12:31 PM, Kyle Sluder wrote:


On Fri, Oct 10, 2008 at 8:40 PM, Ian Joyner <[EMAIL PROTECTED]> wrote:
I'm just trying to work out what NSNull really is in the Cocoa  
context. Is
it an object in Cocoa? I think (from other environments) that it is  
a type
signifying "no object". Since NSNull may be a "valid" value of any  
other
type, is it counted as a subtype of every other type (hence the  
ultimate
subclass)? I think a good and simple (one that doesn't make my  
brain hurt)
definition of NSNull is important in order to ensure software  
correctness.


The type system can, and often must, be willingly ignored, so you
can't rely on it to demonstrate anything about your program's
correctness.


So we must be dependent on testing, which I find compelling like agile  
programming, but ultimately very hit and miss.



If it's a strong type system you seek, I suggest you look elsewhere.


Insofar as strong typing helps software correctness, but as such, not  
necessarily strong typing. I appreciate the flexibility of dynamic  
languages, but one can have this also in strong typing.


Like, somewhere other than desktop Macintosh software development,


Why would I want to do that?


for
which all the popular languages have incredibly weak type systems.


Popular does not necessarily imply good, only democratic.

Ian
___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >