Re: Simple instance [[alloc] init] question.

2010-08-30 Thread Dave Geering
>>> // 1)
>>> self.serialIDs = [[IRMSerialDetailsDO alloc] init];
>>
>> The alloc method allocates an instance with a retain count of 1, and
>> assigning it to the serialIDs property bumps it up to 2. In your
>> dealloc method, you will [hopefully] send it a release message which
>> puts it back at 1, but this means the object still survives (i.e. it
>> is not deallocated).
>>
>>> // 2)
>>> IRMSerialDetailsDO *mySerialIDDO = [[IRMSerialDetailsDO alloc] init];
>>> self.serialIDDO = mySerialIDDO;
>>> [mySerialIDDO release];
>>
>> Here, the alloc creates the instance with a retain count 1, assigning
>> it to the property bumps it up to 2, and the release right afterwards
>> puts it back down to 1. In your dealloc method, you will sent it
>> another release message which puts it at 0, and therefore the instance
>> is deallocated.
>>
>
> This is at best misleading, and illustrates why people are typically 
> discouraged from reformulating the memory management rules.
>

I apologise. I was going to explain each one in terms of ownership,
but I couldn't figure out a way to explain how you own something twice
without talking about reference counts. I should probably refrain from
replying to the list any time in the morning.
___

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

Please do not post admin requests or moderator comments to the list.
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: Simple instance [[alloc] init] question.

2010-08-30 Thread Dave Geering
> // 1)
> self.serialIDs = [[IRMSerialDetailsDO alloc] init];


The alloc method allocates an instance with a retain count of 1, and
assigning it to the serialIDs property bumps it up to 2. In your
dealloc method, you will [hopefully] send it a release message which
puts it back at 1, but this means the object still survives (i.e. it
is not deallocated).

> // 2)
> IRMSerialDetailsDO *mySerialIDDO = [[IRMSerialDetailsDO alloc] init];
> self.serialIDDO = mySerialIDDO;
> [mySerialIDDO release];

Here, the alloc creates the instance with a retain count 1, assigning
it to the property bumps it up to 2, and the release right afterwards
puts it back down to 1. In your dealloc method, you will sent it
another release message which puts it at 0, and therefore the instance
is deallocated.
___

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

Please do not post admin requests or moderator comments to the list.
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: *** -[NSBundle Load] : Error loading code

2009-07-06 Thread Dave Geering
Hi Arjun,

I know I'm a few weeks late but I only just yesterday had this same
problem. It took me an hour or so but I finally clicked that my bundle
was built for Intel and I was trying to load it on PowerPC.

I think that the error is certainly not very informative, and I don't
know whether or not "error code 2" specifically relates to
architecture issues, but making sure my bundle was compiled for both
Intel and PPC fixed the issue for me.

Hope that helps,

Cheers,
Dave

2009/6/23 Arjun SM :
> Hi all,
>  I am get the following error every time i run my application on Tiger
> 10.4.11
> *** -[NSBundle Load] : Error loading code /Library/Application
> Support/appName.bundle/Contents/MacOS/appName for bundle
> /Library/Application Support/appName.bundle/Contents/MacOS/appName, error
> code 2 (link edit error code 0, error number 0 () )
>
> Also please provide a link for the description of this Error code #.
>
> Thanks,
> ~Arjun
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/dlgeering%40gmail.com
>
> This email sent to dlgeer...@gmail.com
>
___

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

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

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

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


Re: Changing name of newly created NSDocument (instead of 'Untitled i')

2009-05-12 Thread Dave Geering
On Wed, May 13, 2009 at 12:07 PM, Dave Geering  wrote:
> On Wed, May 13, 2009 at 6:37 AM, Sean McBride  wrote:
>> Hi all,
>>
>> My doc-based application is able to import foreign file formats.  I do
>> this by creating a new instance of my NSPersistentDocument subclass and
>> populate it as needed.
>>
>> Works fine, but results in a document named "Untitled i".  Is there a
>> way to name it something like "original_filename (Converted)"?
>> setFileURL: doesn't seem appropriate since I don't want to ask the user
>> to choose an on-disk location.
>>
>> Thanks,
>
> From memory, you can override -displayName and return a string to
> display in the title bar, which can be any arbitrary string. I'm not
> sure what else -displayName is used for but I think it is entirely
> independent from the filename.
>

