Re: Decode a base64 image for iphone

2009-03-30 Thread Nick Zitzmann


On Mar 29, 2009, at 11:28 PM, developers mac wrote:


I am getting an image of base64 type encoded one. I have to
decode it. Can some one suggest me on this. I am new to this  
concept. Any

help would be greatly appreciated.



http://www.lmgtfy.com/?q=cocoa+base64+decode

Nick Zitzmann
http://www.chronosnet.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


NSDates and natural language ...

2009-03-30 Thread Mic Pringle
Hi,

Is anyone aware of any frameworks/classes that have been released that
allow you to return natural language from a date ?

What I mean by this is if, for example, I pass todays date it would
return 'Today', yesterdays date would return 'Yesterday',  25th March
08 would return 'Last week' etc

I know I can work this out manually using NSTimeInterval, some
calculations and plenty of if statements but I was hoping there was
already something out there.

Thanks,

-Mic
___

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

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


Small white border around custom cell in NSTableView ...

2009-03-30 Thread Mic Pringle
Hi,

Whenever I use a custom cell within an NSTableView, and color the
background different to the tables, there is a small white border (or
whatever I set the background color of the table to be) around the
cell, probably around 4px in height/width.

Is there a way to remove this 'padding' so that the bottom of the
previous row cell lines up exactly with the top of the current row
cell ?

Thanks,

-Mic
___

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

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


Delayed Undo Problem

2009-03-30 Thread Richard Somers
I have a basic core data document based application (Hillegass 3rd  
Edition, Chapter 11, CarLot). With a single primary window every thing  
works. Then a second window is added with a generic master detail  
interface using the core data entity from the Interface Builder pallet.


When making a change to the model in the second window, undo/redo in  
the main menu is not available until the primary window is clicked and  
brought to the front.


I need the undo/redo menu to work regardless of which window is  
frontmost. Any thoughts as to how this can be done?


Richard

___

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

Please do not post admin requests or moderator comments to the list.
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: Small white border around custom cell in NSTableView ...

2009-03-30 Thread Mic Pringle
Hi Dave,

I didn't notice that in the documentation ... but must admit with
hindsight that I've spent more time looking in NSCell's documentations
when I should have been looking at NSTableViews.

Just checked in the online docs and this looks exactly what I'm after,
thank you.

Cheers,

-Mic

2009/3/30 Dave Keck d...@docdave.com:
 Have you looked at setIntercellSpacing: ?

 Hi,

 Whenever I use a custom cell within an NSTableView, and color the
 background different to the tables, there is a small white border (or
 whatever I set the background color of the table to be) around the
 cell, probably around 4px in height/width.

 Is there a way to remove this 'padding' so that the bottom of the
 previous row cell lines up exactly with the top of the current row
 cell ?

 Thanks,

 -Mic

___

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

Please do not post admin requests or moderator comments to the list.
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: Small white border around custom cell in NSTableView ...

2009-03-30 Thread I. Savant
On Mon, Mar 30, 2009 at 8:29 AM, Mic Pringle micprin...@gmail.com wrote:

 Is there a way to remove this 'padding' so that the bottom of the
 previous row cell lines up exactly with the top of the current row
 cell ?

  Have you tried looking at NSTableView's documentation? There's a way
to set -intercellSpacing if that's really what you want to do.

--
I.S.
___

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

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

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

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


Re: NSDates and natural language ...

2009-03-30 Thread Laurent Demaret
Hello,


Mic Pringle micprin...@gmail.com wrote:

 any frameworks/classes that have been released that
 allow you to return natural language from a date ?
NSDateFormatter ?

My firs answer on this list, l hope it's a good one...
___

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

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

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

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


MySQL-Cocoa database access

2009-03-30 Thread spartan g
Hi Friends,

I am communicating with the MySQL database through the SMySQL framework.
I can open the database connection successfully.
I can select the database too.

When I send a query to read the max count in the primary key i get the value
in return for the first time.
Then I insert the new record in the database with the next count.
I perform the above 2 tasks in the loop.

In the second iteration itself my select query fails.

Can anyone suggest why does this happen?

I tried reconnecting the database in the loop. Also tried to add sleep for 1
second, but it's not worth for updating thousands of records.

Please suggest some solution.
Is anyone know the other framework which i can use for mysql-cocoa
connection?

Best Regards,
Sparta...
___

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

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

2009-03-30 Thread Mic Pringle
Hi Laurent,

I don't think I can achieve what I'm looking for with NSDateFormatter
unless I subclass it and implement my own mehtods, which is what I'm
looking to avoid if there's already an existing project out there.

Thanks for your response though.

-Mic

2009/3/30 Laurent Demaret l...@ideaslb.net:
 Hello,


 Mic Pringle micprin...@gmail.com wrote:

 any frameworks/classes that have been released that
 allow you to return natural language from a date ?
 NSDateFormatter ?

 My firs answer on this list, l hope it's a good one...

___

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

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

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

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


Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value

2009-03-30 Thread Benjamin Stiglitz
 I'm running the code below. I have a single NSWindow with a checkbox and 
 a button. In the awakeFromNib method of the main controller, I change the 
 attribute of the checkbox string. In the compute: method, I compute the 
 height requested to display a string for a specific font and maximum 
 width.

 If I run this code as is, I get 17.0 as the required height. That's  
 incorrect.

 If I comment the awakeFromNib code, I get 34.0f as the required height. 
 That's correct.

