Re: Best approach to write an uninstaller for osx

2009-11-21 Thread Parimal Das
Hi

I shifted from dmg install to packaged one for the following reasons-

My app needs to install a firefox addon to work.
This i am doing in a postinstall script in the packaged install, copying my
xpi file to firefox designated place

Now sending my app to trash will not delete that xpi, and i need to do it
from my app.

So either this can be done when my app is moved to trash. But did not find
any event for that.
Or there is a second app(uninstaller) which will delete my main app and my
firefox addon and then delete itself.

How to do this. Any insights??

Thanks
-Parimal


@Jens: That itune example is really scary man.

On Sat, Nov 21, 2009 at 12:56 PM, Jens Alfke  wrote:

>
> On Nov 20, 2009, at 11:03 PM, Parimal Das wrote:
>
> > I want to write a uninstaller for my app.
>
> Are you sure it needs one? Most Mac apps don't have or need uninstallers.
> If you want to remove an app, you just drag its icon to the Trash. (There
> might be some preference files left behind, but they're not usually big
> enough to worry about.)
>
> > What this un-installer need to do is- delete some files an the main app,
> and
> > then delete itself.
> > Steps what i found are
> > 1. Un-install app will run a shell script to delete all.
> > 2. It will use launchd to delete itself.
>
> I don't think you need anything fancy to delete yourself. In Unix it's
> legal to delete an open file; the file contents don't actually get deleted
> until the last open file handle is closed.
>
> Please be really, really careful about quoting paths in the shell script —
> the application may be installed in a location that has spaces or quotes in
> its name, so test those cases. The horrible example is an early iTunes
> installer script that would accidentally delete your home directory (or was
> it the entire disk?) if the name of the startup disk had a space in it.
>
> —Jens




-- 
--
Warm Regards,

Parimal Das
Webyog Softworks
___

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

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

2009-11-21 Thread Tharindu Madushanka
Hi

I am trying to create a table with a single cell like in Contacts
Application top one. What I want is change the cell style time to time. But
changing the style does not work even I call [tableview reloadData] it seems
like cell style is not changing

I want to switch between Default cell style and Subtitle style according to
user input in next screen.

currently I am doing something like this in tableview:
cellForRowAtIndexPath: delegate method.

UITableViewCellStyle style;
if(profile.name.length > 0) {
style = UITableViewCellStyleSubview;
} else {
style = UITableViewCellStyleDefault;
}

But it seems like detailTextLabel is not added to the cell later when I
change the profile name and reload the table view. Is there any other way to
do what I am trying to do here.

Thank you,
Tharindu
___

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

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

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

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


Re: How to change UITableView cell style dynamically

2009-11-21 Thread Tharindu Madushanka
Hi

Removing reuse identifier solved the problem so now I am creating a cell
like below. It worked.

UITableViewCellStyle style;
if(profile.name.length > 0) {
style = UITableViewCellStyleSubview;
} else {
style = UITableViewCellStyleDefault;
}

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
reuseIdentifier:nil]autorelease];

No reuse identifiers or dequeue method in table view is not used while
creating cells

Since its only once cell, doing this is ok ? is it ?

-Tharindu
___

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

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


NSDecimal chokes on very small numbers

2009-11-21 Thread Tom Bernard
Before reporting this as a bug to Apple's Bug Reporter, I would like
feedback from the community. I am working in Leopard. Has this been fixed in
Snow Leopard? Is there something else I am overlooking?

NSDecimalPower returns an unexpected result when I raise 1e-35 to the 4th
power. I understand that the result is too small to be supported by
NSDecimal. The returned result:

100\
00 and err = NSCalculationNoError

 does not make sense to me. I was expecting a return of 0 and an err =
NSCalculationLossOfPrecision.

 
To reproduce:

1) create a new Foundation Tool and implement the following code:

#import 

#define NSDStr(x) NSDecimalString(&x, nil)


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

NSCalculationErrorerr;

// NSDecimalPower bug
// pow(0.1, 4);
// result is less than minimum NSDecimal; NSDecimalPower should return 0
with err = NSCalculationLossOfPrecision
// (NSCalculationOverflow, NSCalculationUnderflow also understandable)
//
// instead returns
1000
0
// with err = NSCalculationNoError

NSDecimaloneEminusThirtyFive, oneEminusThirtyFiveToFourthPower;
NSString*oneEminusThirtyFiveStr,
*oneEminusThirtyFiveToFourthPowerStr;
NSUIntegern;

n = 4;
oneEminusThirtyFive =[[NSDecimalNumber decimalNumberWithMantissa:1
exponent:-35 isNegative:NO] decimalValue];
err =  
NSDecimalPower(&oneEminusThirtyFiveToFourthPower, &oneEminusThirtyFive, n,
NSRoundPlain);