Sorry, misread the question. -displayName doesn't do what you want.
___

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

Please do not post admin requests or moderator comments to the list.
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: Changing name of newly created NSDocument (instead of 'Untitled i')

2009-05-12 Thread Dave Geering
On Wed, May 13, 2009 at 6:37 AM, Sean McBride  wrote:
> Hi all,
>
> My doc-based application is able to import foreign file formats.  I do
> this by creating a new instance of my NSPersistentDocument subclass and
> populate it as needed.
>
> Works fine, but results in a document named "Untitled i".  Is there a
> way to name it something like "original_filename (Converted)"?
> setFileURL: doesn't seem appropriate since I don't want to ask the user
> to choose an on-disk location.
>
> Thanks,

>From memory, you can override -displayName and return a string to
display in the title bar, which can be any arbitrary string. I'm not
sure what else -displayName is used for but I think it is entirely
independent from the filename.

Cheers,
Dave.
___

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

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

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

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


Re: Text encoding issues

2009-05-12 Thread Dave Geering
On Wed, May 13, 2009 at 11:53 AM, Ryan Joseph
 wrote:
> First question, why is the most obvious and best solution deprecated?
> NSString's initWithContentsOfFile:  accepts no encoding and appears it is
> getting the correct encoding in my tests.  Now they want us to use
> initWithContentsOfFile:encoding:error: and figure out the encoding
> ourselves? Sounds like now every person is going to be writing some
> utilities for sniffing encodings.
>
> I think I'm going to use initWithContentsOfFile despite Apple's wishes to do
> this myself but I did try the Carbon TEC manager and it appears to have
> created a organized list of encodings from the input bytes but it's totally
> wrong. The top choice was kTextEncodingJIS_X0208_90 followed by other Asian
> encodings for a file a plainly saved as UTF8 from TextEdit. I would say it
> was an error but it actually organized that list from the previous list of
> 200+ available encodings. Does that thing even work?

use -initWithContentsOfFile:usedEncoding:error: (introduced when
initWithContentsOfFile: was deprecated)

This way, it not only attempts to determine the encoding for you, but
tells you what encoding it successfully used, and rather than simply
returning nil on error, it gives you the error as well.

HTH

Dave.
___

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

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

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

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


Re: Create disk image files

2009-05-06 Thread Dave Geering
On Thu, May 7, 2009 at 8:52 AM, Jeff Johnson
 wrote:
> Nope.
> Yep.
> There is none.

It's reassuring that I was already heading the right way and that my
fruitless search was inevitable, but it's a pity that the creation of
disk images has not been exposed via a programming interface. I
suppose it's not something that programs do on a regular basis though.

On Thu, May 7, 2009 at 9:15 AM, Mike Abdullah  wrote:
> You do have to resort to hdiutil, but it does have a reasonably helpful mode 
> where it outputs XML, making your life easier to interpret the data.

Thanks for the tip


Cheers
Dave
___

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

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

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

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


Create disk image files

2009-05-06 Thread Dave Geering
Hi list,

Is there any framework that can be used for the creation of disk image
files, or do I have to resort to NSTask and hdiutil? I can't seem to
find any documentation about programmatically creating disk image
files.

Cheers,
Dave.
___

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

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

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

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


Re: Binding the enabled attribute of each NSPopUpButtonCell

2009-05-05 Thread Dave Geering
On Wed, May 6, 2009 at 2:30 PM, Jerry Krinock  wrote:
> But then there would have to be another API to give it the items, and
> another to localize the titles.  Don't wish for that.

Well, it's still not too bad an idea for me. "optionTitle" is already
localised in my custom object because it comes from a localised
source, but that still leaves the other issue.


> Actually, reality is better than your dream.  The hard part is to figure out
> which hook to use.  Look at
>  -[NSPopUpButtonCell setMenu:]
>  -[NSMenu menuNeedsUpdate]
>
> The easy part is to create the menu programatically.  You start at the top,
> creating menu items, and add them to the menu as you go along.  As you
> create each menu item, you set its title, target, action, enabled,
> representedObject, etc.  It's very straightforward coding.