Is this the code exactly as it is in the app? e.g. compute: doesn't
depend in any way on the values you set in -awakeFromNib? (I think this
is your complaint, but I'm just verifying.)

Not that this fixes your problem, but
-[NSAttributedString boundingRectWithSize:options:] would probably be a
bit easier for you to use.

-Ben
___

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

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

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

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


Re: ack no class

2009-03-30 Thread Steve Christensen
Maybe start up that generated app in gdb with a breakpoint set on  
NSLog? When it breaks you could look at the backtrace. That may at  
least tell you where the message is being generated, which may then  
tell you why.



On Mar 29, 2009, at 3:26 PM, Mark Sibly wrote:


I'm the author of BlitzMax, a multi-platform 'basic like' compiler.

I've recently had a few reports that apps generated by the Mac version
are producing a mysterious ack no class error when they start up -
similar to this:

 2009-03-24 22:26:14.460 test[10329:717] ack no class

This appears to be written to 'stderr' and is occuring somewhere
between [NSApp run] and the [applicationDidFinishLaunching] method in
the app delegate - ie: it appears to be somewhere inside OsX/Cocoa.

I have been unable to reproduce this myself, but it's occurring on at
least one other machine with an identical config to mine - an Intel
Mac with OS X 10.5.6.

Has anyone else encountered this?

From the few similar cases I've found via google, Safari beta4 has
been suggested as a cause but I have that installed and am not getting
this error.

It's not really a biggy, as it doesn't seem to affect the app in any
way, it's just pretty ugly for users of an apparently 'basic like'
language.


___

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

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

2009-03-30 Thread Keary Suska


On Mar 30, 2009, at 5:55 AM, Richard Somers wrote:

I have a basic core data document based application (Hillegass 3rd  
Edition, Chapter 11, CarLot). With a single primary window every  
thing works. Then a second window is added with a generic master  
detail interface using the core data entity from the Interface  
Builder pallet.


When making a change to the model in the second window, undo/redo in  
the main menu is not available until the primary window is clicked  
and brought to the front.


I need the undo/redo menu to work regardless of which window is  
frontmost. Any thoughts as to how this can be done?



This FAQ might help:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFAQ.html#/ 
/apple_ref/doc/uid/TP40001802-244036


Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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

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

2009-03-30 Thread Michael Ash
On Mon, Mar 30, 2009 at 1:06 AM, Luke the Hiesterman luket...@apple.com wrote:
 Up to this point, I've thought of properties as syntactic sugar for method
 calls. That is myObject.size should compile the same as [myObject size]
 unless of course a custom getter is set in the property declaration, then it
 would compile the same as if I had called that getter. What makes me
 question this is that there's apparently a need for dealing with properties
 at the runtime level, as discussed in
 http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html

 I can't think of anything about properties that needs to be dealt with at
 runtime. My understanding has it that all information necessary for what
 properties do is available at compile time. E.g. the method to call, return
 types, how to compile synthesized properties using copy, retain, assign,
 nonatomic, and also whether to throw an error if something is readonly. So,
 then, my question is, what about using properties requires a runtime
 component? To me it feels like everything could be handled by the compiler.

I think what you're missing is that the runtime has a lot of
information available through APIs that aren't strictly necessary at
runtime. For example, you can get a list of method names and
argument/return types, or a list of ivar names and types, even though
none of this stuff is needed to send a message or access an ivar.

This sort of metadata is provided just for the benefit of other code.
For example, the method/ivar information is used by Cocoa to implement
things like key/value coding. You can use it yourself for your own
purposes. As far as I know, Cocoa doesn't use the property info for
anything at the moment, but it's there just so that you can use it if
you have a use for it.

And one last note: don't mix up the dot syntax with properties. The
API whose documentation you've linked to is about @property stuff. The
dot syntax is just a funny way to message getters and setters. Other
than the fact that the dot syntax is commonly used with getters and
setters declared with @property, they are completely unrelated.

Mike
___

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

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

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

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


Best Strategy to Control iTunes

2009-03-30 Thread Ammar Ibrahim
I'm currently developing an App in iTunes, and I'm new to Cocoa and the
entire Mac development world. So far, things are looking great. I have few
questions, about which is the best strategy to follow in order to accomplish
some tasks. This is a special purpose app, in a controlled environment.

* Open iTunes if it's not already open.
  - Is using NSWorkSpace the best way to launch iTunes? Or should I use
a different method? What ar the side effects if the application was already
running?
  - How can I detect if iTunes is not responding? I'd like to force quit
it, and open it again
  - In a nutshell, I'd like iTunes to be open all times, and responsive,
how can I guarentee this?

* Communcation with iTunes
  - What's the best interface to use? Running Apple Script through osa
(by shell invocation) inside my app? AppleScript-Cocoa bridge? Any other
methods?
  - It's known that if any dialog is open in iTunes it freezes any
communication through the scriptable interface, how can I detect that and
put all my messages in a queue, so that when iTunes is responsive, I can
send my messages?


Thanks in advance,
Ammar
___

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

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

2009-03-30 Thread Luca C.
Hi Ammar,

2009/3/30 Ammar Ibrahim ammar.ibra...@gmail.com

 I'm currently developing an App in iTunes, and I'm new to Cocoa and the
 entire Mac development world. So far, things are looking great. I have few
 questions, about which is the best strategy to follow in order to
 accomplish
 some tasks. This is a special purpose app, in a controlled environment.

 * Open iTunes if it's not already open.
  - Is using NSWorkSpace the best way to launch iTunes? Or should I use
 a different method? What ar the side effects if the application was already
 running?


Using NSWorkspace's -launchApplication: is fine.  If the app was already
running when you called it, the method won't do anything, as you can read
from the documentation.



  - How can I detect if iTunes is not responding? I'd like to force quit
 it, and open it again


I'm not sure you can actually do that.



  - In a nutshell, I'd like iTunes to be open all times, and responsive,
 how can I guarentee this?


Just praying. :-)
Apple should care about that, not you.




 * Communcation with iTunes
  - What's the best interface to use?



There are many approaches but if you don't tell us what are your purposes we
can't tell you wich approach is the best for your use.  However, i suggest
googling for ScriptingBridge.




  - It's known that if any dialog is open in iTunes it freezes any
 communication through the scriptable interface, how can I detect that and
 put all my messages in a queue, so that when iTunes is responsive, I can
 send my messages?