oneEminusThirtyFiveStr =NSDStr(oneEminusThirtyFive);
oneEminusThirtyFiveToFourthPowerStr =
NSDStr(oneEminusThirtyFiveToFourthPower);

printf("oneEminusThirtyFive = %s\n",
[oneEminusThirtyFiveStr UTF8String]);
printf("oneEminusThirtyFiveToFourthPower = %s\n",
[oneEminusThirtyFiveToFourthPowerStr UTF8String]);
printf("err = %u\n",err);
printf("\n");


[pool drain];
return 0;
}


The above code outputs:

oneEminusThirtyFive = 0.001
oneEminusThirtyFiveToFourthPower =
1000
0
err = 0


Tom Bernard
tombern...@bersearch.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: extracting the mantissa for a NSDecimal

2009-11-21 Thread Tom Bernard
So to avoid the endian quagmire, I should create an NSDecimalNumber from my
NSDecimal and add that to my dictionary.

NSDecimal pi = ...  // 3.1415927...
NSDecimalNumber *piNSD = [NSDecimalNumber decimalNumberWithDecimal:pi];


I plan to write a pair of apps that saves NSDecimal values to a file and
retrieves them. I plan to test these apps on modern and legacy hardware to
verify the endian question. But for now, that is a side-track for me. Has
anyone already done such a test?

++ Tom

Tom Bernard
tombern...@bersearch.com



on 11/20/09 1:02 PM, Greg Guerin wrote:

> Message: 6
> Date: Fri, 20 Nov 2009 10:53:35 -0700
> From: Greg Guerin
> Subject: Re: extracting the mantissa for a NSDecimal
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> 
> Tom Bernard wrote:
> 
>> NSData *anNSDecimalAsData = [NSData dataWithBytes:&anNSDecimal
>> length:sizeof(NSDecimal)];
>> 
>> gives you an NSData object suitable for an NSDictionary without
>> having to
>> muck around with NSDecimal's private fields.
> 
> 
> The representation stored in the NSData may be endian-sensitive.  If
> the NSDictionary contents might cross architectures, that could be
> problematic.


on 11/20/09 1:02 PM, Jens Alfke  wrote:

> Message: 8
> Date: Fri, 20 Nov 2009 10:49:27 -0800
> From: Jens Alfke 
> Subject: Re: extracting the mantissa for a NSDecimal
> To: Greg Guerin 
> Content-Type: text/plain; charset=WINDOWS-1252; format=flowed;
> delsp=yes
> 
> 
> On Nov 20, 2009, at 9:53 AM, Greg Guerin wrote:
> 
>> The representation stored in the NSData may be endian-sensitive.  If
>> the NSDictionary contents might cross architectures, that could be
>> problematic.
> 
> s/may be/is/
> s/could be/will be/
> 
> NSDecimal is a struct containing multi-byte integers. It is definitely
> endian-sensitive.


on 11/20/09 1:02 PM, Gary L. Wade wrote:

> Message: 11
> Date: Fri, 20 Nov 2009 11:33:30 -0800
> From: "Gary L. Wade" 
> Subject: Re: extracting the mantissa for a NSDecimal
> To: Jens Alfke, Greg Guerin
> Content-Type: text/plain;charset="US-ASCII"
> 
> On 11/20/2009 10:49 AM, "Jens Alfke"  wrote:
> 
>> 
>> On Nov 20, 2009, at 9:53 AM, Greg Guerin wrote:
>> 
>>> The representation stored in the NSData may be endian-sensitive.  If
>>> the NSDictionary contents might cross architectures, that could be
>>> problematic.
>> 
>> s/may be/is/
>> s/could be/will be/
>> 
>> NSDecimal is a struct containing multi-byte integers. It is definitely
>> endian-sensitive.
>> 
> 
> I haven't been following this closely, but NSDecimalNumber both takes an
> NSDecimal and conforms to the NSCoding Protocol



on 11/20/09 10:14 AM, Roland King wrote:

> Message: 5
> Date: Fri, 20 Nov 2009 20:32:05 +0800
> From: Roland King
> Subject: Re: extracting the mantissa for a NSDecimal
> To: Tom Bernard 
> Content-Type: text/plain; charset=us-ascii
> 
> I don't know if he ever did get an answer however your method of putting it in
> an NSData is a much better idea and the original question sort of missed the
> point. 
> 
> Yes there is a constructor for NSDecimalNumber which allows you to give a
> mantissa and an exponent, but that doesn't mean the number is stored in a way
> which lets you get those out again. For instance mantissa 123 with exponent 3
> is the same number as 123000 with exponent 0. It's true that it would be
> possible for NSDecimalNumber to have an instance method which returned one
> possible combination of mantissa, exponent and sign which represented the
> number, but it doesn't, and you really shouldn't need it.
> 
> it's a little like using [ stringWithFormat:@"%...@%@" string1, string2, nil ]
> 
> to make a string and then expecting there's a method you can call later which
> gets you string1 and string2 back, but of course by then you just have the
> resulting string, you can't go backwards.
> 
> There is -(NSDecimal)decimal method which returns a structure with
> mantissa/exponent etc however the fields in that are explicitly declared to be
> private, so you really shouldn't use it.
> 
> You really need to treat it as a black box if you wish to save and restore 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: How to change UITableView cell style dynamically

