Re: The cost of using objects rather than plain C variables

2013-07-12 Thread Vincent Habchi
Hi!

Sorry for this late answer, I was a bit swamped lately.

 NSData wouldn't let you, but NSMutableData would, with methods like 
 appendBytes:length:, appendData:, increaseLengthBy:, etc.  The underlying 
 buffer might have to move around if it cannot be extended in place, just as 
 it would if you use C realloc() calls.

In fact, I overlooked that completely. I just fear building a buffer from zero 
to something like 400,000 * 3 * 4 bytes = just under 5 MiB would imply too many 
moves as you mention. 

Now, I am anyway moving towards a binary file that would be fed directly into 
the buffer rather than needing decoding, and partitioning it into several 
chunks in order to optimize the number of triangles displayed. I think I’ll use 
NSData to store these chunks.

Thanks to all for the precious help!
Vincent



___

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

Please do not post 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: The cost of using objects rather than plain C variables

2013-07-12 Thread Jean-Daniel Dupas

Le 12 juil. 2013 à 08:41, Vincent Habchi vi...@macports.org a écrit :

 Hi!
 
 Sorry for this late answer, I was a bit swamped lately.
 
 NSData wouldn't let you, but NSMutableData would, with methods like 
 appendBytes:length:, appendData:, increaseLengthBy:, etc.  The underlying 
 buffer might have to move around if it cannot be extended in place, just as 
 it would if you use C realloc() calls.
 
 In fact, I overlooked that completely. I just fear building a buffer from 
 zero to something like 400,000 * 3 * 4 bytes = just under 5 MiB would imply 
 too many moves as you mention. 

If you know how large your data will be and want to avoid the realloc cost, you 
can just create your mutable data using -initWithCapacity: .
And even if the size end up to be larger than your initial capacity, the 
mutable data will do the right thing and increase the capacity.

 Now, I am anyway moving towards a binary file that would be fed directly into 
 the buffer rather than needing decoding, and partitioning it into several 
 chunks in order to optimize the number of triangles displayed. I think I’ll 
 use NSData to store these chunks.
 
 Thanks to all for the precious help!
 Vincent
 

-- Jean-Daniel





___

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

Please do not post 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: Cocoa-dev Digest, Vol 10, Issue 424

2013-07-12 Thread Pamela Grandt
I will be out of the office Fri. July 12

___

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

Please do not post 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

Problem saving document with my doc icon

2013-07-12 Thread Peter Teeson
OS x Lion 10.7.5, Xcode 4.6.3

In my Document based app I am having trouble saving a document with my document 
icon.
The Finder still shows the file with the folder icon.