What kind of task are you trying to accomplish?  Are you sure you have to
know whether a dialog is open in iTunes?  AFAIK you can't do anything
similar, in any application.





 Thanks in advance,
 Ammar
 ___

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

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

 Help/Unsubscribe/Update your Subscription:

 http://lists.apple.com/mailman/options/cocoa-dev/luca.pazzerello%40gmail.com

 This email sent to luca.pazzere...@gmail.com




-- 
--Luca C.
___

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

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

2009-03-30 Thread Greg Parker

On Mar 29, 2009, at 3:26 PM, Mark Sibly wrote:

I've recently had a few reports that apps generated by the Mac version
are producing a mysterious ack no class error when they start up -
similar to this:

 2009-03-24 22:26:14.460 test[10329:717] ack no class

This appears to be written to 'stderr' and is occuring somewhere
between [NSApp run] and the [applicationDidFinishLaunching] method in
the app delegate - ie: it appears to be somewhere inside OsX/Cocoa.

I have been unable to reproduce this myself, but it's occurring on at
least one other machine with an identical config to mine - an Intel
Mac with OS X 10.5.6.

Has anyone else encountered this?




From the few similar cases I've found via google, Safari beta4 has
been suggested as a cause but I have that installed and am not getting
this error.


This isn't obviously coming from Apple's code. I'm guessing it's  
printed by some plugin or haxie or something. Perhaps it's a web  
browser extension or add-on that is confused by changes in Safari 4.


Compare the installed software on your machine and the reproducible  
case you found. You can use `info shared` in gdb or the Xcode debugger  
console to print the libraries loaded in the process; if this is the  
fault of a plugin then you'll see it on their machine but not yours.


The breakpoint on NSLog suggestion also might help; that message is  
formatted like NSLog output.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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


NSTableColumn's sort key in Interface Builder

2009-03-30 Thread Mike Manzano

Hello,

I have a table view whose delegate's - 
tableView:objectValueForTableColumn:row: returns an NSDictionary with  
key value pairs that look like this for each of its columns (the  
columns' cells are responsible for extracting some subset of this  
dictionary to display to the user):


{
xkDateModified = 2008-01-15 23:03:00 -0800;
xkDisplayStatus = Awaiting Pickup;
xkFileName = stuff.graffle;
xkOwnerID = l...@testtest.com;
}

I'd like to make the File Name columns sortable, so I've set up the  
file name column's sort key to be xkFileName and the selector to be  
compare:. The sorting triangle appears in the header, but the column  
isn't being sorted.


I have verified using an NSLog() inside of - 
tableView:objectForTableColumn:row: that [resultObjectValue  
valueForKeyPath:@xkFileName] returns the proper file names.


What am I doing wrong?

Mike
___

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

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

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

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


Re: [BUG?] - [NSLayoutManager usedRectForTextContainer:] returns incorrect value

2009-03-30 Thread Iceberg-Dev


On Mar 30, 2009, at 3:55 PM, Benjamin Stiglitz wrote:

I'm running the code below. I have a single NSWindow with a  
checkbox and
a button. In the awakeFromNib method of the main controller, I  
change the
attribute of the checkbox string. In the compute: method, I  
compute the

height requested to display a string for a specific font and maximum
width.

If I run this code as is, I get 17.0 as the required height. That's
incorrect.

If I comment the awakeFromNib code, I get 34.0f as the required  
height.

That's correct.