2009-11-21 Thread Karolis Ramanauskas
I don't see an example of how you are creating cells in your first post. But
in case you were using the same string for the reuse identifier then when
the cell is loaded the second time it will not switch to a different style.
Because whatever cell was cashed the first time it will be reused. That's
the point. You should create two different reuse identifiers for two
different types of cells. Then in your "if" blocks you should check if the
cell is already cached for that reuse identifier, if it isn't create a new
one. It seems that you were creating a cell outside of the "if" blocks using
one identifier.

Peace,
Karolis

On Sat, Nov 21, 2009 at 3:55 AM, Tharindu Madushanka
wrote:

> Hi
>
> Removing reuse identifier solved the problem so now I am creating a cell
> like below. It worked.
>
> UITableViewCellStyle style;
> if(profile.name.length > 0) {
>style = UITableViewCellStyleSubview;
> } else {
>style = UITableViewCellStyleDefault;
> }
>
> UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
> reuseIdentifier:nil]autorelease];
>
> No reuse identifiers or dequeue method in table view is not used while
> creating cells
>
> Since its only once cell, doing this is ok ? is it ?
>
> -Tharindu
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/karolisr%40gmail.com
>
> This email sent to karol...@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: How to change UITableView cell style dynamically

2009-11-21 Thread Luke Hiesterman
If you have 2 different styles of cells then you should have 2  
different reuse identifiers. Then when you dequeue, you ask for an  
available cell of the apropeiate type.


Luke

Sent from my iPhone.

On Nov 21, 2009, at 1:55 AM, Tharindu Madushanka  
 wrote:



Hi

Removing reuse identifier solved the problem so now I am creating a  
cell

like below. It worked.

UITableViewCellStyle style;
if(profile.name.length > 0) {
   style = UITableViewCellStyleSubview;
} else {
   style = UITableViewCellStyleDefault;
}

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
reuseIdentifier:nil]autorelease];

No reuse identifiers or dequeue method in table view is not used while
creating cells

Since its only once cell, doing this is ok ? is it ?

-Tharindu
___

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

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

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

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

___

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

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

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

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


Saving data as NSData using NSUserDefaults

2009-11-21 Thread Tharindu Madushanka
Hi,

I saw a method to retreive data as NSData using NSUserDefaults class, but it
seems like there is no method to save NSData. no method like setData:
forKey:

Is it possible to save somethings as for example image as NSData in
NSUserDefaults

Thank you,
Tharindu
___

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

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

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

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


Re: How to change UITableView cell style dynamically

2009-11-21 Thread Tharindu Madushanka
mm ok I will add two types of cells. But since its only a single cell table,
I thought there would not be any performance issue or something doing that.

On Sat, Nov 21, 2009 at 8:01 PM, Luke Hiesterman  wrote:

> If you have 2 different styles of cells then you should have 2 different
> reuse identifiers. Then when you dequeue, you ask for an available cell of
> the apropeiate type.
>
> Luke
>
> Sent from my iPhone.
>
>
> On Nov 21, 2009, at 1:55 AM, Tharindu Madushanka 
> wrote:
>
>  Hi
>>
>> Removing reuse identifier solved the problem so now I am creating a cell
>> like below. It worked.
>>
>> UITableViewCellStyle style;
>> if(profile.name.length > 0) {
>>   style = UITableViewCellStyleSubview;
>> } else {
>>   style = UITableViewCellStyleDefault;
>> }
>>
>> UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
>> reuseIdentifier:nil]autorelease];
>>
>> No reuse identifiers or dequeue method in table view is not used while
>> creating cells
>>
>> Since its only once cell, doing this is ok ? is it ?
>>
>> -Tharindu
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
>>
>> This email sent to luket...@apple.com
>>
>
___

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

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

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

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


Re: Saving data as NSData using NSUserDefaults

2009-11-21 Thread Fritz Anderson
On 21 Nov 2009, at 8:32 AM, Tharindu Madushanka wrote:

> I saw a method to retreive data as NSData using NSUserDefaults class, but it
> seems like there is no method to save NSData. no method like setData:
> forKey:
> 
> Is it possible to save somethings as for example image as NSData in
> NSUserDefaults

Does setObject:forKey: not work for you?

— F

___

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

Please do not post admin requests or moderator comments to the list.
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: Saving data as NSData using NSUserDefaults