That doesn't sound too hard at all. I just wish I didn't have to do it
manually considering nearly all the work is done for me with bindings
(except the enabling/disabling). This way, I'd not only have to create
the menu manually but also create all the bindings for the
"optionAllowed" key.

Perhaps it's a good idea to rethink my approach of the whole thing.
Perhaps there's a better way than using popup buttons.

Say you have a list of choices for the user. Whether each choice is
available depends on more than one underlying factor (in same cases up
to 5 or 6). These factors may include whether they have chosen
something from another list or whether certain checkboxes are ticked
etc. Is it better to only show what is relevant, or to show what is
possible and what is relevant together? Would it be better to allow
the user to choose anything but warn about conflicts?

I'm not sure where the idea of disabling menu items came from, but the
rest of the view all trucks along nicely just by using KVC and
bindings.
___

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

Please do not post admin requests or moderator comments to the list.
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: Binding the enabled attribute of each NSPopUpButtonCell

2009-05-05 Thread Dave Geering
On Wed, May 6, 2009 at 12:57 PM, Jerry Krinock  wrote:
>
> Bindings are wonderful.  I try and use bindings whenever available -- except
> when I'm dealing with menus.
>
> You see from Ken's response that there are things that just don't fit, or if
> they do fit, it might take a long time to figure out how.
>
> My advice is to not use bindings to create menus.  You will write less code
> and spend less time if you create your menus on the fly and use
> target/action.

Bugger, I was afraid someone might say that.

Although, after what Ken said I realised I had not put a lot of
thought into my setup. I don't know how I expected it to work. I'm
almost laughing about it now that I think about what I was trying to
do.

It'd be nice if I could somehow hook into whatever is responsible for
making the menu . . .

  - (void) willAddMenuItem:(NSMenuItem *) aMenuItem
  toPopUpButton:(NSPopUpButton *)
  forObject:(id) yourObject
  {
[aMenuItem setEnabled:[[yourObject valueForKey:@"optionAllowed"]
boolValue]];
  }

...
...
...

Anyway, enough dreaming, I'll resort to code-based menu making and see
if it really is less hassle.

Thanks for your help,
Dave.
___

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

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

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

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


Binding the enabled attribute of each NSPopUpButtonCell

2009-05-05 Thread Dave Geering
Hi List,

I've got a problem when I try to bind the enabled attribute of an
NSPopUpButtonCell.

I have set up an NSArray of custom objects, these custom objects
provide two keys that I want to use for binding (and other keys for
other uses). The two keys are "optionTitle" and "optionAllowed". I
have an array controller in my nib that I bind to my NSArray of custom
objects.

I populate an NSPopUpButton by binding the content to the
arrangedObjects of my array controller with MKP "optionTitle" and this
works fine. I'm trying to bind the NSPopUpButtonCell's enabled
attribute to the arrangedObjects of my array controller with MKP
"optionAllowed" but when my view loads an exception is raised saying
that it cannot create a boolean value from an NSCFArray.

optionAllowed should return an [NSNumber numberWithBool:YES] (or NO)
instance as the value. The value of optionAllowed can change during
runtime and I want this to reflect immediately in my view. If I make
the NSPopUpButton use MKP "optionAllowed" instead of "optionTitle", I
get a list of 1s and 0s which change in real-time when the
optionAllowed value changes in each of my custom objects, but I cannot
set the enabled state of the cell.

Please let me know if I am approaching this the right or wrong way,
and how I can enable or disable (or hide, which also does not work)
certain items in an NSPopUpButton.

Cheers,
Dave
___

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

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

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

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


Re: Writable dir for non-admin user outside user's dir

2009-04-30 Thread Dave Geering
On Fri, May 1, 2009 at 8:52 AM, Erg Consultant  wrote:
> Is there any location on the system outside the current user's dir that is 
> writable outside the user's domain? I need my app to create some files when 
> run under a non-admin acct that I need to persist across boots/logins. But 
> every permanent location seems to be locked except for things inside the 
> user's folder. I would have thought /Library/Application support would work 
> but no.

/private/var/tmp is supposed to persist across reboots, although I'm
not sure if there's a Cocoa way of obtaining this path or whether it
has to be hard-coded . . .
___

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