Is this the code exactly as it is in the app? e.g. compute: doesn't
depend in any way on the values you set in -awakeFromNib? (I think  
this

is your complaint, but I'm just verifying.)


Yes.

Not that this fixes your problem, but -[NSAttributedString  
boundingRectWithSize:options:] would probably be a

bit easier for you to use.


I tried it. It apparently does not work for multi-line text.


I should probably add that additional tests show that the bug appears  
in Mac OS X 10.4.11 but not in Mac OS X 10.5.6.


I also thought of a ugly workaround (strike the text with a bezier  
path instead of relying on the Cocoa Text Engine) but if there is a  
better solution, I'm still interested.



___

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

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


Why does -[NSURLConnection start] crash?

2009-03-30 Thread Jeff Johnson

Here's the sample code:

http://lapcatsoftware.com/downloads/ConnectionStartCrash.m

It crashes when calling this:

_connection = [[NSURLConnection alloc] initWithRequest:request  
delegate:self startImmediately:NO];

[_connection start];

but not this:

_connection = [[NSURLConnection alloc] initWithRequest:request  
delegate:self startImmediately:YES];


Of course, you wouldn't normally want to call [_connection start]  
immediately; in my tool, I was using performSelector:afterDelay: to  
call it, and the crash still occurs.


Here's the backtrace:

#0  0x97092152 in CFSetApplyFunction ()
#1  0x95b0cdad in CFNSchedulingSetScheduleSource ()
#2  0x95b375bb in RunLoopMultiplexer::sourceForScheduling ()
#3  0x95b3769a in RunLoopMultiplexer::schedule ()
#4  0x95b88d96 in URLConnectionClient::start ()
#5  0x1bd9 in -[MyConnectionDelegate connectWithCrash:]  
(self=0x103330, _cmd=0x1f5c, shouldCrash=1 '\001') at /Users/jeff/ 
Documents/Programming/TestProjects/ConnectionStartCrash/ 
ConnectionStartCrash.m:24
#6  0x1d38 in main (argc=1, argv=0xb694) at /Users/jeff/ 
Documents/Programming/TestProjects/ConnectionStartCrash/ 
ConnectionStartCrash.m:50


The argument for cachePolicy: doesn't seem to matter, by the way.

Am I missing something? Is there some run loop setup I need to perform?

-Jeff

___

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

Please do not post admin requests or moderator comments to the list.
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: NSTableColumn's sort key in Interface Builder

2009-03-30 Thread Corbin Dunn


On Mar 30, 2009, at 12:16 PM, Mike Manzano wrote:


Hello,

I have a table view whose delegate's - 
tableView:objectValueForTableColumn:row: returns an NSDictionary  
with key value pairs that look like this for each of its columns  
(the columns' cells are responsible for extracting some subset of  
this dictionary to display to the user):


{
   xkDateModified = 2008-01-15 23:03:00 -0800;
   xkDisplayStatus = Awaiting Pickup;
   xkFileName = stuff.graffle;
   xkOwnerID = l...@testtest.com;
}

I'd like to make the File Name columns sortable, so I've set up  
the file name column's sort key to be xkFileName and the selector to  
be compare:. The sorting triangle appears in the header, but the  
column isn't being sorted.


I have verified using an NSLog() inside of - 
tableView:objectForTableColumn:row: that [resultObjectValue  
valueForKeyPath:@xkFileName] returns the proper file names.


What am I doing wrong?


Nothing! You have to just sort your model array in the controller  
yourself in:


- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange: 
(NSArray *)oldDescriptors AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;


corbin


___

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

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


Referencing a controller from one NIB to another ?

2009-03-30 Thread Guillaume Laurent
Following up on my question about putting several windows in a single  
NIB, as it seems it's a bad idea, I'm now confronted to binding  
controllers from one NIB to another.


To give a quick example, take the TwoManyControllers sample :

http://developer.apple.com/SampleCode/TwoManyControllers/index.html

A main NSArrayController holds the list of top level elements to  
display them in an NSTable, each of those elements is itself an array,  
to which a secondary NSArrayController is bound.


Problem, how do you do that when the first NSArrayController is in the  
main NIB, and the secondary one in the other ?


I was looking for a way to define the first NSArrayController in both  
NIBs, except that in the 2nd NIB it would reference the one in the  
first, rather than being instantiated on its own, but I don't see how  
that's doable.


Any ideas ?

--
Guillaume
http://telegraph-road.org





___

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

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

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

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


Re: Best Strategy to Control iTunes

2009-03-30 Thread Mark Suman
For issue 1: I use NSWorkspace to handle this.  Someone more knowledgeable
than me might be able to answer your more detailed questions.  When I launch
my app, I check the sharedWorkspace to see if com.apple.iTunes is already
running.  If not, I launch it.
For issue 2: There is a nifty framework for communicating with iTunes.  It's
called EyeTunes and has made my life much easier when working with iTunes.
 Just search for EyeTunes in Google and it should be the first hit.

Mark

On Mon, Mar 30, 2009 at 10:03 AM, Ammar Ibrahim ammar.ibra...@gmail.comwrote:

 I'm currently developing an App in iTunes, and I'm new to Cocoa and the
 entire Mac development world. So far, things are looking great. I have few
 questions, about which is the best strategy to follow in order to
 accomplish
 some tasks. This is a special purpose app, in a controlled environment.

 * Open iTunes if it's not already open.
  - Is using NSWorkSpace the best way to launch iTunes? Or should I use
 a different method? What ar the side effects if the application was already
 running?
  - How can I detect if iTunes is not responding? I'd like to force quit
 it, and open it again
  - In a nutshell, I'd like iTunes to be open all times, and responsive,
 how can I guarentee this?

 * Communcation with iTunes
  - What's the best interface to use? Running Apple Script through osa
 (by shell invocation) inside my app? AppleScript-Cocoa bridge? Any other
 methods?
  - It's known that if any dialog is open in iTunes it freezes any
 communication through the scriptable interface, how can I detect that and
 put all my messages in a queue, so that when iTunes is responsive, I can
 send my messages?


 Thanks in advance,
 Ammar
 ___

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

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

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

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


opening a file

2009-03-30 Thread James Gifford
Hello! I am trying to open i file (the license for my app) when the 
user clicks on a menu item. i gave applescript a try but it did not 
work. any ideas?

the website for the application is below.
-James Gifford
The Downloadermac Project: http://code.google.com/p/downloadermac
Google Group: http://groups.google.com/group/downloadermac_googlecode
E-Mail: skunkmeado...@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


Launching a preference pane from inside a Cocoa app

2009-03-30 Thread Mark Suman
I'm looking to map the Preferences... menu item to a system preference
pane I created rather than the built-in application preferences.  I know I
can use AppleScript to launch my prefPane, but am wondering if there is a
better, Cocoa way of doing it.
Does anyone know the Apple way of launching a prefPane from a Cocoa app?

Mark
___

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

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

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

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


Adding UTI to document type causes NSDocumentController Misbehavior

2009-03-30 Thread Jerry Krinock
The other day I was writing an AppleScript and noticed that  
AppleScript's 'choose file' command has a parameter 'of type' which  
requires a UTI.  Since I'd like to be able to use this parameter in  
AppleScripts that choose my app's documents, I read up on UTI [1].  It  
all seems very simple, including the fact that if a suitable UTI does  
not exist, you can create your own.


Since my document type is proprietary, I opened the editor on my  
project's app target and, in the Properties tab, in the line for my  
app's single document type, I saw that the UTI was blank.  So I  
changed it to com.MyCompanyBlah.Blah.


The results of this:

1.  In my app's Info.plist, in the CFBundleDocumentTypes, in the  
single array for my single document type, there was added a key  
LSItemContentTypes, an array containing a single string,  
com.MyCompanyBlah.Blah.  Per documentation, this is expected.


2.  Before adding the UTI, -[NSDocumentController defaultType]  
returned the Name of my single document type.  After, it returns its  
UTI.  This is odd -- seems like we've got some wires crossed here.   
Indeed...


3.  During running of -[NSDocumentController  
openUntitledDocumentAndDisplay:error], for example, to create a new  
document, it raises an exception:

 *** -[NSPathStore2 stringByAppendingPathExtension:]: nil argument

Remove the UTI from the Target's Properties and now new documents can  
now be created again.


Why the strange reactions from NSDocumentController?  Is this one of  
those situations where I need to kick Launch Services in the pants or  
something like that?


Sincerely,

Jerry Krinock


[1] http://developer.apple.com/macosx/uniformtypeidentifiers.html
___

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

Please do not post admin requests or moderator comments to the list.
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: Launching a preference pane from inside a Cocoa app

2009-03-30 Thread Nick Zitzmann


On Mar 30, 2009, at 11:17 AM, Mark Suman wrote:

Does anyone know the Apple way of launching a prefPane from a  
Cocoa app?



Yes. (If you were wondering _how_ to do it, then all you need to do is  
open the preference pane using NSWorkspace or Launch Services. System  
Preferences will then display the pane.)


Nick Zitzmann
http://www.chronosnet.com/



___

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

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

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

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


[SOLVED] Re: NSTableColumn's sort key in Interface Builder

2009-03-30 Thread Mike Manzano

Doh!

On Mar 30, 2009, at 1:00 PM, Corbin Dunn wrote:



On Mar 30, 2009, at 12:16 PM, Mike Manzano wrote:


Hello,

I have a table view whose delegate's - 
tableView:objectValueForTableColumn:row: returns an NSDictionary  
with key value pairs that look like this for each of its columns  
(the columns' cells are responsible for extracting some subset of  
this dictionary to display to the user):


{
  xkDateModified = 2008-01-15 23:03:00 -0800;
  xkDisplayStatus = Awaiting Pickup;
  xkFileName = stuff.graffle;
  xkOwnerID = l...@testtest.com;
}

I'd like to make the File Name columns sortable, so I've set up  
the file name column's sort key to be xkFileName and the selector  
to be compare:. The sorting triangle appears in the header, but the  
column isn't being sorted.


I have verified using an NSLog() inside of - 
tableView:objectForTableColumn:row: that [resultObjectValue  
valueForKeyPath:@xkFileName] returns the proper file names.


What am I doing wrong?


Nothing! You have to just sort your model array in the controller  
yourself in:


- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange: 
(NSArray *)oldDescriptors AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;


corbin




___

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

Please do not post admin requests or moderator comments to the list.
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: Processing data maintained with Core Data

2009-03-30 Thread Peter Castine

Thanks to all for your suggestions.

On 27-Mar-2009, at 18:09, Quincey Morris wrote:
the key question seems to be: what is the thread safety model of  
your existing code? Generating audio from parameters and file lists  
held by a different thread seems disaster-prone, so presumably your  
code doesn't do that, but you also suggest you currently don't have  
2 copies of the data, so maybe your code *does* do that.


My code currently doesn't *do* anything. Not on Mac OS. Not yet.

I suppose one could argue that other implementations have two copies  
of the UI data--one maintained by the UI, with the audio thread  
retrieving the data it needs at the beginning of its processing loop  
(ie, a second copy). It's just the second copy isn't 'maintained' per  
se... it's re-read each time through the audio processing loop.


Based on the information you've provided so far, I'd suggest you  
snapshot your data model (into a C struct) and pass it off to your  
background processing thread, where is can be used by your nice,  
tested C code.


This may be the direction I'll take.

Just noticed this list replies to sender, not to the list. Duly  
noted. 

One (hopefully) last thing…

On 28-Mar-2009, at 7:04, Ben Trumbull wrote:
Given your existing code base, and RT constraints, I would suggest  
you consider pushing changes over to the RT thread in batches.   
Basically, update the configuration the RT thread is using in  
response to the NSManagedObjectContextDidSaveNotification.


It's sinking in that this might be an even better approach. Is there  
any sample code available demonstrating this technique?


-- P.

___

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

Please do not post admin requests or moderator comments to the list.
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 can I draw an election map?

2009-03-30 Thread Tobias Zimmerman
I am starting a new project that involves simulating various US election
results.  I want to plot the results using an election map similar to the
ones that were all over the web during last year¹s election.  However, I
would like to do this in Cocoa/Objective-C rather than having to learn
Python or Java.

I am looking for advice on how to get started, since I have done only very
rudimentary graphics stuff up to now.  Basically there are two pieces of the
puzzle: (1) how to get the blank map into my program, and (2) how to
dynamically fill the complex shapes that constitute the map.  I have blank
maps I can use, and I suppose I could convert them into pretty much any
graphics format (I am thinking EPS is probably best).  Once I have the map
in place I need to do the equivalent of a ³fill² command in the various
places to put the right color in the right state outline.

At this stage, I don¹t even know what classes I should be researching
(NSBezier path? CALayer?), so any advice, no matter how general would be
really welcome.
___

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

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

2009-03-30 Thread Ammar Ibrahim

  * Communcation with iTunes
   - What's the best interface to use?



 There are many approaches but if you don't tell us what are your purposes
 we
 can't tell you wich approach is the best for your use.  However, i suggest
 googling for ScriptingBridge.


My application will be adding/removing tracks to iTunes. I will not be
controlling playback or anything like that, it's mainly to manipulate the
database and playlists.





 
   - It's known that if any dialog is open in iTunes it freezes any
  communication through the scriptable interface, how can I detect that and
  put all my messages in a queue, so that when iTunes is responsive, I
 can
  send my messages?


 What kind of task are you trying to accomplish?  Are you sure you have to
 know whether a dialog is open in iTunes?  AFAIK you can't do anything
 similar, in any application.


If I want to add a track to iTunes, I need to make sure iTunes is
responsive.
___

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

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


[MEET] April CocoaHeads Mac Developer Meetings

2009-03-30 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are  
free and open to the public. We specialize in Cocoa, but everything  
Mac programming related is welcome.


Upcoming meetings:
Canada
Halifax- Thursday, April 9, 2009 18:00.
Toronto- Tuesday, April 14, 2009 18:30.

Germany
Berlin- Thursday, April 9, 2009 19:00.
Bonn- Thursday, April 16, 2009 19:00.
Munich- Thursday, April 9, 2009 20:00.

Mexico
Mexico City- Thursday, April 16, 2009 17:00.

South Africa
Johannesburg- Thursday, April 2, 2009 18:30.

Spain
Barcelona- Friday, April 24, 2009 16:30.

Sweden
Stockholm- Monday, April 6, 2009 18:45.

United States
Atlanta- Thursday, April 9, 2009 19:00.
Boston- Thursday, February 12, 2009 19:00.
Boulder- Tuesday, April 14, 2009 07:00.
Colorado Springs- Thursday, April 9, 2009 19:00.
Des Monies- Thursday, April 9, 2009 19:00.
Fayetteville- Thursday, April 9, 2009 19:00.
Lake Forest- Wednesday, April 8, 2009 19:00.
Nashville- Thursday, April 16, 2009 19:00.
Philadelphia- Thursday, April 9, 2009 19:00.
Pittsburgh- Thursday, April 9, 2009 19:30.
St. Louis- Saturday, April 25, 2009 14:00.

United Kingdom
Swindon- Monday, April 6, 2009 20:00.


Some chapters may have yet to post their meeting for next month.  
Meeting times may change. Locations and more information here:

http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads
___

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

Please do not post admin requests or moderator comments to the list.
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: (un)mounting volumes

2009-03-30 Thread Greg Guerin

Torsten Curdt wrote:


How do I list all mounted volumes (and their mount points)?


apropos mount

man 3 getmntinfo

man 2 getfsstat

  -- 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: (un)mounting volumes

2009-03-30 Thread Ken Thomases

On Mar 30, 2009, at 6:08 PM, Torsten Curdt wrote:


How do I list all mounted volumes (and their mount points)?


Well, since you're poking around in the File Manager, take a look at  
FSGetVolumeInfo.


However, since this is cocoa-dev, I will also direct you to the - 
mountedLocalVolumePaths and -mountedRemovableMedia methods of  
NSWorkspace.  I'll also point out the existence of the - 
unmountAndEjectDeviceAtPath: method.


Cheers,
Ken

___

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

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

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

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


EXC_BAD_ACCESS and NSAttributedString driving me crazy

2009-03-30 Thread Chris Idou
I'm getting NSRTFDPboardType and NSRTFPboardType objects as NSData from the 
pasteboard and I'm storing them in a core data XML repository and getting them 
out again, and when necessary I'm converting them into NSAttributedString with 
initWithRTF or initWithRTFD. This mostly works but every now and then, actually 
quite often, this initWithRTF(D) crashes with EXC_BAD_ACCESS. (stack traces 
below).

The thing is, I'm doing an md5Hash on the NSData objects every single time I 
store them and retrieve them just to make sure they are not corrupted, and the 
exact same NSData that is working one minute as an argument to initWithRTF(D), 
makes it crash later on.

I'm using garbage collection, but I've solved a lot of GC problems and this 
doesn't seem similar.

Has anyone got any thoughts?




#00x95a82688 in objc_msgSend
#10x933b0b26 in -[NSCFDictionary setObject:forKey:]
#20x90824684 in -[NSRTFD setObject:forKey:]
#30x908f3c2f in -[NSAKDeserializer deserializePList:]
#40x908f3961 in -[NSDocumentDeserializer deserializeNewPList]
#50x908f3753 in -[NSRTFD(NSSerializationSupport) 
initWithPasteboardDataRepresentation:]
#60x908f2fe9 in -[NSFileWrapper initWithSerializedRepresentation:]
#70x908f2e32 in -[NSRTFReader initWithRTFD:]
#80x9070b9a7 in _NSReadAttributedStringFromURLOrData
#90x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithData:options:documentAttributes:error:]
#100x908f2de2 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithRTFD:documentAttributes:]
..