2009-11-21 Thread Tharindu Madushanka
yep got the idea now, it seems setObject: is the one to use for all the
object types. But there are multiple retrieve methods to make work easier.
Thanks :)

On Sat, Nov 21, 2009 at 8:10 PM, Fritz Anderson wrote:

> On 21 Nov 2009, at 8:32 AM, Tharindu Madushanka wrote:
>
> > I saw a method to retreive data as NSData using NSUserDefaults class, but
> it
> > seems like there is no method to save NSData. no method like setData:
> > forKey:
> >
> > Is it possible to save somethings as for example image as NSData in
> > NSUserDefaults
>
> Does setObject:forKey: not work for you?
>
>— F
>
>
___

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

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


Problems understanding CALayer geometry

2009-11-21 Thread Henri Häkkinen
Hello.

I am deriving my own custom CALayer class for my custom NSView class but there 
is something I don't quite understand about the geometry.

This is how I create the layer in awakeFromNib: of my custom NSView class:

- (void)awakeFromNib {
MyLayer *myLayer = [MyLayer layer];

self.layer = myLayer;
self.wantsLayer = YES;

myLayer.needsDisplayOnBoundsChange = YES;
myLayer.position = CGPointMake(100.0, 100.0);
myLayer.bounds = CGRectMake(0.0, 0.0, 100.0, 100.0);
}

And this is how I draw the layer in MyLayer:

- (void)drawInContext:(CGContextRef)context {
CGContextFillRect(context, [self bounds]);
}

I don't any other methods overidden by neither of the classes.

However the layer somehow automatically gets resized to fill the whole view 
(that is, the view is rendered completely in black by the CGContextFillRect 
call). How I understand this, I think it should just draw a 100x100 rectangle 
at the position (100, 100). What am I missing?

Regards,
Henri Häkkinen

___

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

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

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

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


Re: How to change UITableView cell style dynamically

2009-11-21 Thread Luke Hiesterman
I'm sure you could get away without doing that in this case because  
your table is so simple. The solution I gave you, though, will scale  
in case you ever need to do it on a bigger table.


Luke

Sent from my iPhone.

On Nov 21, 2009, at 6:38 AM, Tharindu Madushanka  
 wrote:


mm ok I will add two types of cells. But since its only a single  
cell table, I thought there would not be any performance issue or  
something doing that.


On Sat, Nov 21, 2009 at 8:01 PM, Luke Hiesterman  
 wrote:
If you have 2 different styles of cells then you should have 2  
different reuse identifiers. Then when you dequeue, you ask for an  
available cell of the apropeiate type.


Luke

Sent from my iPhone.


On Nov 21, 2009, at 1:55 AM, Tharindu Madushanka > wrote:


Hi

Removing reuse identifier solved the problem so now I am creating a  
cell

like below. It worked.

UITableViewCellStyle style;
if(profile.name.length > 0) {
  style = UITableViewCellStyleSubview;
} else {
  style = UITableViewCellStyleDefault;
}

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
reuseIdentifier:nil]autorelease];

No reuse identifiers or dequeue method in table view is not used while
creating cells

Since its only once cell, doing this is ok ? is it ?

-Tharindu
___

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

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

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

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


___

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

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

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

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


RE: NSRunloop + shared thread

2009-11-21 Thread Colin Deasy

Hey,

Thanks for the info. I'll certainly look into the CFNetwork API. I was really 
hoping for a nice solution to come about for the cocoa API's but I've since 
given up hope and started using libcurl, which is actually a really nice 
library to work with.

Thanks for all the help

> Subject: Re: NSRunloop + shared thread
> From: hank.l...@runbox.com
> Date: Fri, 20 Nov 2009 09:28:02 -0500
> CC: colde...@hotmail.com; cocoa-dev@lists.apple.com
> To: j...@mooseyard.com
> 
> On Nov 19, 2009, at 7:51 PM, Jens Alfke wrote:
> 
> > On Nov 19, 2009, at 3:40 PM, Colin Deasy wrote:
> > 
> >> This shared thread is actually handling potentially large numbers of 
> >> concurrent url connections/downloads. The reason that I want a block in 
> >> some of those at different times is a for a form of bandwidth control I am 
> >> trying to do.
> > 
> > I don't think that will do what you want. The actual socket I/O happens in 
> > a background thread owned by CFNetwork; I don't think that thread will stop 
> > reading data just because your callback on the main thread hasn't returned 
> > yet. It just means that, when you do return, you'll immediately get a 
> > bigger chunk of data.
> > 
> > I've seen this general question of rate limiting asked on the 
> > macnetworkprog list. IIRC the answer is that Foundation and CFNetwork don't 
> > really give you the tools to do it. You'd have to write your own code using 
> > low-level BSD sockets APIs. :-P
> 
> You can actually do this using CFNetwork. If you schedule your read stream on 
> a runloop and read the bytes you want in the appropriate callback (one of 
> type CFReadStreamClientCallBack) with CFReadStreamRead, you can successfully 
> control the bandwidth by limiting the number of calls to CFReadStreamRead.
> 
> Hank
> 
  