Please do not post admin requests or moderator comments to the list.
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: NSString may not respond to a method in documentation?

2009-04-26 Thread Dave Geering
> I think this is weird because componentsSeparatedByCharactersInSet is in the
> documentation for NSString It still works, but I don't know why xcode would
> give me this warning.

This method was added in Mac OS 10.5, so if you're using the Cocoa
framework from the 10.4 SDK you will get that warning, and your
program won't work on Mac OS 10.4.
___

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

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

2009-04-23 Thread Dave Geering
On Fri, Apr 24, 2009 at 6:42 AM, Todd Heberlein  wrote:
> For example, will
>
> foo2( CFSTR("bar") ); or
> foo2 ( CFStringCreateWithCString(NULL, "bar", kCFStringEncodingASCII) );
>
> leak memory?

The first won't, but the second will. It's similar to taking the
[[NSString alloc] initWithCString:] route. All Core Foundation creator
functions with Create or Copy in the name leave you with the
responsibility of releasing the return value when you're done with it.

There's a relatively new CFMakeCollectable() function which marks a
Core Foundation type as collectable by the garbage collector, but I
have no experience with it.
___

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

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

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

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


Re: Cocoa program without xib file

2009-04-16 Thread Dave Geering
On Fri, Apr 17, 2009 at 1:31 PM, Bill Bumgarner  wrote:
> What are you trying to do?
>
> Building a Cocoa program without a MainMenu.xib [or MainMenu.nib] is
> possible, but it is not recommended, supported, or at all standard/typical.
>
> b.bum

Objective-C-based command-line utilities that use only Foundation
framework would be classified as Cocoa, wouldn't they?
___

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

Please do not post admin requests or moderator comments to the list.
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: Equivalent of Redraw(MFC) on Cocoa

2009-04-06 Thread Dave Geering
On Mon, Apr 6, 2009 at 10:52 PM, Sourabh Sahu
 wrote:
> Hi Everyone,
> What is equivalent of Redraw method of MFC on Cocoa?
> Sourabh

Usually you can send an NSView or a subclass of NSView
"setNeedsDisplay:YES" and it will redraw the entire view.
___

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

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

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

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


Re: NSData encode decode

2009-04-02 Thread Dave Geering
>>
>> IEEE 754 floats always in the same order.
>>
>> p = 2.71828;
>> fprintf (stdout, "%x", *(unsigned long *)&p);
>>
>> Produces 402df84d on both my PPC and Intel Mac.
>
> Of course it does. Both long and float use the same byte order within
> the same CPU. That's all your test shows. Try doing this:
>
> float p = 2.71828;
> char *ptr = (char *)&p;
> printf("%02x%02x%02x%02x", ptr[0], ptr[1], ptr[2], ptr[3]);
>
> You will see reversed results between machines.
>

Of course! What was I thinking . . .
___

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

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

2009-03-23 Thread Dave Geering
On Tue, Mar 24, 2009 at 1:53 PM, Development
 wrote:
> I'm using an an NSXMLParser to parse a document. some of the elements are as
> follows: Some Thing
> The problem is that I cannot seem to come up with the element's property.
> During the parse which callback is going to give me the property and it's
> value?

Those are usually called attributes, not properties. Have a look at
this delegate method:

parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html#//apple_ref/doc/uid/20001984-BBCCIFGB

Cheers,
Dave
___

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

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

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

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


Re: Making NSTableView behave more like a spreadsheet with arrow keys

2009-03-05 Thread Dave Geering
Hi all,

My solution to this problem can be found at:

http://stackoverflow.com/questions/612805/arrow-keys-with-nstableview

It's not very elegant but it gets the job done, and I'm welcome to
suggestions for improvements.

Cheers,
Dave.

On Thu, Mar 5, 2009 at 3:13 PM, Dave Geering wrote:
> Hi all,
>
> Is there a clean way to subclass NSTableView or the field editor to
> provide a way for users to change the currently editable cell in an
> NSTableView by pressing the arrow keys? I've already tried subclassing
> NSTableView but that will only be sent keyDown if a cell isn't being
> edited, and I've tried creating a custom field editor but I cannot
> reliably get the current position in the table so I don't know what to
> pass to [tableView editColumn:row:withEvent:select] (assuming that's
> the way I need to go).
>
> Is NSTableView even the control I want? The table of data in my
> application can span perhaps 100 rows and up to 5 columns. The user
> will be expected to enter data into a fair majority of these cells. I
> already have everything set up using bindings so that the user can
> edit the data but it is painstakingly tedious to double-click on each
> cell to change it's value. Tabbing works quite well but because there
> are other responders in my window, tabbing in the last column takes
> you to the next key view.
>
> Thanks,
> Dave.
>
___

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

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

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

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