#00x95a82688 in objc_msgSend
#10x90894910 in processColor
#20x9089395b in CharAttr
#30x9088db34 in -[NSRTFReader attributedString]
#40x9070bc03 in _NSReadAttributedStringFromURLOrData
#50x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithData:options:documentAttributes:error:]
#60x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithRTF:documentAttributes:]
.


Program received signal:  “EXC_BAD_ACCESS”.



  Enjoy a better web experience. Upgrade to the new Internet Explorer 8 
optimised for Yahoo!7. Get it now.
___

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

Please do not post admin requests or moderator comments to the list.
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 can I draw an election map?

2009-03-30 Thread Michael Hall


On Mar 30, 2009, at 5:07 PM, Tobias Zimmerman wrote:

I am starting a new project that involves simulating various US  
election
results.  I want to plot the results using an election map similar  
to the
ones that were all over the web during last year’s election.   
However, I

would like to do this in Cocoa/Objective-C rather than having to learn
Python or Java.


I did something, java sorry, based on...
http://www.cs.princeton.edu/introcs/35purple/

which for the mapping uses...

Data sources. We collect state and county border data from the US  
Census TIGER database. [ documentation ] The file USA.txt contains  
each state (in the Continental US) and its corresponding polygon 
(s). There are 104 polygons in total. The files NJ.txt contain each  
county in the given state. There are 3325 polygons in total over  
all states.