_
Windows 7: Find the right PC for you. Learn more.
http://windows.microsoft.com/shop___

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

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

2009-11-21 Thread Hank Heijink (Mailinglists)

On Nov 21, 2009, at 11:39 AM, Colin Deasy wrote:

> Hey,
> 
> Thanks for the info. I'll certainly look into the CFNetwork API. I was really 
> hoping for a nice solution to come about for the cocoa API's but I've since 
> given up hope and started using libcurl, which is actually a really nice 
> library to work with.
> 
> Thanks for all the help

CFNetwork is actually a very good library. It's not Cocoa, but don't let that 
scare you off. It works beautifully with very little code and gives you pretty 
fine-grained control over the whole process. I haven't worked with libcurl 
myself, so I don't know how they compare.

Good luck,
Hank___

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

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

2009-11-21 Thread Greg Guerin

Colin Deasy wrote:

Thanks for the info. I'll certainly look into the CFNetwork API. I  
was really hoping for a nice solution to come about for the cocoa  
API's but I've since given up hope and started using libcurl, which  
is actually a really nice library to work with.



If CocoaAsyncSocket doesn't have rate-limiting, you might add it:

http://code.google.com/p/cocoaasyncsocket/

  -- GG

___

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

Please do not post admin requests or moderator comments to the list.
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: What exactly does NSController do?

2009-11-21 Thread Quincey Morris
On Nov 20, 2009, at 14:02, Chase Meadors wrote:

> Thought I'd give the question another try. Any insight appreciated.

A while back, I wondered about the same thing, and found two things, both 
relatively minor:

1. NSObjectController responds to 'commitEditing:' by committing all the 
"editors" that are bound to it. As we've been discussing in another thread, 
it's a convenience to be able to commit pending changes in the UI just by 
sending 'commitEditing:' to a couple of NSController-subclass objects.

2. Leopard had a small bug in text field undo (well, redo, actually) that 
didn't show up if you connected the text field to a NSObjectController instead 
of directly to File's Owner. I have no idea if this is fixed in Snow Leopard.

You could also add a general:

3. Using NSObjectController makes in-NIB bindings consistent. 
NSObjectController and (say) NSArrayController have common methods (such as 
'selection') that have a trivial implementation in NSObjectController.

and a possible:

4. Using NSController options like 'Prepares content automatically' may be 
useful to avoid glue code, in relatively simple cases where the option does 
exactly 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: tableView:setObjectValue:forTableColumn:row: not called when button pressed

2009-11-21 Thread Quincey Morris
On Nov 20, 2009, at 21:15, Kyle Sluder wrote:

> On Nov 20, 2009, at 6:38 PM, "Sean McBride"  wrote:
> 
>> Quincey Morris (quinceymor...@earthlink.net) on 2009-11-20 6:34 PM said:
>> 
>>> ...the window controller could send
>>> 'commitEditing:' messages directly to text fields and other views that
>>> implement the NSEditor protocol.
>> 
>> Nope.  Despite the docs, you can't send commitEditing to a textfield.
> 
> It might be worth trying -commitEditingWithDelegate:…. Barring that, try 
> disassembling -[NSController commitEditing] to see what the heck it does. 
> Perhaps like a lot of other things it behaves specially when the text system 
> is involved.

When I wrote that about text fields, it was a bit of hand-waving, because I've 
never actually done it -- I've always used a mediating NSObjectController, via 
which text field commits work fine.

It occurs to me that perhaps the reason sending 'commitEditing:' to a text 
field doesn't work is that you need to send it to the field editor, not the 
text field itself? Or something like that.


___

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

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

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

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


Re: tableView:setObjectValue:forTableColumn:row: not called when button pressed

2009-11-21 Thread Kyle Sluder
On Sat, Nov 21, 2009 at 12:07 PM, Quincey Morris
 wrote:
> It occurs to me that perhaps the reason sending 'commitEditing:' to a text 
> field doesn't work is that you need to send it to the field editor, not the 
> text field itself? Or something like that.

That makes sense.  Strictly speaking, you need to send it to whatever
registered using -objectDidBeginEditing:.  Since none of AppKit
classes other than the controllers actually declare conformance to
NSEditor, this could theoretically be anything.  Like a private
category on NSTextView.  I'm too lazy to actually run class-dump on
NSText{,View,Field,FieldCell} to see what it could be.

I guess the moral is "don't take shortcuts."  If you want to commit
editing, send -commitEditing: to your controller.  That in turn should
just send it off to its registered editors, without concern for the
type of editor it is.

--Kyle Sluder
___

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

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

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

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


Re: Problems understanding CALayer geometry