Here is my code:
- (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName
error:(NSError *__autoreleasing *)outError{
if ([self documentFileWrapper] == nil) {
NSFileWrapper * documentFileWrapper = [[NSFileWrapper alloc]
initDirectoryWithFileWrappers:nil];
// Get the main bundle for the app.
NSBundle *mainBundle = [NSBundle mainBundle];
if (mainBundle != NULL) {
// Get the Document Icon
NSString* theIconName = [mainBundle pathForResource:@GMG 
ofType:@icns];
NSImage* theDocumentIcon = [[NSImage alloc] 
initWithContentsOfFile:theIconName];
// NOTE: theDocumentIcon actually contains 5 BitMapRepresentations.
//   I think  I am supposed to extract one of them and use it ???
//  If so how? Which one to choose?
// The .icns file has sizes of 256 x356, 128 x 128, 48 x 48, 32 x 32, and 16 x 
16 (high res will be added later}.
// This file was created using Grab to get an image and IconMaker to make the 
icons from it.
// Preview displays the icons and the Inspector seems to indicate it's correct.
[documentFileWrapper setIcon:theDocumentIcon];
}
[self setDocumentFileWrapper:documentFileWrapper];
}
// add several FileWrappers for images, text, and metaData (as a plist).
.  .  .  .
[[self documentFileWrapper] addFileWrapper:imageFileWrapper];
. . . .  
[[self documentFileWrapper] addFileWrapper:metaDataFileWrapper];
return [self documentFileWrapper];
}
// This all works as expected except for the document icon.

The myApp-Info.plist has Icon file set to GMG.icns and the Document Type Item 
0 Icon File Name set to GMG.icns

TIA for your help

Peter

___

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

Please do not post 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: Using autolayout in a UI table view section header view

2013-07-12 Thread Conrad Shultz

On Jul 11, 2013, at 2:26 PM, Rick Mann rm...@latencyzero.com wrote:

 I'm trying to reproduce the UITableView section header view used by iOS for 
 regular text headers.

I wanted to make sure you know about UITableViewHeaderFooterView, which might 
be of use:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewHeaderFooterView_class/Reference/Reference.html

-Conrad
___

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

Please do not post 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: Using autolayout in a UI table view section header view

2013-07-12 Thread Rick Mann

On Jul 12, 2013, at 12:43 , Conrad Shultz conrad_shu...@apple.com wrote:

 I wanted to make sure you know about UITableViewHeaderFooterView, which might 
 be of use:
 
 http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewHeaderFooterView_class/Reference/Reference.html

Oh hey, that's handy! 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/archive%40mail-archive.com

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

Re: Problem saving document with my doc icon

2013-07-12 Thread Jens Alfke

On Jul 12, 2013, at 12:29 PM, Peter Teeson ptee...@icloud.com wrote:

 In my Document based app I am having trouble saving a document with my 
 document icon.
 The Finder still shows the file with the folder icon.

You don't need any code to accomplish this. Just make sure your Info.plist has 
a documentTypes entry for the filename extension you’re using for your bundle, 
and that the entry notes that it’s a bundle, and points to a valid icon file.

—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

realizeClass crash

2013-07-12 Thread Gideon King
Hi, my application is crashing consistently for one user. The application is in 
use successfully by thousands of people, and this user has it installed on 3 
machines but it only crashes on one of them.

Any ideas what would cause this kind of crash?

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0001, 0x

Application Specific Information:
objc[423]: layout bitmap too short

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib 0x7fff93813d4d _objc_trap() + 0
1   libobjc.A.dylib 0x7fff93813e8e _objc_fatal + 195
2   libobjc.A.dylib 0x7fff93814cfd 
set_bits(layout_bitmap, unsigned long, unsigned long) + 83
3   libobjc.A.dylib 0x7fff9380859d layout_bitmap_create 
+ 277
4   libobjc.A.dylib 0x7fff93816a67 
realizeClass(class_t*) + 1460
5   libobjc.A.dylib 0x7fff9381754d realizeAllClasses() 
+ 81
6   libobjc.A.dylib 0x7fff93818ca6 objc_getClassList + 
67
7   com.omnigroup.framework.OmniBase0x0001007954b7 +[OBPostLoader 
processSelector:initialize:] + 215
8   com.omnigroup.framework.OmniBase0x000100795394 +[OBPostLoader 
processClasses] + 36
9   com.omnigroup.framework.OmniBase0x00010079522c +[OBObject 
initialize] + 76
10  libobjc.A.dylib 0x7fff9380b236 _class_initialize + 
310
11  libobjc.A.dylib 0x7fff9380b138 _class_initialize + 
56
12  libobjc.A.dylib 0x7fff9380b138 _class_initialize + 
56
13  libobjc.A.dylib 0x7fff9380b0f3 
prepareForMethodLookup + 164
14  libobjc.A.dylib 0x7fff9380aeef lookUpMethod + 71
15  libobjc.A.dylib 0x7fff938092fc objc_msgSend + 188
16  com.novamind.NovaMind5  0x00010025cd6a 
+[OAPreferenceController(NM) load] + 95
17  libobjc.A.dylib 0x7fff93808d90 call_load_methods + 
389
18  libobjc.A.dylib 0x7fff9380898f load_images + 130
19  dyld0x7fff66e58e02 
dyld::notifySingle(dyld_image_states, ImageLoader const*) + 230
20  dyld0x7fff66e67057 
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const, unsigned 
int, ImageLoader::InitializerTimingList) + 357
21  dyld0x7fff66e66eba 
ImageLoader::runInitializers(ImageLoader::LinkContext const, 
ImageLoader::InitializerTimingList) + 54
22  dyld0x7fff66e58fc0 
dyld::initializeMainExecutable() + 207
23  dyld0x7fff66e5cb04 
dyld::_main(macho_header const*, unsigned long, int, char const**, char 
const**, char const**, unsigned long*) + 3060
24  dyld0x7fff66e58397 
dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header 
const*, unsigned long*) + 761
25  dyld0x7fff66e5805e _dyld_start + 54




Thanks

Gideon









___

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

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

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

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

Re: realizeClass crash

2013-07-12 Thread Ken Thomases
On Jul 12, 2013, at 11:45 PM, Gideon King wrote:

 Hi, my application is crashing consistently for one user. The application is 
 in use successfully by thousands of people, and this user has it installed on 
 3 machines but it only crashes on one of them.
 
 Any ideas what would cause this kind of crash?

The crash report should have listed the binary images loaded into the process.  
Look for those which are neither Apple's nor part of your app.

Regards,
Ken


___

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

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

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

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

Re: realizeClass crash

2013-07-12 Thread Jerry Krinock

On 2013 Jul 12, at 22:20, Ken Thomases k...@codeweavers.com wrote:

 The crash report should have listed the binary images loaded into the 
 process.  Look for those which are neither Apple's nor part of your app.

A little explanation.  I think Ken is suspecting that this one user has some 
kind of code-injecting system hack, which is misbehaving, installed on this one 
Mac.  Since this crash is occurring in a base-class +initialize method, that's 
worth considering in this case.  There wouldn't likely be any user data 
involved at that early stage.
___

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

Please do not post 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