If you look at the java you can see how it's routines for drawing and  
filling, etc. the polygons work.
It was a little buggy in translating mouse position to map  
coordinates as I remember. Which I wanted for displaying little  
tooltip type popup windows when you did mouse over states or  
counties. For one thing to display the state or county name which it  
had no provision for and I didn't try to add. You probably would have  
to rework that if you went with ObjC anyhow.


I still haven't finished to final result version of mine but the  
shareware version for the 2008 presidential elections is at...

http://www195.pair.com/mik3hall/

It didn't exactly make me wealthy and I was a little disappointed in  
not even getting much feedback. But it had some downloads and I'd  
still like to find the time to come up with a final 2008 version and  
maybe add some other political content of some sort. Something with  
information on what's up in Washington that would allow for some  
degree of user interaction to make users views and opinions part of  
the software somehow.


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Why does -[NSURLConnection start] crash?

2009-03-30 Thread Peter N Lewis

On 31/03/2009, at 3:32 , Jeff Johnson wrote:

Here's the sample code:

http://lapcatsoftware.com/downloads/ConnectionStartCrash.m

It crashes when calling this:

_connection = [[NSURLConnection alloc] initWithRequest:request  
delegate:self startImmediately:NO];

[_connection start];


Google for NSURLConnection startImmediately