2009-11-21 Thread Matt Neuburg
On Sat, 21 Nov 2009 17:21:55 +0200, Henri H?kkinen 
said:
>Hello.
>
>I am deriving my own custom CALayer class for my custom NSView class but there
is something I don't quite understand about the geometry.
>
>This is how I create the layer in awakeFromNib: of my custom NSView class:
>
>- (void)awakeFromNib {
> MyLayer *myLayer = [MyLayer layer];
>
> self.layer = myLayer;
> self.wantsLayer = YES;
>
> myLayer.needsDisplayOnBoundsChange = YES;
> myLayer.position = CGPointMake(100.0, 100.0);
> myLayer.bounds = CGRectMake(0.0, 0.0, 100.0, 100.0);
>}
>
>And this is how I draw the layer in MyLayer:
>
>- (void)drawInContext:(CGContextRef)context {
> CGContextFillRect(context, [self bounds]);
>}
>
>I don't any other methods overidden by neither of the classes.
>
>However the layer somehow automatically gets resized to fill the whole view
(that is, the view is rendered completely in black by the CGContextFillRect
call). How I understand this, I think it should just draw a 100x100 rectangle at
the position (100, 100). What am I missing?

A layer is not something different from a view, so much as it's an
encapsulation of the drawing done for that view.

So if you want to cover a view with a *smaller* layer, it needs to be a
sublayer of the view's layer. (Or, it could be the layer of a smaller
subview of the view.)

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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

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


NSTableView retain count problem

2009-11-21 Thread Shane
I have an NSTableView where the data source and delegate are assigned
to an NSViewController, and in this controller I have the two data
source methods.

numberOfRowsInTableView
tableView: objectValueForTableColumn row:

This project was previously done through xcode using Tiger, and I've
just now imported it in Snow Leopard. My problem is that my table view
isn't being populated. I see numberOfRowsInTableView being called, but
it's always returning 0. So I looked at 'records' and the retain count
is always 0, yet 'records' in my other method 'createDictionary' which
populates the table is always 1.

@interface DataViewController : MainViewController {
…
NSMutableArray *records;
}

- (id) init
{
records = [[NSMutableArray alloc] init];
}

- (int) createDictionary
{
[records autorelease];

// retain count for records at this point is 1.

while (…) {
[records addObject:currentLine];
}   

[myTableView reloadData];

// retain count for records at this point is 1.
// records is not populated and returns the proper count.

return [records count];
}


This method gets called before (when NSTableView is setup) and during
createDictionary (where I populate my NSTableView) and always returns
0.

- (int) numberOfRowsInTableView:(NSTableView *)tableView
{
// retain count for records at this point is always 0.
return [records count];
}


Anyone see what I'm doing wrong here, or know how I can better track this down?
___

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

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

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

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


Re: NSTableView retain count problem

2009-11-21 Thread Jens Alfke

On Nov 21, 2009, at 3:49 PM, Shane wrote:

> So I looked at 'records' and the retain count
> is always 0, yet 'records' in my other method 'createDictionary' which
> populates the table is always 1.

There's no such thing as an object with retain count 0; the object would have 
been dealloc'ed the instant its retain count dropped below 1, and after that  
any use of a pointer to it will crash. 

What you're seeing is an object pointer with a value of nil. (Messaging nil 
always returns 0 / false / nil.) So you need to look at why your instance 
variable 'count' has a nil value at that point. Try setting breakpoints.

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


Re: Best approach to write an uninstaller for osx

2009-11-21 Thread Jens Alfke

On Nov 21, 2009, at 12:21 AM, Parimal Das wrote:

> My app needs to install a firefox addon to work. 
> This i am doing in a postinstall script in the packaged install, copying my 
> xpi file to firefox designated place

I'd call that a legitimate case for an uninstaller :)

> Now sending my app to trash will not delete that xpi, and i need to do it 
> from my app.
> So either this can be done when my app is moved to trash. But did not find 
> any event for that.

No; your app's probably not even running at that point.

> Or there is a second app(uninstaller) which will delete my main app and my 
> firefox addon and then delete itself.

Sure, you can do that. As I said, there's no particular trick for deleting the 
uninstaller. The filesystem won't stop you from deleting your own binary (or 
moving it to the trash.)

I've seen uninstallers in the form of AppleScripts. They're easy to package up 
in double-clickable form and they can easily tell the Finder to move things to 
the trash.

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


Re: NSTableView retain count problem

2009-11-21 Thread Shane
> What you're seeing is an object pointer with a value of nil. (Messaging nil 
> always returns 0 / false / nil.) So you need to look at why your instance 
> variable 'count' has a nil value at that point. Try setting breakpoints.
>