Making NSTableView behave more like a spreadsheet with arrow keys

2009-03-04 Thread Dave Geering
Hi all,

Is there a clean way to subclass NSTableView or the field editor to
provide a way for users to change the currently editable cell in an
NSTableView by pressing the arrow keys? I've already tried subclassing
NSTableView but that will only be sent keyDown if a cell isn't being
edited, and I've tried creating a custom field editor but I cannot
reliably get the current position in the table so I don't know what to
pass to [tableView editColumn:row:withEvent:select] (assuming that's
the way I need to go).

Is NSTableView even the control I want? The table of data in my
application can span perhaps 100 rows and up to 5 columns. The user
will be expected to enter data into a fair majority of these cells. I
already have everything set up using bindings so that the user can
edit the data but it is painstakingly tedious to double-click on each
cell to change it's value. Tabbing works quite well but because there
are other responders in my window, tabbing in the last column takes
you to the next key view.

Thanks,
Dave.
___

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

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

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

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


Re: Linking with a very specific library version

2008-11-13 Thread Dave Geering
> Dave,
> I have had similar problems in the past with linking with libcrypto.
> My solution has been to set the "Other Linker Flags" to the path to the
> library I want and set the "Library Search Paths" to that same library.
> The resulting linker flags look like:
> "-L "
> ../../IKEngine/IKEngineOpenSSL/openssl-0.9.8d/build/static/libcrypto.a
> Technical Q&A AQ1393 covers this some, but never completely worked for me.

Hi Rich,

I've found out that Panther's SNMP dylib's "compatibility version" is
6.0.0 and on Tiger it is 8.0.0, this is different than the actual
source-code version. Leopard comes with the same compatibility version
as Tiger as well as the latest SNMP libraries (they sit side by side).

Since my Bundle was linked with the Tiger SNMP library, even though it
has the same file name on Panther, it wouldn't load the library on
Panther because the compatibility version of Tiger's SNMP library was
greater. So, I linked with Panther's library instead, and did a little
version detection to make some adjustments in my parameters to the
API, and it worked, but the Panther library is PPC only (I had to
remove i386 as a target architecture for it to link at all) and so my
Bundle wouldn't work on Intel.

So, I created a new Xcode project; a fake dylib called
libnetsnmp.5.dylib (the same name as the actual version), and it
contained dummy entries for all the APIs I called from the real
library. I compiled this fake library for both Intel and PPC, and made
the "compatibility version" 6.0.0 so it would load on Panther and
Tiger. When I linked this against my Bundle it would resolve all the
external links OK against this so-called "libnetsnmp.5.dylib", not
knowing that this wasn't the actual library it is going to be using.
My Bundle now also contained information that it requires the SNMP
library with a compatibility version of 6.0.0 or greater.

Keeping my version detection in play, I could now distribute my Bundle
across Panther, Tiger and Leopard and it worked perfectly on both PPC
and Intel, and I don't need to statically link against any libraries,
or distribute a static version of the library either! Huzzah!

It's a Mickey Mouse way to do things but it works. I never like doing
version detection.

Cheers,
Dave.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Dave Geering
> From your original implementation of putting the metadata directly into the 
> PDF file, you'll now end up with obviously a proprietary file.  i.e. No 
> application that works with PDF will be able to work with that file.

That is not at all true. You can embed the data into a PDF stream but
never reference it. You'll have to check for an available stream ID
and also correct the cross reference table. You could in fact leave
the original cross reference table intact, add a new stream with your
metadata after the original %%EOF marker, construct the
cross-reference table with only one entry (the stream containing the
metadata), and adding another %%EOF marker. This is perfectly legit
PDF and in fact is the recommended way to use incremental updates as
per page 70 of the PDF reference.
___

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

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