Second link:

http://veys.com/2008/08/17/nsurlconnection-startimmediatelyno-boom/
Apparently when not using the simpler initWithRequest:delegate:, or  
even startImmediately:YES, the connection does not get scheduled in  
the current run loop. And again apparently, this causes unhappiness  
to occur when you eventually get around to calling start.


Simple fix, just stuff it in the current run loop before calling  
start and everyone gets along just fine.


[c scheduleInRunLoop:[NSRunLoop currentRunLoop]  
forMode:NSDefaultRunLoopMode];




Enjoy,
   Peter.

--
 Run macros from your iPhone with Keyboard Maestro Control!
 or take a break with Derzle for your iPhone

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
Aragom Space War http://www.stairways.com/iphone/aragom Don't get  
killed!

Derzle http://www.stairways.com/iphone/derzle Enjoy a relaxing puzzle.
http://www.stairways.com/   http://download.stairways.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: EXC_BAD_ACCESS and NSAttributedString driving me crazy

2009-03-30 Thread Sean McBride
Chris Idou (idou...@yahoo.com) on 2009-03-30 8:25 PM said:

I'm getting NSRTFDPboardType and NSRTFPboardType objects as NSData from
the pasteboard and I'm storing them in a core data XML repository and
getting them out again, and when necessary I'm converting them into
NSAttributedString with initWithRTF or initWithRTFD. This mostly works
but every now and then, actually quite often, this initWithRTF(D)
crashes with EXC_BAD_ACCESS. (stack traces below).

The thing is, I'm doing an md5Hash on the NSData objects every single
time I store them and retrieve them just to make sure they are not
corrupted, and the exact same NSData that is working one minute as an
argument to initWithRTF(D), makes it crash later on.

I'm using garbage collection, but I've solved a lot of GC problems and
this doesn't seem similar.

Has anyone got any thoughts?

What else have you tried?

http://developer.apple.com/technotes/tn2004/tn2124.html

http://www.sealiesoftware.com/blog/archive/2008/09/22/
objc_explain_So_you_crashed_in_objc_msgSend.html

___

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

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

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

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


Re: EXC_BAD_ACCESS and NSAttributedString driving me crazy

2009-03-30 Thread Chris Idou


Thanks for the links.

If I run with libgmalloc, it dies the same way, but seemingly much quicker:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0032
0x95a82688 in objc_msgSend ()
(gdb) where
#0  0x95a82688 in objc_msgSend ()
#1  0x90894910 in processColor ()
#2  0x9089395b in CharAttr ()
#3  0x9088db34 in -[NSRTFReader attributedString] ()
#4  0x9070bc03 in _NSReadAttributedStringFromURLOrData ()
#5  0x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithData:options:documentAttributes:error:] ()
#6  0x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithRTF:documentAttributes:] ()

I also found a posting with someone with the exact same problem:

http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg27895.html

I'm not sure what else to try. I'd be inclined to jump to the conclusion of 
blaming Apple, if it wasn't that this API must be a very widely called one.






From: Sean McBride cwat...@cam.org
To: Chris Idou idou...@yahoo.com; cocoa-dev@lists.apple.com
Sent: Tuesday, 31 March, 2009 2:43:18 PM
Subject: Re: EXC_BAD_ACCESS and NSAttributedString driving me crazy

Chris Idou (idou...@yahoo.com) on 2009-03-30 8:25 PM said:

I'm getting NSRTFDPboardType and NSRTFPboardType objects as NSData from
the pasteboard and I'm storing them in a core data XML repository and
getting them out again, and when necessary I'm converting them into
NSAttributedString with initWithRTF or initWithRTFD. This mostly works
but every now and then, actually quite often, this initWithRTF(D)
crashes with EXC_BAD_ACCESS. (stack traces below).

The thing is, I'm doing an md5Hash on the NSData objects every single
time I store them and retrieve them just to make sure they are not
corrupted, and the exact same NSData that is working one minute as an
argument to initWithRTF(D), makes it crash later on.

I'm using garbage collection, but I've solved a lot of GC problems and
this doesn't seem similar.

Has anyone got any thoughts?

What else have you tried?

http://developer.apple.com/technotes/tn2004/tn2124.html

http://www.sealiesoftware.com/blog/archive/2008/09/22/
objc_explain_So_you_crashed_in_objc_msgSend.html


  Enjoy a safer web experience. Upgrade to the new Internet Explorer 8 
optimised for Yahoo!7. Get it now.
___

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

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

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

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


Re: EXC_BAD_ACCESS and NSAttributedString driving me crazy

2009-03-30 Thread Ali Ozer
Can you try temporarily disabling garbage collection around the  
unarchiving of RTFD, and see if it helps?


[[NSGarbageCollector defaultCollector] disable];
... unarchive your RTFD ...
[[NSGarbageCollector defaultCollector] enable];

Ali

On Mar 30, 2009, at 5:25 PM, Chris Idou wrote:

I'm getting NSRTFDPboardType and NSRTFPboardType objects as NSData  
from the pasteboard and I'm storing them in a core data XML  
repository and getting them out again, and when necessary I'm  
converting them into NSAttributedString with initWithRTF or  
initWithRTFD. This mostly works but every now and then, actually  
quite often, this initWithRTF(D) crashes with EXC_BAD_ACCESS. (stack  
traces below).


The thing is, I'm doing an md5Hash on the NSData objects every  
single time I store them and retrieve them just to make sure they  
are not corrupted, and the exact same NSData that is working one  
minute as an argument to initWithRTF(D), makes it crash later on.


I'm using garbage collection, but I've solved a lot of GC problems  
and this doesn't seem similar.


Has anyone got any thoughts?