I've tried setting breakpoints, but it's like two separate variables
with the name 'records' exist. 'records' always has a retain count of
1 and has all the objects stored within it that I add to it. But every
time numberOfRowsInTableView: is called, it's always 0 w/ count and 0
w/ retainCount. I don't understand it. But only inside the method
numberOfRowsInTableView is this variable zeroed. Everywhere's else
it's got the proper data I'd expect to be in this array. And the only
place it's declared is inside the header class.
___

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

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

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

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


Re: NSTableView retain count problem

2009-11-21 Thread Hank Heijink (Mailinglists)
> @interface DataViewController : MainViewController {
>   …
>   NSMutableArray *records;
> }
> 
> - (id) init
> {
>   records = [[NSMutableArray alloc] init];
> }
> 
> - (int) createDictionary
> {
>   [records autorelease];

I'm assuming you're not using GC since you're looking at retain counts. So, why 
autorelease records here? Your records variable is going to be fine for the 
duration of this method, but as soon as your application goes through its main 
run loop and pops the autorelease pool, your records variable will have been 
released. Maybe that's what you're seeing with the retain count.

>   // retain count for records at this point is 1.
> 
>   while (…) {
>   [records addObject:currentLine];
>   }   
> 
>   [myTableView reloadData];
> 
>   // retain count for records at this point is 1.
>   // records is not populated and returns the proper count.
> 
>   return [records count];
> }
> 
> 
> This method gets called before (when NSTableView is setup) and during
> createDictionary (where I populate my NSTableView) and always returns
> 0.
> 
> - (int) numberOfRowsInTableView:(NSTableView *)tableView
> {
>// retain count for records at this point is always 0.
>return [records count];
> }

By the time this method gets called, chances are that you've been through the 
run loop and your records variable is gone. If your application doesn't crash, 
that's pure luck. Try NSZombieEnabled and set a bunch of breakpoints (Google 
NSZombieEnabled to see here) to see what's going on.

Hope this helps,
Hank

___

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

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

2009-11-21 Thread Jean-Daniel Dupas

Le 21 nov. 2009 à 02:25, Philip White a écrit :

> Hello,
>  I apologize if this has been touched on already. Have others observed that 
> the function method_getNumberOfArguments counts block arguments as two 
> arguments? The corresponding method in NSMethodSignature counts them once. 
> Similarly, method_getArgumentType splits up the "@?" into "@" and "?" but 
> NSMethodSignature doesn't. This is on i386, I haven't checked on intel 64.
>  And a quick question, is "@?" used exclusively for blocks? It's not listed 
> here:

From the clang source, it look like block is the only type that uses this 
pattern. 
And from the obj runtime sources, it look like this pattern is not properly 
handled in method_getNumberOfArguments function.

You should fill a bug report.


-- 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView retain count problem

2009-11-21 Thread Jens Alfke

On Nov 21, 2009, at 5:07 PM, Shane wrote:

> I've tried setting breakpoints, but it's like two separate variables
> with the name 'records' exist.

That would be literally true, if there were two instances of your class. Try 
looking at the value of 'self' in each place.