#00x95a82688 in objc_msgSend
#10x933b0b26 in -[NSCFDictionary setObject:forKey:]
#20x90824684 in -[NSRTFD setObject:forKey:]
#30x908f3c2f in -[NSAKDeserializer deserializePList:]
#40x908f3961 in -[NSDocumentDeserializer deserializeNewPList]
#50x908f3753 in -[NSRTFD(NSSerializationSupport)  
initWithPasteboardDataRepresentation:]

#60x908f2fe9 in -[NSFileWrapper initWithSerializedRepresentation:]
#70x908f2e32 in -[NSRTFReader initWithRTFD:]
#80x9070b9a7 in _NSReadAttributedStringFromURLOrData
#90x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions)  
initWithData:options:documentAttributes:error:]
#100x908f2de2 in - 
[NSAttributedString(NSAttributedStringKitAdditions)  
initWithRTFD:documentAttributes:]

..

#00x95a82688 in objc_msgSend
#10x90894910 in processColor
#20x9089395b in CharAttr
#30x9088db34 in -[NSRTFReader attributedString]
#40x9070bc03 in _NSReadAttributedStringFromURLOrData
#50x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions)  
initWithData:options:documentAttributes:error:]
#60x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions)  
initWithRTF:documentAttributes:]

.


Program received signal:  “EXC_BAD_ACCESS”.



 Enjoy a better web experience. Upgrade to the new Internet  
Explorer 8 optimised for Yahoo!7. Get it now.

___

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

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

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

This email sent to ao...@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: EXC_BAD_ACCESS and NSAttributedString driving me crazy

2009-03-30 Thread Chris Idou


That's a good trick to know! When I bracket the calls thus, it crashes in a 
different but similar place:

#00x95a82688 in objc_msgSend
#10x90894910 in processColor
#20x9089395b in CharAttr
#30x9088db34 in -[NSRTFReader attributedString]
#40x9070bc03 in _NSReadAttributedStringFromURLOrData
#50x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithData:options:documentAttributes:error:]
#60x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions) 
initWithRTF:documentAttributes:]
#70x908e6f25 in +[_NSRTFPboardTypeConverter pasteboard:provideDataForType:]
#80x908e6b58 in __NSPasteboardProvideData
#90x918dd120 in __CFPasteboardResolvePromiseForItemLocal
#100x918e0680 in CFPasteboardCopyData
#110x9086763e in -[NSPasteboard _dataWithoutConversionForType:]
#120x9086748a in -[NSPasteboard dataForType:]

And then if I bracket the call to dataForType: as well, the crashes stop 
happening. I'm relieved to know I at least have a workaround.

Does this tend to indicate some kind of Apple GC bug?






From: Ali Ozer ao...@apple.com
To: Chris Idou idou...@yahoo.com
Cc: Cocoa Dev cocoa-dev@lists.apple.com
Sent: Tuesday, 31 March, 2009 4:12:55 PM
Subject: Re: EXC_BAD_ACCESS and NSAttributedString driving me crazy

Can you try temporarily disabling garbage collection around the unarchiving of 
RTFD, and see if it helps?

[[NSGarbageCollector defaultCollector] disable];
... unarchive your RTFD ...
[[NSGarbageCollector defaultCollector] enable];

Ali

On Mar 30, 2009, at 5:25 PM, Chris Idou wrote:

 I'm getting NSRTFDPboardType and NSRTFPboardType objects as NSData from the 
 pasteboard and I'm storing them in a core data XML repository and getting 
 them out again, and when necessary I'm converting them into 
 NSAttributedString with initWithRTF or initWithRTFD. This mostly works but 
 every now and then, actually quite often, this initWithRTF(D) crashes with 
 EXC_BAD_ACCESS. (stack traces below).
 
 The thing is, I'm doing an md5Hash on the NSData objects every single time I 
 store them and retrieve them just to make sure they are not corrupted, and 
 the exact same NSData that is working one minute as an argument to 
 initWithRTF(D), makes it crash later on.
 
 I'm using garbage collection, but I've solved a lot of GC problems and this 
 doesn't seem similar.
 
 Has anyone got any thoughts?
 
 
 
 
 #00x95a82688 in objc_msgSend
 #10x933b0b26 in -[NSCFDictionary setObject:forKey:]
 #20x90824684 in -[NSRTFD setObject:forKey:]
 #30x908f3c2f in -[NSAKDeserializer deserializePList:]
 #40x908f3961 in -[NSDocumentDeserializer deserializeNewPList]
 #50x908f3753 in -[NSRTFD(NSSerializationSupport) 
 initWithPasteboardDataRepresentation:]
 #60x908f2fe9 in -[NSFileWrapper initWithSerializedRepresentation:]
 #70x908f2e32 in -[NSRTFReader initWithRTFD:]
 #80x9070b9a7 in _NSReadAttributedStringFromURLOrData
 #90x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
 initWithData:options:documentAttributes:error:]
 #100x908f2de2 in -[NSAttributedString(NSAttributedStringKitAdditions) 
 initWithRTFD:documentAttributes:]
 ..
 
 #00x95a82688 in objc_msgSend
 #10x90894910 in processColor
 #20x9089395b in CharAttr
 #30x9088db34 in -[NSRTFReader attributedString]
 #40x9070bc03 in _NSReadAttributedStringFromURLOrData
 #50x90709943 in -[NSAttributedString(NSAttributedStringKitAdditions) 
 initWithData:options:documentAttributes:error:]
 #60x9088c542 in -[NSAttributedString(NSAttributedStringKitAdditions) 
 initWithRTF:documentAttributes:]
 .
 
 
 Program received signal:  “EXC_BAD_ACCESS”.
 
 
 
  Enjoy a better web experience. Upgrade to the new Internet Explorer 8 
 optimised for Yahoo!7. Get it now.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/aozer%40apple.com
 
 This email sent to ao...@apple.com


  Enjoy a better web experience. Upgrade to the new Internet Explorer 8 
optimised for Yahoo!7. Get it now.
___

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

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