(Again, examining an object's retainCount is almost never useful for anything. 
If you want to tell whether the pointer is pointing to an object, just look at 
it and see whether it's 0x0 or not.)

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


[iPhone] UIButton adding glow effect for a custom button with image

2009-11-21 Thread Tharindu Madushanka
Hi

I have a custom button with image as background. So when its is selected I
have to add some effect on top of it to indicate that its selected. So one
way of doing that could be to add another image for that perticular button
state.

I have tried with showsTouchWhenHighlighted property and
adjustsImageWhenHightlighted properties set to YES. Is there any way other
than going for advanced Quartz 2D programming to add some effect on top of
image ? and also without using additional image ?

Tharindu
___

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

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

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

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


Re: NSTableView retain count problem

2009-11-21 Thread Shane
> That would be literally true, if there were two instances of your class. Try 
> looking at the value of 'self' in each place.
>
> (Again, examining an object's retainCount is almost never useful for 
> anything. If you want to tell whether the pointer is pointing to an object, 
> just look at it and see whether it's 0x0 or not.)
>

Yep, thanks. The address of self within each of my methods has a
different address value. Not sure why, but, that's something to go on.
___

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

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

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

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


Re: NSTableView retain count problem

2009-11-21 Thread Mark Munz
Since records is a instance variable, you don't want to autorelease
it. You want it to stick around until the object is destroyed.

Delete the [records autorelease]; reference in createDictionary.

then add

(void) dealloc
{
 [records release];
 [super dealloc];
}


On Sat, Nov 21, 2009 at 3:49 PM, Shane
 wrote:
> I have an NSTableView where the data source and delegate are assigned
> to an NSViewController, and in this controller I have the two data
> source methods.
>
> numberOfRowsInTableView
> tableView: objectValueForTableColumn row:
>
> This project was previously done through xcode using Tiger, and I've
> just now imported it in Snow Leopard. My problem is that my table view
> isn't being populated. I see numberOfRowsInTableView being called, but
> it's always returning 0. So I looked at 'records' and the retain count
> is always 0, yet 'records' in my other method 'createDictionary' which
> populates the table is always 1.
>
> @interface DataViewController : MainViewController {
>        …
>        NSMutableArray *records;
> }
>
> - (id) init
> {
>        records = [[NSMutableArray alloc] init];
> }
>
> - (int) createDictionary
> {
>        [records autorelease];
>
>        // retain count for records at this point is 1.
>
>        while (…) {
>                [records addObject:currentLine];
>        }
>
>        [myTableView reloadData];
>
>        // retain count for records at this point is 1.
>        // records is not populated and returns the proper count.
>
>        return [records count];
> }
>
>
> This method gets called before (when NSTableView is setup) and during
> createDictionary (where I populate my NSTableView) and always returns
> 0.
>
> - (int) numberOfRowsInTableView:(NSTableView *)tableView
> {
>    // retain count for records at this point is always 0.
>    return [records count];
> }
>
>
> Anyone see what I'm doing wrong here, or know how I can better track this 
> down?
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/unmarked%40gmail.com
>
> This email sent to unmar...@gmail.com
>



-- 
Mark Munz
unmarked software
http://www.unmarked.com/
___

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

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

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

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


Re: NSTableView retain count problem

2009-11-21 Thread Shane
On Sat, Nov 21, 2009 at 11:55 PM, Mark Munz  wrote:
> Since records is a instance variable, you don't want to autorelease
> it. You want it to stick around until the object is destroyed.
>
> Delete the [records autorelease]; reference in createDictionary.
>
> then add
>
> (void) dealloc
> {
>     [records release];
>     [super dealloc];
> }
>

Yeah, I've already done that. But I'm still seeing that self has two
different addresses when I print it out in either createDictionary, or
numberOfRowsInTableView. So the problem hasn't gone away.
___

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

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


UITextField Cursor Color

2009-11-21 Thread Chunk 1978
textfields in the iPhone SDK default to a blue color.  i would like to
change this color to white.  i've checked the docs, and while the following
method would work for development with Mac OS X, it is (currently) not
present for the iPhone:

[myTextField setInsertionPointColor:[UIColor whiteColor]];

//i assume the iPhone equivalent would be the same only to replace NSColor
with UIColor.

does anyone know of a workaround?  perhaps an undocumented method?
___

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

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

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

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


Re: How to avoid the movie distortion ?

2009-11-21 Thread James
 Hi, douglas
According to your direction, the problem has been solved.
Thank you very much. Thank everyone for your help.
 James
> James,
> 
> In Interface Builder, did you check the "Preserve Aspect Ratio" checkbox for 
> your QTMovieView?
> 
> curiously,
> 
> douglas
> 

___

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

Please do not post admin requests or moderator comments to the list.
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 approach to write an uninstaller for osx

2009-11-21 Thread Parimal Das
Thanks Jens
Let me try the Applescript way.

On Sun, Nov 22, 2009 at 6:20 AM, Jens Alfke  wrote:

>
> On Nov 21, 2009, at 12:21 AM, Parimal Das wrote:
>
> > My app needs to install a firefox addon to work.
> > This i am doing in a postinstall script in the packaged install, copying
> my xpi file to firefox designated place
>
> I'd call that a legitimate case for an uninstaller :)
>
> > Now sending my app to trash will not delete that xpi, and i need to do it
> from my app.
> > So either this can be done when my app is moved to trash. But did not
> find any event for that.
>
> No; your app's probably not even running at that point.
>
> > Or there is a second app(uninstaller) which will delete my main app and
> my firefox addon and then delete itself.
>
> Sure, you can do that. As I said, there's no particular trick for deleting
> the uninstaller. The filesystem won't stop you from deleting your own binary
> (or moving it to the trash.)
>
> I've seen uninstallers in the form of AppleScripts. They're easy to package
> up in double-clickable form and they can easily tell the Finder to move
> things to the trash.
>
> —Jens




-- 
--
Warm Regards,

Parimal Das
Webyog Softworks
___

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

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

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

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


Re: NSTableView retain count problem

2009-11-21 Thread Jens Alfke

On Nov 21, 2009, at 9:08 PM, Shane wrote:

> Yep, thanks. The address of self within each of my methods has a
> different address value. Not sure why, but, that's something to go on.


When a method is called, 'self' refers to the object that received the 
message*. What you're seeing is that you unexpectedly have more than one 
instance of your class and they're being called in different places. If you 
want to figure out why this is happening, put a breakpoint in your 'init' 
method (or if your class doesn't have one, just add an empty one that returns 
[super init].) You'll find it's called multiple times, creating multiple 
objects, and from looking at the stack you should be able to figure out why.

—Jens

* You may know it by the name 'this', from languages like C++, Java or 
PHP.___

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

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

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

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