DICOM images in Cocoa

2008-08-13 Thread Devraj Mukherjee
Hi all,

My application requires to display DICOM image files. Preview doesn't
support DICOM by nature so the thought at the moment is to use
something like ImageMagick and convert these images to something JPEG
on the fly?

NSImage doesn't seem to be able to take a DICOM stream. Is this the
best of doing this? Does anyone know of a Cocoa DICOM reader library?

Thanks a lot.

-- 
I never look back darling, it distracts from the now, Edna Mode (The
Incredibles)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Is this how you can use bindings?

2008-08-13 Thread Chris Idou
I want a button to be enabled when myTextField is not empty.

Can have an outlet in my controller called myTextField, and then set the 
Enabled binding on the button to point to myTextField.stringValue.length, 
then can I write a transformer called GreaterThanZero to return boolean if the 
input is greater than zero?

Is that a valid way to go about this problem? It doesn't seem to be working for 
me. I wrote a myTextField accessor to see what is happening and it doesn't even 
seem to get called.





  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: DICOM images in Cocoa

2008-08-13 Thread Martin Carlberg

Try this: http://www.osirix-viewer.com/

13 aug 2008 kl. 08.12 skrev Devraj Mukherjee:


Hi all,

My application requires to display DICOM image files. Preview doesn't
support DICOM by nature so the thought at the moment is to use
something like ImageMagick and convert these images to something JPEG
on the fly?

NSImage doesn't seem to be able to take a DICOM stream. Is this the
best of doing this? Does anyone know of a Cocoa DICOM reader library?

Thanks a lot.

--
I never look back darling, it distracts from the now, Edna Mode (The
Incredibles)
___

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/martin%40oops.se

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Non-NSObject object and garbage collection

2008-08-13 Thread Quincey Morris

On Aug 12, 2008, at 22:52, Ken Ferry wrote:


In general, you don't need to CFRetain an object to keep it alive
while it's on the stack.  The fact that it's on the stack is enough.
If this wasn't true, there'd be a race, since the collector might
destroy the object before you retained it.


Unless I misunderstand your point, its being on the stack will only  
keep it alive if CFMakeCollectable has already been called on it. In a  
case where you're given a CF-type object that you don't own, I don't  
think you can assume that. If it has not been made collectable, it's  
being kept alive by a non-zero retain count, or by having being  
autoreleased, either of which will keep it alive long enough for you  
to retain 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 [EMAIL PROTECTED]


Re: Accessing memory of another application?

2008-08-13 Thread Jason Coco


On Aug 13, 2008, at 01:51 , Graham Cox wrote:



On 13 Aug 2008, at 3:22 am, Josh wrote:

You have to be able to do this - I have seen applications do it -  
you just

have to type in your root password when you start the application.


LOL, thanks for the light entertainment :)



Basically like game trainers you see everywhere on windows - but I  
don't

find a lot of them on os x.



And people say Macs are only more secure because of their lower  
market share


Prior to the release of Leopard it was trivial to manipulate another  
process's memory space as long as the processes were owned by the same  
user. Now the user has to authorize against a specific right, run as  
root, or the application trying to accomplish this has to be signed in  
order for it to work. Aside from that, tho, the actual application or  
reading/writing another process's memory space is still pretty trivial  
using mach calls.

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

Re: Is this how you can use bindings?

2008-08-13 Thread Ron Lue-Sang
The way to think about this is, you bind the value of the text field  
to a controller (or model) object that owns the value. Then, bind the  
enabled binding of the button to the same property of of the same  
controller and use a valuetransformer to check whether the value is nil.


So your setup should look like:
- TextField value binding bound to yourObject with keypath  
yourStringProperty
- button enabled binding bound to yourObject with keypath  
yourStringProperty with value transformer NSIsNotNil


You may want to turn on continuously updates value for the  
textfiled's value binding.This way as soon as the user starts typing,  
the enabled state of the button will get toggled.


Note that part of why this works with the value transformer is because  
the textfield value binding sets nil as the value when the textfield  
is emptied.


-
RONZILLA

On Aug 12, 2008, at 11:21 PM, Chris Idou [EMAIL PROTECTED] wrote:


I want a button to be enabled when myTextField is not empty.

Can have an outlet in my controller called myTextField, and then set  
the Enabled binding on the button to point to  
myTextField.stringValue.length, then can I write a transformer  
called GreaterThanZero to return boolean if the input is greater  
than zero?


Is that a valid way to go about this problem? It doesn't seem to be  
working for me. I wrote a myTextField accessor to see what is  
happening and it doesn't even seem to get called.







___

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/luesang%40apple.com

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Should I retain a variable returned from this accessor?

2008-08-13 Thread Negm-Awad Amin


Am Di,12.08.2008 um 21:36 schrieb Shawn Erickson:

On Tue, Aug 12, 2008 at 2:12 AM, Negm-Awad Amin [EMAIL PROTECTED] 
 wrote:


BTW: You can do the same inside a getter to get rid of thread  
problems.


Nope it does nothing to solve threading issues ([[blah retain]
autorelease] isn't an atomic operation) you need to protect it with an
critical section of some type. Additionally adding locking at the
level of accessor is often far to granular to be useful to clients of
a class.

-Shawn
Of course you have to do locking additionally. I did not want to say,  
that this solves all problems of threading.


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Disc write speed options

2008-08-13 Thread Chris Suter
On Wed, Aug 13, 2008 at 1:04 AM, Matthew Mashyna [EMAIL PROTECTED] wrote:
 I'm trying to figure out how I can ask a DRDevice what  burn speeds it's
 capable of so I can offer a choice to the user. When I call the status and
 info messages I don't see anything that looks useful. How can I get and set
 the burn rate ?

What's wrong with using the system supplied panel?

-- Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa and SOAP without WebServicesCore

2008-08-13 Thread Thomas Engelmeier


Am 12.08.2008 um 22:26 schrieb patrick machielse:

Now I find myself having to deploy to a platform where not even this  
feeble API is available. I've been investigating alternatives, and  
found the gSOAP library, which at the moment looks like the best  
candidate. However, ideally I would like to use a pure Cocoa  
solution, or a project which has existing Cocoa wrappers. Does  
anyone have experiences with gSOAP on OS X, or know of a good  
alternative?


a.) it works but can be hell if you have to debug, especially if you  
have to load 100kb+ generated source files in Xcode.


b.) IANAL, but a Cocoa enabled platform w/o WSCore might be in  
conflict with the GPL the royalty-free usage of gSOAP demands IIRC.


c.) Alternatives also depend on how many calls the target API has.

i.e. Setting up and compiling gSOAP takes some time.
Packet-sniffing the communication of http://www.ditchnet.org/soapclient/ 
 and creating the comm with a combination of printf' to a XML  
template string, NSURLRequest and parsing results with libXML takes  
another amount of time. Sometimes the later is more effective (e.g.  
for some primitive gimme weather at ZIP code 12345 SOAP API).


SOAP was meant to be simple (the S in SOAP), and just became hard to  
deal with due to some overengineered parameter / packet format. With  
packet-to-send templates it should be straightforward to handle.


Regards,
Tom_E
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is this how you can use bindings?

2008-08-13 Thread Chris Idou

Ahh I see. That works for a button, but with a toolbar button it makes the 
button flash momentarily, but then stays non-enabled. Any ideas?



--- On Tue, 8/12/08, Ron Lue-Sang [EMAIL PROTECTED] wrote:

 From: Ron Lue-Sang [EMAIL PROTECTED]
 Subject: Re: Is this how you can use bindings?
 To: Chris Idou [EMAIL PROTECTED]
 Cc: cocoa-dev@lists.apple.com cocoa-dev@lists.apple.com
 Date: Tuesday, August 12, 2008, 11:56 PM
 The way to think about this is, you bind the value of the
 text field  
 to a controller (or model) object that owns the value.
 Then, bind the  
 enabled binding of the button to the same property of of
 the same  
 controller and use a valuetransformer to check whether the
 value is nil.
 
 So your setup should look like:
 - TextField value binding bound to yourObject with keypath 
 
 yourStringProperty
 - button enabled binding bound to yourObject with keypath  
 yourStringProperty with value transformer NSIsNotNil
 
 You may want to turn on continuously updates
 value for the  
 textfiled's value binding.This way as soon as the user
 starts typing,  
 the enabled state of the button will get toggled.
 
 Note that part of why this works with the value transformer
 is because  
 the textfield value binding sets nil as the value when the
 textfield  
 is emptied.
 
 -
 RONZILLA
 
 On Aug 12, 2008, at 11:21 PM, Chris Idou
 [EMAIL PROTECTED] wrote:
 
  I want a button to be enabled when myTextField is not
 empty.
 
  Can have an outlet in my controller called
 myTextField, and then set  
  the Enabled binding on the button to point
 to  
  myTextField.stringValue.length, then can I write a
 transformer  
  called GreaterThanZero to return boolean if the input
 is greater  
  than zero?
 
  Is that a valid way to go about this problem? It
 doesn't seem to be  
  working for me. I wrote a myTextField accessor to see
 what is  
  happening and it doesn't even seem to get called.
 
 
 
 
 
 
  ___
 
  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/luesang%40apple.com
 
  This email sent to [EMAIL PROTECTED]


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Non-NSObject object and garbage collection

2008-08-13 Thread Ken Ferry
On Tue, Aug 12, 2008 at 11:30 PM, Quincey Morris
[EMAIL PROTECTED] wrote:
 On Aug 12, 2008, at 22:52, Ken Ferry wrote:

 In general, you don't need to CFRetain an object to keep it alive
 while it's on the stack.  The fact that it's on the stack is enough.
 If this wasn't true, there'd be a race, since the collector might
 destroy the object before you retained it.

 Unless I misunderstand your point, its being on the stack will only keep it
 alive if CFMakeCollectable has already been called on it. In a case where
 you're given a CF-type object that you don't own, I don't think you can
 assume that. If it has not been made collectable, it's being kept alive by a
 non-zero retain count, or by having being autoreleased, either of which will
 keep it alive long enough for you to retain it.

I think Malcolm prefers we point at the docs rather than try to
explain in our own words. :-)

http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html

By default, all Core Foundation objects are allocated in the garbage
collection zone.

The difference between the garbage-collected environment and managed
memory environment is in the timing of the object's deallocation. In a
managed memory environment, when the object's retain count drops to 0
it is deallocated immediately; in a garbage-collected environment,
what happens when a Core Foundation object's retain count transitions
from 1 to 0 depends on where it resides in memory:

If the object is in the malloc zone, it is deallocated immediately.
If the object is in the garbage collected zone, the last CFRelease()
does not immediately free the object, it simply makes it eligible to
be reclaimed by the collector when it is discovered to be
unreachable—that is, once all strong references to it are gone. Thus
as long as the object is still referenced from an object-type instance
variable (that hasn't been marked as__weak), a register, the stack, or
a global variable, it will not be collected.

CFMakeCollectable calls CFRelease, but has two supplementary
features: first, it ensures that the object was allocated in the
scanned zone; second, it's a no-op if you use managed memory. (In
addition, it more clearly signals your intent.) 

-Ken
Cocoa Frameworks
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with friend function and gcc 4.2 with objective-c++

2008-08-13 Thread Thomas Engelmeier


Am 09.08.2008 um 16:32 schrieb Clark Cox:


On Sat, Aug 9, 2008 at 2:20 AM, Thomas Engelmeier
[EMAIL PROTECTED] wrote:


Am 08.08.2008 um 00:09 schrieb Ken Worley:





friend != static, and even then this probably would not be valid  
semantics.


test1* tobj = newtest1(5); has nothing to do with
test1::newtest1( int ) or aTest1Instance-newtest1( int )


I believe that you are incorrect. This is a perfectly valid way of
defining friend functions in C++. Defined this way, newtest1 is a
global function (i.e. it is not scoped to test) that is allowed to
access the private/protected parts of test1 instances.

From the C++ standard (11.4 paragraph 5):

A function can be defined in a friend declaration of a class if and
only if the class is a non-local class (9.8),
the function name is unqualified, and the function has namespace
scope. [Example:
   class M {
   friend void f() { } //definition of globalf, a friend ofM,
   //not the definition of a member function
   };
—end example] Such a function is implicitlyinline. Afriendfunction
defined in a class is in the
(lexical) scope of the class in which it is defined.



OOPs.. OK, I just did some cursory research how the friend syntax (I  
rarely used) is like...


Regards,
Tom_E

___

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

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

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

This email sent to [EMAIL PROTECTED]


Referencing known values in core data

2008-08-13 Thread Andrew Zahra
I am experimenting with core data. Binding fields such as text fields works
fine. But now I have a pop up menu I want to bind to a set of known values.
I have a Task Entity with a frequency field. The frequency field is a
set of known values, such as hourly, daily etc, so I have not put this in my
model as a separate entity. What is the correct way to handle this situation
so the value of the popup menu gets saved and loaded from the core data
store?

thanks,
Andrew
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Referencing known values in core data

2008-08-13 Thread I. Savant

On Aug 13, 2008, at 5:34 AM, Andrew Zahra wrote:

I am experimenting with core data. Binding fields such as text  
fields works
fine. But now I have a pop up menu I want to bind to a set of known  
values.
I have a Task Entity with a frequency field. The frequency field  
is a
set of known values, such as hourly, daily etc, so I have not put  
this in my
model as a separate entity. What is the correct way to handle this  
situation
so the value of the popup menu gets saved and loaded from the core  
data

store?


  One way to do this (the way I usually do it) is to:

1 - Define somewhere a lookup list based on numbers.
(example: [NSNumber numberWithInt:1] represents hourly, 2 is  
daily ...)
2 - In your entity, specify your 'frequency' attribute as one of the  
integer types.
3 - For each popup that uses this list, create an item for each word  
(hourly, daily, ...) by hand, setting each item's tag to the number  
that represents that item.

(example: set the hourly item's tag to 1)
4 - Bind the popup's selectedTag to your Task entity's 'frequency'  
attribute via some controller.


  That's it. You may wonder why I don't just suggest using the  
'selectedIndex' binding. Simple: you may some day want to insert  
weekly between daily and monthly. That would cause problems with  
existing user data since the indices would change. Via the tag method,  
you can reorder / insert menu items at will.


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


Re: DICOM images in Cocoa

2008-08-13 Thread Matthias Schonder

Hi,

you may also try iiDICOM ( http://www.imaginginformatics.ca/open-source/quickdicom/iidicom-framework-readme 
 ) but you may also take a look at dcmtk-library (http://dicom.offis.de/dcmtk 
 ) which heavily used the mentioned Osirix-Viewer. dcmtk is C/C++  
while iiDICOM is Objective-C


regards,
matthias

On 13.08.2008, at 08:28, Martin Carlberg wrote:


Try this: http://www.osirix-viewer.com/

13 aug 2008 kl. 08.12 skrev Devraj Mukherjee:


Hi all,

My application requires to display DICOM image files. Preview doesn't
support DICOM by nature so the thought at the moment is to use
something like ImageMagick and convert these images to something JPEG
on the fly?

NSImage doesn't seem to be able to take a DICOM stream. Is this the
best of doing this? Does anyone know of a Cocoa DICOM reader library?

Thanks a lot.

--
I never look back darling, it distracts from the now, Edna Mode  
(The

Incredibles)
___

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/martin%40oops.se

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Programmatically place cursor within NSTextField

2008-08-13 Thread fclee
How can I programmatically position the cursor to an arbitrary position with a 
NSTextField?

For example, placing a cursor within the parentheses '('...')' of a phone 
number?

Regards,

Ric.
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: DICOM images in Cocoa

2008-08-13 Thread Thomas Engelmeier


Am 13.08.2008 um 10:55 schrieb Ken Ferry:

Implementing an NSImageRep subclass is pretty similar to implementing
a custom view.


Is there an similar concept of QuickTime Graphics Importers, i.e.  
system wide extensible formats ImageIO and / or NSImage can handle,  
possible?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa and SOAP without WebServicesCore

2008-08-13 Thread Thomas Engelmeier


Am 13.08.2008 um 11:06 schrieb patrick machielse:

a.) it works but can be hell if you have to debug, especially if  
you have to load 100kb+ generated source files in Xcode.


Hmm, thanks for the warning. On the other hand, the documentation of  
gSOAP, and the available recourses on the web, seem to be far  
superior to what's available for WebServicesCore.


Yepp, still it's not a lightweight addition. IIRC I had some internal  
(resolvable) typedef conflicts compiling using CodeWarrior, and some  
sorts of trouble until generated stubs from some WSDL were OK.


b.) IANAL, but a Cocoa enabled platform w/o WSCore might be in  
conflict with the GPL the royalty-free usage of gSOAP demands IIRC.


gSOAP is available under several licenses (and is used by big name  
software houses) so I believe this should not be a problem (knock on  
wood...)


I reread them and the MPL derivate seems to be fine. I wasn't aware of  
that option.



c.) Alternatives also depend on how many calls the target API has.

creating the comm with a combination of printf' to a XML template  
string, NSURLRequest and parsing results with libXML takes another  
amount of time. Sometimes the later is more effective (e.g. for  
some primitive gimme weather at ZIP code 12345 SOAP API).


I have been considering this approach, and it could work for the  
simpler cases. However, I need to interact with more mature services  
as well, API that will return complex types and structured data, and  
it would be nice to have a more robust mechanism under the hood that  
would handle server communication, authentication, and the  
conversion to and from Cocoa objects automatically.


Except for the later you probably will be fine.. Automatic Cocoa  
(de-)serialisation won't happen, you´ll need to write adapters  
manually for that.


Regards,
Tom_E


___

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

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

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

This email sent to [EMAIL PROTECTED]


Detect when another application goes into full screen mode or when dock becomes hidden

2008-08-13 Thread Angie Frazier
Is there a way to detect when another application goes into and comes out of
full screen mode?
Additionally, is there a way to detect with the dock becomes hidden because
another app went into full screen mode?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Accessing memory of another application?

2008-08-13 Thread Kyle Sluder
On Tue, Aug 12, 2008 at 10:14 PM, Steve Byan [EMAIL PROTECTED] wrote:
 Actually, the man-page is incomplete and doesn't tell you how to read and
 write another process's memory.

The manpage also fails to mention the undocumented PT_DENY_ATTACH flag
that applications can pass to force ptrace to fail to attach.  Pro
Tools, for example, does this because the programmers who wrote it
spent twice as much time on the copy protection as on the actual
application.

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


Re: Accessing memory of another application?

2008-08-13 Thread Jean-Daniel Dupas


Le 13 août 08 à 15:27, Kyle Sluder a écrit :

On Tue, Aug 12, 2008 at 10:14 PM, Steve Byan [EMAIL PROTECTED]  
wrote:
Actually, the man-page is incomplete and doesn't tell you how to  
read and

write another process's memory.


The manpage also fails to mention the undocumented PT_DENY_ATTACH flag
that applications can pass to force ptrace to fail to attach.  Pro
Tools, for example, does this because the programmers who wrote it
spent twice as much time on the copy protection as on the actual
application.


man ptrace:

PTRACE(2)   BSD System Calls Manual   
PTRACE(2)


NAME
 ptrace -- process tracing and debugging

...

PT_DENY_ATTACH
   This request is the other operation used by the  
traced process; it allows a process that is not currently being traced  
to deny future traces by
   its parent.  All other arguments are ignored.  If  
the process is currently being traced, it will exit with the exit  
status of ENOTSUP; other-
   wise, it sets a flag that denies future traces.   
An attempt by the parent to trace a process which has set this flag  
will result in a segmenta-

   tion violation in the parent.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's the use of the Z_UUID in the Z_METADATA table?

2008-08-13 Thread Gustavo Vera
Maybe I should not, but I'm doing it anyway :D
I'm looking inside and also I'm manipulating the structure and data of the
sqlite file since about 200 revisions in my project. I'm doing this to
provide newer versions of the app that has the possibility of performing
database migrations / upgrades from older versions of the app if available.
With the new functionalities, occasionally a change in the database
structure results necessary, and when the change is simple (for example,
just adding a new attribute to an entity) altering the data model and the
data structures in an old sqlite is far easier and faster than implementing
the migration functionality suggested in the documentation. In fact, I think
this is faster and easier even when more complex changes are necessary.
Anyway... I was wondering if I should take care of the Z_UUID during the
perform of this upgrades, or if I can just ignore it. I'm currently ignoring
it... can this become a problem in the future?


On Tue, 12 Aug 2008 17:28:39 -0300, Marcelo Alves
[EMAIL PROTECTED] wrote:


  It is a implementation detail. You should not look inside the sqlite file.

 2008/8/12 Gustavo Vera [EMAIL PROTECTED]:
  What's the use of the Z_UUID in the Z_METADATA table?
  Is some kind of check sum or something like that?
  CoreData uses this value for something?
  Why is this value different every time the DB is regenerated?
  Is the generation of it a random-based one? Or is it based on
  random+another thing?
 
  Please don't answer my question with another question!!! At least not at
  first instance! :D
 
  Thanks in advance!

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detect when another application goes into full screen mode or when dock becomes hidden

2008-08-13 Thread Gregory Weston

Angie Frazier wrote:

Is there a way to detect when another application goes into and  
comes out of

full screen mode?
Additionally, is there a way to detect with the dock becomes hidden  
because

another app went into full screen mode?


What are you really trying to accomplish?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Accessing memory of another application?

2008-08-13 Thread Devon Ferns



Jason Coco wrote:




The manpage also fails to mention the undocumented PT_DENY_ATTACH flag
that applications can pass to force ptrace to fail to attach.  Pro
Tools, for example, does this because the programmers who wrote it
spent twice as much time on the copy protection as on the actual
application.


My manpage for ptrace shows the PT_DENY_ATTACH flag. It's the second 
flag documented under requests...


Anyway, for what he wants to do (obviously not a commercial 
application), I think the mach traps are the easiest
way to achieve his goals. Spawning the application into memory and 
dealing with an execution interpreter, as was
suggested before, is IMO way overcomplicated to cheat at a game :) much 
easier to just beat the game...




You can also get around that fairly easily by using gdb and breaking on 
ptrace.  Search on your favourite search engine to find out how.


Devon
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's the use of the Z_UUID in the Z_METADATA table?

2008-08-13 Thread Marcelo Alves
2008/8/13 Gustavo Vera [EMAIL PROTECTED]:
 Maybe I should not, but I'm doing it anyway :D
 I'm looking inside and also I'm manipulating the structure and data of the
 sqlite file since about 200 revisions in my project. I'm doing this to
 provide newer versions of the app that has the possibility of performing
 database migrations / upgrades from older versions of the app if available.
 With the new functionalities, occasionally a change in the database
 structure results necessary, and when the change is simple (for example,
 just adding a new attribute to an entity) altering the data model and the
 data structures in an old sqlite is far easier and faster than implementing
 the migration functionality suggested in the documentation. In fact, I think
 this is faster and easier even when more complex changes are necessary.
 Anyway... I was wondering if I should take care of the Z_UUID during the
 perform of this upgrades, or if I can just ignore it. I'm currently ignoring
 it... can this become a problem in the future?


Well, I'm not a Core Data expert, but locking yourself to sqlite
engine does not look correct to me. Apple can add/remove/change
persistent stores anytime. And remember, Core Data is a object graph
management framework, not a database.


:: marcelo.alves
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detect when another application goes into full screen mode or when dock becomes hidden

2008-08-13 Thread Eric Schlegel


On Aug 13, 2008, at 6:21 AM, Angie Frazier wrote:

Is there a way to detect when another application goes into and  
comes out of

full screen mode?
Additionally, is there a way to detect with the dock becomes hidden  
because

another app went into full screen mode?


You can use a Carbon event handler for kEventClassApplication/ 
kEventAppSystemUIModeChanged to detect this. SnowLeopard will provide  
a Cocoa-based approach as well.


-eric

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: DICOM images in Cocoa

2008-08-13 Thread Apple Cocoa List

Also check out:

http://www.escape.gr/

Todd

On Aug 13, 2008, at 1:12 AM, Devraj Mukherjee wrote:


Hi all,

My application requires to display DICOM image files. Preview doesn't
support DICOM by nature so the thought at the moment is to use
something like ImageMagick and convert these images to something JPEG
on the fly?

NSImage doesn't seem to be able to take a DICOM stream. Is this the
best of doing this? Does anyone know of a Cocoa DICOM reader library?

Thanks a lot.

--
I never look back darling, it distracts from the now, Edna Mode (The
Incredibles)
___

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/applecocoalist%40filmworkers.com

This email sent to [EMAIL PROTECTED]

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
__


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to read the z-buffer in a layer-backed openGL view?

2008-08-13 Thread Mathieu Coursolle

Hi Cocoa developers,

I've been playing with this example for a while now:
http://developer.apple.com/samplecode/LayerBackedOpenGLView/listing2.html

and I was wondering if someone knew the answer to that question:

Is is possible to read the z-buffer (using glReadPixels) in a  
mouseDown procedure?


It seems to work fine if done in the drawing procedure, but not outside.

Thanks!

Mathieu

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Opening an external file in a external application

2008-08-13 Thread John Love

On 12 Aug 2008, has wrote:

Really though, what's best/practical/possible all depends on what  
you're trying to do, so if you want more advice then you'll need to  
provide more information.


Very short info list is as follows (stuff I need to do from within my  
Cocoa app):


1) be able to save the Excel spreadsheet
2) be able to stop any calculation in progress
3) be able to detect if the user closed the spreadsheet behind the  
back of my Cocoa app, upon which my Cocoa app would raise a NSAlert.


Before I forget again, one question *not* related to the above,  
namely, the call within my overridden readFromURL:


  workSpace = [NSWorkspace sharedWorkspace];
   success = [workSpace openURL:absoluteURL];

activates Excel .. what do I need to add to re-activate my Cocoa  
app .. activate me was terribly easy with AppleScript.


John





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: DICOM images in Cocoa

2008-08-13 Thread Sean McBride
On 8/13/08 4:12 PM, Devraj Mukherjee said:

NSImage doesn't seem to be able to take a DICOM stream. Is this the
best of doing this? Does anyone know of a Cocoa DICOM reader library?

You could use VTK and/or ITK.  See www.vtk.org and www.itk.org.  These
are the libraries OsiriX uses.  VTK has an NSView subclass that can
display any content that VTK can render, including DICOM.  Alas, VTK's
DICOM support is somewhat lacking, but may be sufficient for your
purposes.  ITK has much better DICOM support.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Why won't Gmail cooperate with authentication delegate methods? (Gmail RSS feeds do.)

2008-08-13 Thread Sumner Trammell
(I realize that this is bordering on a Google API question, but there
is some Cocoa content.)



Hi. One can whip up a WebKit/Cocoa app, aim it at a Gmail URL like this:

https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmailservice=mailEmail=YOUR_LOGINPasswd=YOUR_PASSWORDnull=Sign+in

and get automatically logged into her Gmail account.  Pretty cool.







Even cooler, in my opinion, is implementing this delegate method:

- (void)webView:(WebView *)aSender
   resource:(id)anIdentifier
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)aChallenge
 fromDataSource:(WebDataSource *)aDataSource

(Pages 20-21 of the URL Loading System documentation have the details.)

So now, when you aim your app at the Gmail RSS feed URL:

https://mail.google.com/mail/feed/atom


you are authenticated automatically as well.







The second case has me wishing there were a special URL for the first
case that used standard authentication. (And thus would work with
authentication delegate methods.)

I tried the obvious, https://mail.google.com/mail, and that doesn't
work.  I'm still presented with the Gmail login form screen.

Does anyone know if a special URL exists for Gmail that uses standard
SSLv3 authentication like the Gmail RSS feed URL does?





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


Re: Programmatically place cursor within NSTextField

2008-08-13 Thread chaitanya pandit


Hi,
You first have to compute the character index where you need to place  
the cursor, then create a range with zero length and location =  
character index,
Then get the editor (NSText object) for the text field, you can get  
one by calling NSWindow's

- (NSText *)fieldEditor:(BOOL)createWhenNeededforObject:(id)anObject
and passing your NSTextField object as anObject
Then eventually call - (void)setSelectedRange:(NSRange)aRange on the  
text object by passing the range you computed in the first step.


Hope this helps,
Chaitanya

On 13-Aug-08, at 7:02 AM, [EMAIL PROTECTED] wrote:

How can I programmatically position the cursor to an arbitrary  
position with a NSTextField?


For example, placing a cursor within the parentheses '('...')' of a  
phone number?


Regards,

Ric.
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Subclassing NSTextView

2008-08-13 Thread Michael Ash
On Tue, Aug 12, 2008 at 9:15 PM, John Joyce
[EMAIL PROTECTED] wrote:
 Ooops, nevermind!!
 I answered my own question.
 When adding the class file to the project, start with the NSView subclass
 template, then change it to subclass NSTextView in the .h
 and in the .m either call [super drawRect:rect]; or comment out or delete
 the drawRect method all together.
 That was too stupidly easy to be obvious.
 Too bad there is not an option for more subclass templates right in the GUI

In most cases, all you need to create a minimal, functional subclass is this:

@interface MyClass : SuperClass {} @end
@implementation MyClass @end

In other words, just a plain empty class with no methods and no ivars,
inheriting from the class you want.

This is all due to the idea of OO programming. You inherit all of the
behavior of the superclass. If you provide no further behavior, then
you act exactly like that superclass.

There is one big exception to this. If the superclass is actually an
abstract class with private concrete subclasses (which is to say that
doesn't implement all of its functionality on its own) then there will
be required functionality that any subclass must implement. In Cocoa
these are generally called class clusters, documented as such, and the
required subclass functionality listed (the required methods are
called primitive methods).

It's unlikely for an NSView to be a class cluster (it's *possible*,
but I know of no examples of such) so for any NSView you subclass, you
can just start with a blank slate as above.

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


Re: Opening an external file in a external application

2008-08-13 Thread Shawn Erickson


On Aug 13, 2008, at 8:17 AM, John Love wrote:


On 12 Aug 2008, has wrote:

Really though, what's best/practical/possible all depends on what  
you're trying to do, so if you want more advice then you'll need to  
provide more information.


Very short info list is as follows (stuff I need to do from within  
my Cocoa app):


1) be able to save the Excel spreadsheet
2) be able to stop any calculation in progress
3) be able to detect if the user closed the spreadsheet behind the  
back of my Cocoa app, upon which my Cocoa app would raise a NSAlert.


Before I forget again, one question *not* related to the above,  
namely, the call within my overridden readFromURL:


 workSpace = [NSWorkspace sharedWorkspace];
  success = [workSpace openURL:absoluteURL];

activates Excel .. what do I need to add to re-activate my Cocoa  
app .. activate me was terribly easy with AppleScript.


NSApplication has methods to active your application.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Should I retain a variable returned from this accessor?

2008-08-13 Thread has

Peter N Lewis wrote:


I'm no Cocoa expert, but I think you're wrong on this, you've missed
out a crucial line:

At 3:12 PM -0400 11/8/08, Sean DeNigris wrote:

// Get uid to return
NSString* todoUid = [newTodo uid];

// Clean up
[newTodo release];
newTodo = nil;

return todoUid;


[newTodo release] is not [newTodo autorelease].  So it may
immediately call dealloc and dealloc the uid returned by by [newTodo
uid].


I don't think so.

The problem here is that you're thinking about Scripting Bridge in  
conventional Cocoa/proxy object terms. This is understandable given  
that this is the illusion that the SB API is intended to create.  
*However*, the thing to realise about Apple event IPC is that it's  
*RPC plus queries* (a very un-Cocoa-like beast), and what SB does is  
plaster over this mechanism with a load of obfuscations in a well- 
meaning (but misguided) attempt to make it look and feel like regular  
Cocoa (which it isn't, and never will be).


For example, the whole:

iCalTodo* newTodo = [[[iCal classForScriptingClass:@todo]  
alloc] init];

[[myCalendar todos] addObject:newTodo];
[newTodo release];

rigmarole is just a bunch of pseudo Cocoa-isms on top of a standard  
'make' Apple event, which in AppleScript would appear as:


tell application iCal to make new todo at end of todos

and in objc-appscript - which, unlike SB, is bluntly honest about  
what's going on beneath - as:


ICCommand *cmd = [[[iCal make]
  new: [ICConstant todo]];
   at: [[ICApp todos] end]];
id result = [cmd send];

(I'll spare you the equivalent C though as we'd be here all day.)

Basically, all that SB is doing in that first line is creating a  
temporary SB object representing an application object that doesn't  
actually exist yet. This SB object contains one or more values that  
will be used as parameters to a 'make' event that will be sent later.  
(The one parameter that's always required is 'new'; others may be  
optional or required depending on the application implementation, type  
of object being created, etc.)


As soon as you pass this object to -addObject:, a 'make' event  
containing those parameters is sent off to the target application to  
handle. Once that's done, your original temporary object no longer has  
any real part to play; unlike Distributed Objects, there is no  
permanent two-way connection where a local object acts as the official  
proxy for a remote object as long as both objects remain live.



The fact that you can subsequently refer to this temporary object to  
set and get properties belonging to iCal's newly created todo object  
is kinda incidental. All that's happening here is that SB is stuffing  
the object specifier (i.e. query) returned by the 'make' command into  
your SB object, and subsequently accessing that object's properties is  
sending fresh 'get'/'set' events to the application with that object  
specifier as their direct parameter.


However, even this aspect of SB's behaviour is misleading; for  
example, some applications may not return a result for the 'make'  
event (in which case you'll be talking to air), and many that do will  
return a by-index or by-name reference that is not guaranteed to  
identify the same application object the next time you want to talk to  
it. Also bear in mind that setting properties after -addObject: is  
called is not the same as setting them as part of the 'make' event;  
for example, read-only properties can often have values assigned at  
the time the object is created, but can't be set afterwards.



As for memory management of the NSString returned by [newTodo uid],  
remember that it's the product of a 'get' event sent to the target  
application, and not something that belongs to or held in an ivar of  
the SB object that returned it. All SB does is add the NSString to the  
current autorelease pool before returning it, so once that pool is  
dealloced the NSString will be disposed of as well unless you -retain  
it beforehand.



Anyway, hope that's of some use, though personally if I were the OP  
I'd see about using Leopard's new Calendar Store framework instead,  
thereby avoiding the need to muck about with Apple event IPC at all.  
Users will also appreciate it, since it means that other applications  
won't be magically launching while they're running yours.


HTH

has

--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why won't Gmail cooperate with authentication delegate methods? (Gmail RSS feeds do.)

2008-08-13 Thread mm w
hi, do you use gdata obj-c client?
I think it's a cookie problem, did you ask for an auth basic?

On Wed, Aug 13, 2008 at 9:05 AM, Sumner Trammell
[EMAIL PROTECTED] wrote:
 (I realize that this is bordering on a Google API question, but there
 is some Cocoa content.)



 Hi. One can whip up a WebKit/Cocoa app, aim it at a Gmail URL like this:

 https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmailservice=mailEmail=YOUR_LOGINPasswd=YOUR_PASSWORDnull=Sign+in

 and get automatically logged into her Gmail account.  Pretty cool.







 Even cooler, in my opinion, is implementing this delegate method:

 - (void)webView:(WebView *)aSender
   resource:(id)anIdentifier
 didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)aChallenge
  fromDataSource:(WebDataSource *)aDataSource

 (Pages 20-21 of the URL Loading System documentation have the details.)

 So now, when you aim your app at the Gmail RSS feed URL:

 https://mail.google.com/mail/feed/atom


 you are authenticated automatically as well.







 The second case has me wishing there were a special URL for the first
 case that used standard authentication. (And thus would work with
 authentication delegate methods.)

 I tried the obvious, https://mail.google.com/mail, and that doesn't
 work.  I'm still presented with the Gmail login form screen.

 Does anyone know if a special URL exists for Gmail that uses standard
 SSLv3 authentication like the Gmail RSS feed URL does?





 Thanks,
 -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/openspecies%40gmail.com

 This email sent to [EMAIL PROTECTED]




-- 
-mmw
___

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

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

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

This email sent to [EMAIL PROTECTED]


CGDisplayFade problem

2008-08-13 Thread Fabian
Hi all,

I have this problem where CGDisplayFade fails every fifth or so time
it is called, and I don't see why. What fails is usually fading in,
but also out from time to time. As you can see in the code below I
wait for the fade to complete in the fadeOut method, update the window
content and then wait an additional half a second before attempting to
fade in again, just to be on the safe side. In my fadeIn method I also
wait for the fade to complete before moving on. Any idea what the
problem is, or more generally what can cause this failure?

Thanks.
/ f.


- (void) aMethod
{
  [self fadeOut];
  // update window content here
  [self performSelector:@selector(fadeIn) withObject:nil afterDelay:0.5];
}

- (void) fadeOut
{   

// token = CGDisplayFadeReservationToken instance variable
CGDisplayErr err =
CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval,

token);

if (err == kCGErrorSuccess) {
CGDisplayFade (token, 0.5, kCGDisplayBlendNormal,
kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);
} else {
NSLog(@fade out error);
}   

}

- (void) fadeIn
{   
CGDisplayErr err = CGDisplayFade (token, 0.5, kCGDisplayBlendSolidColor,
  kCGDisplayBlendNormal, 0.0, 0.0, 0.0, true);

if (err == kCGErrorSuccess)
CGReleaseDisplayFadeReservation (token);
else {
NSLog(@fade in error);
}
}
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Should I retain a variable returned from this accessor?

2008-08-13 Thread mm w
no as far as possible, you shouldn't retain an accessor, you are not
the owner of this accessor

the accessor is owned by an the his object, you are the owner
of an instance of one object when you create it

for an example

myobject {
  private dict;
}
string title();

...

string title() {
  return dict['title'];
}

obj = new myobject();
obj-title();

it's a non-sense if you retain and release it, in certain case you
could copy an accessor returned value
this is not a particular cocoa thing

Cheers!



On Tue, Aug 12, 2008 at 2:01 PM, has [EMAIL PROTECTED] wrote:
 Peter N Lewis wrote:

 I'm no Cocoa expert, but I think you're wrong on this, you've missed
 out a crucial line:

 At 3:12 PM -0400 11/8/08, Sean DeNigris wrote:

// Get uid to return
NSString* todoUid = [newTodo uid];

// Clean up
[newTodo release];
newTodo = nil;

return todoUid;

 [newTodo release] is not [newTodo autorelease].  So it may
 immediately call dealloc and dealloc the uid returned by by [newTodo
 uid].

 I don't think so.

 The problem here is that you're thinking about Scripting Bridge in
 conventional Cocoa/proxy object terms. This is understandable given that
 this is the illusion that the SB API is intended to create. *However*, the
 thing to realise about Apple event IPC is that it's *RPC plus queries* (a
 very un-Cocoa-like beast), and what SB does is plaster over this mechanism
 with a load of obfuscations in a well-meaning (but misguided) attempt to
 make it look and feel like regular Cocoa (which it isn't, and never will
 be).

 For example, the whole:

iCalTodo* newTodo = [[[iCal classForScriptingClass:@todo] alloc] init];
[[myCalendar todos] addObject:newTodo];
[newTodo release];

 rigmarole is just a bunch of pseudo Cocoa-isms on top of a standard 'make'
 Apple event, which in AppleScript would appear as:

tell application iCal to make new todo at end of todos

 and in objc-appscript - which, unlike SB, is bluntly honest about what's
 going on beneath - as:

ICCommand *cmd = [[[iCal make]
  new: [ICConstant todo]];
   at: [[ICApp todos] end]];
id result = [cmd send];

 (I'll spare you the equivalent C though as we'd be here all day.)

 Basically, all that SB is doing in that first line is creating a temporary
 SB object representing an application object that doesn't actually exist
 yet. This SB object contains one or more values that will be used as
 parameters to a 'make' event that will be sent later. (The one parameter
 that's always required is 'new'; others may be optional or required
 depending on the application implementation, type of object being created,
 etc.)

 As soon as you pass this object to -addObject:, a 'make' event containing
 those parameters is sent off to the target application to handle. Once
 that's done, your original temporary object no longer has any real part to
 play; unlike Distributed Objects, there is no permanent two-way connection
 where a local object acts as the official proxy for a remote object as long
 as both objects remain live.


 The fact that you can subsequently refer to this temporary object to set and
 get properties belonging to iCal's newly created todo object is kinda
 incidental. All that's happening here is that SB is stuffing the object
 specifier (i.e. query) returned by the 'make' command into your SB object,
 and subsequently accessing that object's properties is sending fresh
 'get'/'set' events to the application with that object specifier as their
 direct parameter.

 However, even this aspect of SB's behaviour is misleading; for example, some
 applications may not return a result for the 'make' event (in which case
 you'll be talking to air), and many that do will return a by-index or
 by-name reference that is not guaranteed to identify the same application
 object the next time you want to talk to it. Also bear in mind that setting
 properties after -addObject: is called is not the same as setting them as
 part of the 'make' event; for example, read-only properties can often have
 values assigned at the time the object is created, but can't be set
 afterwards.


 As for memory management of the NSString returned by [newTodo uid], remember
 that it's the product of a 'get' event sent to the target application, and
 not something that belongs to or held in an ivar of the SB object that
 returned it. All SB does is add the NSString to the current autorelease pool
 before returning it, so once that pool is dealloced the NSString will be
 disposed of as well unless you -retain it beforehand.


 Anyway, hope that's of some use, though personally if I were the OP I'd see
 about using Leopard's new Calendar Store framework instead, thereby avoiding
 the need to muck about with Apple event IPC at all. Users will also
 appreciate it, since it means that other applications won't be magically
 launching while they're running yours.

 HTH

 

Re: Why won't Gmail cooperate with authentication delegate methods? (Gmail RSS feeds do.)

2008-08-13 Thread Derek Chesterfield

On Wed, Aug 13, 2008 at 9:05 AM, Sumner Trammell
[EMAIL PROTECTED] wrote:


One can whip up a WebKit/Cocoa app, aim it at a Gmail URL like this:

https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmailservice=mailEmail=YOUR_LOGINPasswd=YOUR_PASSWORDnull=Sign+in

and get automatically logged into her Gmail account.  Pretty cool.

Even cooler, in my opinion, is implementing this delegate method:

- (void)webView:(WebView *)aSender
 resource:(id)anIdentifier
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge  
*)aChallenge

fromDataSource:(WebDataSource *)aDataSource

So now, when you aim your app at the Gmail RSS feed URL:

https://mail.google.com/mail/feed/atom

you are authenticated automatically as well.

The second case has me wishing there were a special URL for the first
case that used standard authentication. (And thus would work with
authentication delegate methods.)

I tried the obvious, https://mail.google.com/mail, and that doesn't
work.  I'm still presented with the Gmail login form screen.

Does anyone know if a special URL exists for Gmail that uses standard
SSLv3 authentication like the Gmail RSS feed URL does?


Isn't this because the atom feed uses HTTP authentication, whereas  
the /mail URL uses a web form? I suspect that Google deliberately do  
not have a version of their webmail that uses HTTP auth. I think this  
is because HTTP auth has to re-send your login credentials with each  
HTTP request, and Google wanted to avoid 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 [EMAIL PROTECTED]


How to include a .c file in a loadable bundle?

2008-08-13 Thread Jesse Grosjean
Feeling pretty dumb here, but I can't seem to include a .c file in my  
loadable bundle target. I get a ton of errors. Is there some trick  
that I'm missing. Here's what I'm doing.


1. Create new Xcode Cocoa Application project.
2. Create new loadable bundle in that project.
3. Add new Carbon C file to the application. Compile. It works.
4. Add new Carbon C file to the bundle. Compile. And I get 1495 errors  
starting with:


Building target “MyBundle” of project “TestApp” with configuration  
“Debug” — (1495 errors)

cd /Users/jesse/Desktop/TestApp
/Developer/usr/bin/gcc-4.0 -x c-header -arch i386 -fmessage- 
length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks - 
O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/ 
MacOSX10.5.sdk -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 - 
iquote /Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/ 
MyBundle.build/MyBundle-generated-files.hmap -I/Users/jesse/Desktop/ 
TestApp/../builds/TestApp.build/Debug/MyBundle.build/MyBundle-own- 
target-headers.hmap -I/Users/jesse/Desktop/TestApp/../builds/ 
TestApp.build/Debug/MyBundle.build/MyBundle-all-target-headers.hmap - 
iquote /Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/ 
MyBundle.build/MyBundle-project-headers.hmap -F/Users/jesse/Desktop/ 
TestApp/../builds/Debug -I/Users/jesse/Desktop/TestApp/../builds/Debug/ 
include -I/Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/ 
MyBundle.build/DerivedSources -c /Developer/SDKs/MacOSX10.5.sdk/System/ 
Library/Frameworks/AppKit.framework/Headers/AppKit.h -o /var/folders/ 
DI/DIMbvaZQFpGmNuaJM2eybk+++TI/-Caches-/com.apple.Xcode.501/ 
SharedPrecompiledHeaders/AppKit-bawztsadvnkohkggpdwhgbqjwsmp/ 
AppKit.h.gch
In file included from /Developer/SDKs/MacOSX10.5.sdk/System/Library/ 
Frameworks/Foundation.framework/Headers/Foundation.h:12,
 from /Developer/SDKs/MacOSX10.5.sdk/System/Library/ 
Frameworks/AppKit.framework/Headers/AppKit.h:10:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Headers/NSObjCRuntime.h:124: error: syntax error  
before '@' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Headers/NSObjCRuntime.h:126: error: syntax error  
before '*' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Headers/NSObjCRuntime.h:127: error: syntax error  
before '*' token

...

Does anyone know what I should do if I want to use code from a .c file  
in my bundle?


Thanks,
Jesse___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's the use of the Z_UUID in the Z_METADATA table?

2008-08-13 Thread Jim Correia

On Aug 13, 2008, at 9:56 AM, Gustavo Vera wrote:


Maybe I should not, but I'm doing it anyway :D
I'm looking inside and also I'm manipulating the structure and data  
of the

sqlite file since about 200 revisions in my project. I'm doing this to
provide newer versions of the app that has the possibility of  
performing
database migrations / upgrades from older versions of the app if  
available.


My recommendation is that if you cannot use the Leopard Core Data  
migrator, that you migrate your data using the Core Data API and not  
work with sqlite directly. It is possible (but tedious) and will  
insulate you from implementation details in the sqlite stores. It also  
will have the advantage that your code should work as-is (or with  
minimal modifications) with other store types.


Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to include a .c file in a loadable bundle?

2008-08-13 Thread Ken Ferry
Perhaps a precompiled headers problem?

See http://www.cocoabuilder.com/archive/message/cocoa/2007/12/19/195207

-Ken

On Wed, Aug 13, 2008 at 10:05 AM, Jesse Grosjean
[EMAIL PROTECTED] wrote:
 Feeling pretty dumb here, but I can't seem to include a .c file in my
 loadable bundle target. I get a ton of errors. Is there some trick that I'm
 missing. Here's what I'm doing.

 1. Create new Xcode Cocoa Application project.
 2. Create new loadable bundle in that project.
 3. Add new Carbon C file to the application. Compile. It works.
 4. Add new Carbon C file to the bundle. Compile. And I get 1495 errors
 starting with:

 Building target MyBundle of project TestApp with configuration Debug —
 (1495 errors)
cd /Users/jesse/Desktop/TestApp
/Developer/usr/bin/gcc-4.0 -x c-header -arch i386 -fmessage-length=0
 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0
 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.5.sdk
 -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -iquote
 /Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/MyBundle-generated-files.hmap
 -I/Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/MyBundle-own-target-headers.hmap
 -I/Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/MyBundle-all-target-headers.hmap
 -iquote
 /Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/MyBundle-project-headers.hmap
 -F/Users/jesse/Desktop/TestApp/../builds/Debug
 -I/Users/jesse/Desktop/TestApp/../builds/Debug/include
 -I/Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/DerivedSources
 -c
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h
 -o
 /var/folders/DI/DIMbvaZQFpGmNuaJM2eybk+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/AppKit-bawztsadvnkohkggpdwhgbqjwsmp/AppKit.h.gch
 In file included from
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12,
 from
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10:
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:124:
 error: syntax error before '@' token
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126:
 error: syntax error before '*' token
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127:
 error: syntax error before '*' token
 ...

 Does anyone know what I should do if I want to use code from a .c file in my
 bundle?

 Thanks,
 Jesse___

 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/kenferry%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to include a .c file in a loadable bundle?

2008-08-13 Thread Jason Coco
You can't use Foundation in a C file... it's an Objective-C framework.  
Use CoreFoundation instead... you're getting these errors because  
Foundation/Foundation.h includes many Object-C statements which won't  
compile in C.


HTH, Jason

On Aug 13, 2008, at 13:05 , Jesse Grosjean wrote:

Feeling pretty dumb here, but I can't seem to include a .c file in  
my loadable bundle target. I get a ton of errors. Is there some  
trick that I'm missing. Here's what I'm doing.


1. Create new Xcode Cocoa Application project.
2. Create new loadable bundle in that project.
3. Add new Carbon C file to the application. Compile. It works.
4. Add new Carbon C file to the bundle. Compile. And I get 1495  
errors starting with:


Building target “MyBundle” of project “TestApp” with configuration  
“Debug” — (1495 errors)

cd /Users/jesse/Desktop/TestApp
   /Developer/usr/bin/gcc-4.0 -x c-header -arch i386 -fmessage- 
length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks  
-O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/ 
MacOSX10.5.sdk -mfix-and-continue -mmacosx-version-min=10.5 - 
gdwarf-2 -iquote /Users/jesse/Desktop/TestApp/../builds/ 
TestApp.build/Debug/MyBundle.build/MyBundle-generated-files.hmap -I/ 
Users/jesse/Desktop/TestApp/../builds/TestApp.build/Debug/ 
MyBundle.build/MyBundle-own-target-headers.hmap -I/Users/jesse/ 
Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/ 
MyBundle-all-target-headers.hmap -iquote /Users/jesse/Desktop/ 
TestApp/../builds/TestApp.build/Debug/MyBundle.build/MyBundle- 
project-headers.hmap -F/Users/jesse/Desktop/TestApp/../builds/Debug - 
I/Users/jesse/Desktop/TestApp/../builds/Debug/include -I/Users/jesse/ 
Desktop/TestApp/../builds/TestApp.build/Debug/MyBundle.build/ 
DerivedSources -c /Developer/SDKs/MacOSX10.5.sdk/System/Library/ 
Frameworks/AppKit.framework/Headers/AppKit.h -o /var/folders/DI/ 
DIMbvaZQFpGmNuaJM2eybk+++TI/-Caches-/com.apple.Xcode.501/ 
SharedPrecompiledHeaders/AppKit-bawztsadvnkohkggpdwhgbqjwsmp/ 
AppKit.h.gch
In file included from /Developer/SDKs/MacOSX10.5.sdk/System/Library/ 
Frameworks/Foundation.framework/Headers/Foundation.h:12,
from /Developer/SDKs/MacOSX10.5.sdk/System/Library/ 
Frameworks/AppKit.framework/Headers/AppKit.h:10:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Headers/NSObjCRuntime.h:124: error: syntax  
error before '@' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Headers/NSObjCRuntime.h:126: error: syntax  
error before '*' token
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Headers/NSObjCRuntime.h:127: error: syntax  
error before '*' token

...

Does anyone know what I should do if I want to use code from a .c  
file in my bundle?


Thanks,
Jesse___

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/jason.coco 
%40gmail.com


This email sent to [EMAIL PROTECTED]




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

NSCollectionView and bindings to text fields in tab view

2008-08-13 Thread Hank Heijink (Mailinglists)

Hi all,

I'm having some trouble figuring out a bindings problem. I've made a  
litle test project that shows the problem (http://www.hankheijink.com/TestTextfieldBindings.zip 
, it's a 64Kb file). This is the structure of the project:


I've got an NSCollectionView wired up so that it gets its content from  
an NSArrayController. The NSArrayController is bound to an  
NSMutableArray in AppController, and the array contains CollectionItem  
objects. A CollectionItem object has one instance variable, value (an  
NSString). Apologies for the meaningless names.


The view of the NSCollectionViewItem contains a tab view with two  
tabs. Both of the tab view items contain a text field, and the value  
of the text field is bound to the keypath representedObject.value of  
the NSCollectionViewItems.


So, I should have a collection view containing views that have a tab  
view with two text fields, bound to the same string value.


Here's the problem: only one of the text fields gets bound, namely the  
one in the default tab. If I change the default tab to the other tab,  
that one gets bound. If I make two instance variables and bind the  
text fields to different ones, the same thing happens: only one of  
them is bound.


Looking around on the list archives, I've found that the bindings of  
NSCollectionView don't always work when set in IB. One suggestion was  
setting the NSArrayController content to nil and back to the mutable  
array in the AppController's awakeFromNib method, but that seems to  
solve a different problem (it didn't think it would solve mine and it  
didn't).


Can someone confirm that this is a bug in NSCollectionView or IB, or  
am I simply doing something wrong? If the former, can someone  
recommend a workaround? Should I, for instance, set the bindings  
programmatically?


Oh, and in case it matters, I'm using Mac OS 10.5.4, Xcode 3.1, and IB  
3.1.


Many thanks,
Hank

Hank Heijink
Columbia University

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSCollectionView and bindings to text fields in tab view

2008-08-13 Thread Gerd Knops


Can someone confirm that this is a bug in NSCollectionView or IB, or  
am I simply doing something wrong? If the former, can someone  
recommend a workaround? Should I, for instance, set the bindings  
programmatically?


I see the same behavior: If a NSTabView is used inside a  
NSCollectionView, only the bindings for the default tab are established.


Another bug is that depending on the somewhat random order IB saves  
bindings in, if the array controller already contains object when the  
nib loads, the bindings may or may not get established. A workaround  
is to briefly set the observed array to nil and back to it's original  
value after the nib was loaded.


Both bugs have been reported, the latter has been confirmed by Apple.

Gerd

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is this how you can use bindings?

2008-08-13 Thread Ron Lue-Sang
Turn off auto-validate for the toolbar button in Interface Builder's  
attributes inspector.


On Aug 13, 2008, at 1:37 AM, Chris Idou wrote:



Ahh I see. That works for a button, but with a toolbar button it  
makes the button flash momentarily, but then stays non-enabled. Any  
ideas?




--- On Tue, 8/12/08, Ron Lue-Sang [EMAIL PROTECTED] wrote:


From: Ron Lue-Sang [EMAIL PROTECTED]
Subject: Re: Is this how you can use bindings?
To: Chris Idou [EMAIL PROTECTED]
Cc: cocoa-dev@lists.apple.com cocoa-dev@lists.apple.com
Date: Tuesday, August 12, 2008, 11:56 PM
The way to think about this is, you bind the value of the
text field
to a controller (or model) object that owns the value.
Then, bind the
enabled binding of the button to the same property of of
the same
controller and use a valuetransformer to check whether the
value is nil.

So your setup should look like:
- TextField value binding bound to yourObject with keypath

yourStringProperty
- button enabled binding bound to yourObject with keypath
yourStringProperty with value transformer NSIsNotNil

You may want to turn on continuously updates
value for the
textfiled's value binding.This way as soon as the user
starts typing,
the enabled state of the button will get toggled.

Note that part of why this works with the value transformer
is because
the textfield value binding sets nil as the value when the
textfield
is emptied.

-
RONZILLA

On Aug 12, 2008, at 11:21 PM, Chris Idou
[EMAIL PROTECTED] wrote:


I want a button to be enabled when myTextField is not

empty.


Can have an outlet in my controller called

myTextField, and then set

the Enabled binding on the button to point

to

myTextField.stringValue.length, then can I write a

transformer

called GreaterThanZero to return boolean if the input

is greater

than zero?

Is that a valid way to go about this problem? It

doesn't seem to be

working for me. I wrote a myTextField accessor to see

what is

happening and it doesn't even seem to get called.






___

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/luesang%40apple.com


This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]



--
RONZILLA



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to include a .c file in a loadable bundle?

2008-08-13 Thread Jesse Grosjean

Perhaps a precompiled headers problem?

See http://www.cocoabuilder.com/archive/message/cocoa/2007/12/19/195207 




Ken,

Thanks, that seems to have been the problem.

Jesse
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Programmatically place cursor within NSTextField

2008-08-13 Thread Dustin Robert Kick
This can also be done with an NSFormatter.  I've only worked through  
one example, long enough ago that I can't give helpful details, but  
you should be able to find an example on how to do something similar  
to what you're trying to do.  I believe the example I looked at  was  
using an NSFormatter to automatically place the dashes in a phone  
number...


Ok, the example I was thinking of was in Cocoa Programming (http://tinyurl.com/cocproggb 
)


There is also Introduction to Data Formatting Programming Guide For  
Cocoa in the Xcode documentation, I'm sure they'll give a pretty good  
example in there.


Dustin  
KC9MEL  


On Aug 13, 2008, at 6:02 AM, [EMAIL PROTECTED] wrote:

How can I programmatically position the cursor to an arbitrary  
position with a NSTextField?


For example, placing a cursor within the parentheses '('...')' of a  
phone number?


Regards,

Ric.
___

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

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

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


This email sent to [EMAIL PROTECTED]




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

Re: Generate back trace programmatically?

2008-08-13 Thread Robert Bell


Hmm, could you generate an exception then look at the back trace in  
the handler? There is some documentation for backtrace handling in  
Exception Programming Topics for Cocoa under Printing Symbolic  
Stack Traces ...


Perhaps there are other ways too ...

Robert.

On Aug 12, 2008, at 4:28 PM, Joseph Kelly wrote:


Hello,

is there a known reliable way to generate a back trace from the  
current point in a given thread's call stack? Like some kind of:


+(NSString*)getCurrentStackTraceInCRDelimitedString;

That would be pretty cool.

Thanks in advance!

Joe K.
___
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list  ([EMAIL PROTECTED] 
)

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/robert.m.a.bell%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


how to implement the auto-complement function like Xcode 3.x?

2008-08-13 Thread Leopard x86

Hi everyone.
After experiment the built-in auto-complement function of Xcode 3.x, I  
am very impressed really, it is so powerful. Thanks for the hard- 
working Apple engineers.
Then here comes the question: how can we implement this function for  
our editor-like application?
Because I am working on an editor project which concerns about the  
user experience,  I think the auto-complement function is an  
indispensable one. Moreover, the Xcode-style of auto-implement is  
exactly what I want. This feature can improve the efficiency and  
productivity of users greatly.


Thank you for help. Any guidance or tutorial is GREATLY appreciated.

Have a good day. :-)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Programmatic removal of an object..

2008-08-13 Thread R T
Using Core Data, my xcdatamodel has 1 entity (NSManagedObject) with 10 
attributes. I need to add and remove the objects programmatically (not by 
buttons). I have...

IBOutlet NSArrayController *ParamsNResults;
IBOutlet NSTableView *ParamsNResultsTableView; 

  ...and have created an object in the tableview with...

[ParamsNResults newObject];

  ...but I can not remove it.

my questions:
1.   Have I created the object correctly/completely?
2.   How do I remove the object?
3.   Can I remove all the objects at once?

Thanks
Rick Tschudin
[EMAIL PROTECTED]


been able to put objects into
Removing all the objects at once is the first thing I need to do


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Programmatic removal of an object..

2008-08-13 Thread Ron Lue-Sang


On Aug 12, 2008, at 10:40 PM, R T wrote:

Using Core Data, my xcdatamodel has 1 entity (NSManagedObject) with  
10 attributes. I need to add and remove the objects programmatically  
(not by buttons). I have...


IBOutlet NSArrayController *ParamsNResults;
IBOutlet NSTableView *ParamsNResultsTableView;

 ...and have created an object in the tableview  
with...


[ParamsNResults newObject];

 ...but I can not remove it.

my questions:
1.   Have I created the object correctly/completely?
2.   How do I remove the object?
3.   Can I remove all the objects at once?

Thanks
Rick Tschudin
[EMAIL PROTECTED]


been able to put objects into
Removing all the objects at once is the first thing I need to do




1) If your arraycontroller is set to use your entity and has a  
managedObjectContext, [arrayController newObject] will create a  
managed object for you properly. The new object will be inserted into  
the controller's managedObjectContext.


If your arraycontroller also has automatically prepares content set  
to YES, then after the object is inserted into the context, the  
arraycontroller will get the managedObjectContext's notification that  
a new object is available. Then the object will be pulled into the  
arraycontroller. Note that this is what would happen even if you  
simply created a new managedObject of the same entity using the  
designated initializer or NSEnityDescription class method.


So the short answer is: Probably, yes.

2) If you really want to remove the objects programmatically, you  
should probably just do it from the managed object context level.


[managedObjectContext deleteObject:theObject]

Again, if you turned on automatically prepares content for the  
arraycontroller, the managedObjectContext notification that is issued  
as a result of the delete (and of the following processPendingChanges)  
is enough for the object to disappear from the arrayController's  
content.


You should also be able to delete the object from the  
arraycontroller's removeObject: or  removeObjectAtArrangedObjectIndex:  
method. You probably don't want programmatically call the remove:  
method which is intended to be invoked as an IBAction - i.e. from a  
button in the UI. If you invoke removeObject: and then check to see if  
the object is gone, you'll be surprised that nothing's changed. The  
add: and remove: methods do their work in the next run through the  
event loop.


3) If you're really working programmatically, I'd suggest just looping  
over the objects and calling

[managedObjectContext deleteObject:]


--
RONZILLA



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: try this for fadebackin

2008-08-13 Thread Fabian
Thanks Tolga. I tried your code but no luck I'm afraid. The only
difference between your code and mine seems to be you have 25 seconds
reservation instead of kCGMaxDisplayReservationInterval (which
shouldn't matter as the max interval is 15 seconds), and set your
fade-in to asynchronous instead of synchronous (TRUE = wait for
completion, not the other way around). But no, I still only have
random success... Any other ideas?

Thanks.

On Wed, Aug 13, 2008 at 8:07 PM, Tolga Katas [EMAIL PROTECTED] wrote:
 - (void)fadeOut:(float)seconds
 {
 err = CGAcquireDisplayFadeReservation (25, tokenPtr);
 CGDisplayFade (tokenPtr,
   seconds,// 1 second
   kCGDisplayBlendNormal,  // start
   kCGDisplayBlendSolidColor,  // end
   0.0, 0.0, 0.0,  // black
   TRUE   // don't wait to finish
   );



 }
 - (void)fadeBackIn:(float)seconds
 {

 CGDisplayFade (
   tokenPtr,
   seconds,
   kCGDisplayBlendSolidColor,
   kCGDisplayBlendNormal,
   0.0, 0.0, 0.0,
   FALSE
   );

 err = CGReleaseDisplayFadeReservation (tokenPtr);
 }

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Bindings. weird behavior.

2008-08-13 Thread Sandro Noel

Chris
Thank you for your time.

I'm sorry for the entity names, force of habit anything that holds  
more than one record is plural to me.
I'll correct them when all the problems are weeded out, I don't want  
to add to my current troubles.


My model is EXACTLY the same as what you described.
next time i'll put in the same info.

Sandro.



On 13-Aug-08, at 2:13 AM, Chris Hanson wrote:


On Aug 12, 2008, at 8:10 PM, Sandro Noel wrote:


I have these entities, with these attributes and relationships.

entity: Transactions
attributes: field1, field2
relationship : transactionType

entity: TransactionTypes
attributes: field1, field2
relationship : transaction


This still looks incorrect to me.  As we previously explained,  
entity names should be singular.  Also, what is the cardinality of  
your relationships -- are they to-one or to-many?  And what are your  
relationships' inverses?


I'd describe it like this:

 entity: Transaction
 attributes: field1, field2
 relationships:
   transactionType (required to-one to TransactionType, inverse  
transactions)


 entity: TransactionType
 attributes: field1, field2
 relationship:
   transactions (optional to-many to Transaction, inverse  
transactionType)


Having the proper cardinality and inverses set for your  
relationships is important, because that tells Core Data how the  
structure of the underlying storage needs to be arranged.


How close to what I've put above is your data model?


the problem i get is that if i select a value from that list,
all the transactions that were of the same type of the one i am  
trying ti change

get changed as well, not just the one row I am trying to change.


That typically means you have a to-one inverse relationship where  
you need a to-many.


 -- Chris



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to implement the auto-complement function like Xcode 3.x?

2008-08-13 Thread j o a r


On Aug 12, 2008, at 8:24 PM, Leopard x86 wrote:

Then here comes the question: how can we implement this function for  
our editor-like application?
Because I am working on an editor project which concerns about the  
user experience,  I think the auto-complement function is an  
indispensable one. Moreover, the Xcode-style of auto-implement is  
exactly what I want. This feature can improve the efficiency and  
productivity of users greatly.



Have a look at the NSTextView - 
textView:completions:forPartialWordRange:indexOfSelectedItem:  
delegate method.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTypesetter layoutParagraphAtPoint:

2008-08-13 Thread chaitanya pandit

Thanks Aki, that what exactly what i was looking for.
Is there any documentation that describes other essential attributes  
that i need to set?

Thanks again,
Chaitanya

On 13-Aug-08, at 12:38 AM, Aki Inoue wrote:

You need to specify all essential glyph attributes for  
NSLayoutManager.


In this case, you're not specifying the not shown attribute for  
the attachment.  Attachment glyph should not be shown.


Aki

On 2008/08/12, at 19:54, chaitanya pandit wrote:


Hello,
Well i've been struggling with this for quite a while and would  
appreciate if anyone could point me in the right direction.
I am trying to implement a custom NSTypesetter, to start with i  
just want to lay 2 characters, an A and an inline image, thats it.
The character A gets drawn properly, but there is some problem  
with the inLine image. I see a small square besides the inLine image.


Here is what i am doing in my custom NSTypesetter class, which i  
have hard coded to draw just the two glyphs:


- (NSUInteger)layoutParagraphAtPoint: 
(NSPointPointer)lineFragmentOrigin

{
// Begin para
[self beginParagraph];

// Begin Line
[self beginLineWithGlyphAtIndex:0];

// Start at 0,0 (the size of the inLine image is (53, 57))
NSRect r = NSMakeRect(0, 0, 100, 57);
NSPoint loc = NSMakePoint(0, 0);

// Set the line fragment rectangle for the entire glyph range
	[super setLineFragmentRect:r forGlyphRange:NSMakeRange(0, 2)  
usedRect:r baselineOffset:57];

// Set the location for A
	[super setLocation:loc withAdvancements:0  
forStartOfGlyphRange:NSMakeRange(0, 1)];

// Set the attachment size for the inLine image
	[super setAttachmentSize:NSMakeSize(53, 57)  
forGlyphRange:NSMakeRange(1, 1)];

// Position the image a bit further on the right of A
loc = NSMakePoint(21, 0);
	[super setLocation:loc withAdvancements:0  
forStartOfGlyphRange:NSMakeRange(1, 1)];


// End line
[self endLineWithGlyphRange:NSMakeRange(0, 2)];

// End para
[self endParagraph];

return 2;
}

Thanks,
Chaitanya
___

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/aki%40apple.com

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Bindings. weird behavior.

2008-08-13 Thread Quincey Morris

On Aug 12, 2008, at 20:10, Sandro Noel wrote:


I have these entities, with these attributes and relationships.

entity: Transactions
attributes: field1, field2
relationship : transactionType

entity: TransactionTypes
attributes: field1, field2
relationship : transaction

In interface builder I have two array controller bound to these  
entities,
the tableview columns are bound to the field1 and field2 and  
transactionType


the transaction type is bound to a column in the table view with the  
keypath, transactionType.field1

witch displays the name of the transaction type properly.
if i set it to just transactionType, i get a crash, i guess because  
it's a relationship...


now, in the transactionType column the cell is a combo box, bound to  
transactionTypes array. witch gives me

a drop down list of all the transaction Types available.

the problem i get is that if i select a value from that list,
all the transactions that were of the same type of the one i am  
trying ti change

get changed as well, not just the one row I am trying to change.

So let's say i have 15 transactions of type DEBIT and i change the  
first one ot CREDIT, all the 14 other ones get changed along with  
it


When the column's cell is a combo box cell, the column has 3 bindings  
instead of 1 (content, contentValues and value). What are your  
bindings set to?. It's not going to work properly unless you you set  
all 3 bindings properly.


Also, make sure you set the bindings of the column, not the cell.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's the use of the Z_UUID in the Z_METADATA table?

2008-08-13 Thread Louis Gerbarg
Performing migrations by altering the underlying structure of files you do
not understand will most likely result in data corruption. Even if the file
appears to work correctly now, that does not mean it is correct, and it does
not mean that it will continue to work in the future, especially if you have
violated any assumption that future schema migrators make about the DB file.
Louis

On Wed, Aug 13, 2008 at 9:56 AM, Gustavo Vera [EMAIL PROTECTED] wrote:

 Maybe I should not, but I'm doing it anyway :D
 I'm looking inside and also I'm manipulating the structure and data of the
 sqlite file since about 200 revisions in my project. I'm doing this to
 provide newer versions of the app that has the possibility of performing
 database migrations / upgrades from older versions of the app if available.
 With the new functionalities, occasionally a change in the database
 structure results necessary, and when the change is simple (for example,
 just adding a new attribute to an entity) altering the data model and the
 data structures in an old sqlite is far easier and faster than implementing
 the migration functionality suggested in the documentation. In fact, I
 think
 this is faster and easier even when more complex changes are necessary.
 Anyway... I was wondering if I should take care of the Z_UUID during the
 perform of this upgrades, or if I can just ignore it. I'm currently
 ignoring
 it... can this become a problem in the future?


 On Tue, 12 Aug 2008 17:28:39 -0300, Marcelo Alves
 [EMAIL PROTECTED] wrote:

 
   It is a implementation detail. You should not look inside the sqlite
 file.
 
  2008/8/12 Gustavo Vera [EMAIL PROTECTED]:
   What's the use of the Z_UUID in the Z_METADATA table?
   Is some kind of check sum or something like that?
   CoreData uses this value for something?
   Why is this value different every time the DB is regenerated?
   Is the generation of it a random-based one? Or is it based on
   random+another thing?
  
   Please don't answer my question with another question!!! At least not
 at
   first instance! :D
  
   Thanks in advance!
 
 ___

 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/lgerbarg%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Bindings. weird behavior.

2008-08-13 Thread Sandro Noel

Quincey, thank you

the colums is bound with Value, transaction.transactiontype.name
the combo box is content bound to a array controller that manages the  
items i want to choose from in the combo box. as content values  
(transactionTypes) name.


I did not know about the content binding.

how should i go about this... ?



On 13-Aug-08, at 5:24 PM, Quincey Morris wrote:


On Aug 12, 2008, at 20:10, Sandro Noel wrote:


I have these entities, with these attributes and relationships.

entity: Transactions
attributes: field1, field2
relationship : transactionType

entity: TransactionTypes
attributes: field1, field2
relationship : transaction

In interface builder I have two array controller bound to these  
entities,
the tableview columns are bound to the field1 and field2 and  
transactionType


the transaction type is bound to a column in the table view with  
the keypath, transactionType.field1

witch displays the name of the transaction type properly.
if i set it to just transactionType, i get a crash, i guess because  
it's a relationship...


now, in the transactionType column the cell is a combo box, bound  
to transactionTypes array. witch gives me

a drop down list of all the transaction Types available.

the problem i get is that if i select a value from that list,
all the transactions that were of the same type of the one i am  
trying ti change

get changed as well, not just the one row I am trying to change.

So let's say i have 15 transactions of type DEBIT and i change the  
first one ot CREDIT, all the 14 other ones get changed along with  
it


When the column's cell is a combo box cell, the column has 3  
bindings instead of 1 (content, contentValues and value). What are  
your bindings set to?. It's not going to work properly unless you  
you set all 3 bindings properly.


Also, make sure you set the bindings of the column, not the cell.


___

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/sandro.noel%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Bindings. weird behavior.

2008-08-13 Thread Sandro Noel

ha!
what i found out is that since i'm using the  transactionType.name to  
display the value of the relationship
instead of updating the relationship to that row, the bindings update  
the name of the transactionType item
in the database, so all the rows using that use that item also get  
renamed, well because the reference object got renamed.


how do i get it to update the relationship instead of just updating  
the display name.





On 13-Aug-08, at 5:24 PM, Quincey Morris wrote:


On Aug 12, 2008, at 20:10, Sandro Noel wrote:


I have these entities, with these attributes and relationships.

entity: Transactions
attributes: field1, field2
relationship : transactionType

entity: TransactionTypes
attributes: field1, field2
relationship : transaction

In interface builder I have two array controller bound to these  
entities,
the tableview columns are bound to the field1 and field2 and  
transactionType


the transaction type is bound to a column in the table view with  
the keypath, transactionType.field1

witch displays the name of the transaction type properly.
if i set it to just transactionType, i get a crash, i guess because  
it's a relationship...


now, in the transactionType column the cell is a combo box, bound  
to transactionTypes array. witch gives me

a drop down list of all the transaction Types available.

the problem i get is that if i select a value from that list,
all the transactions that were of the same type of the one i am  
trying ti change

get changed as well, not just the one row I am trying to change.

So let's say i have 15 transactions of type DEBIT and i change the  
first one ot CREDIT, all the 14 other ones get changed along with  
it


When the column's cell is a combo box cell, the column has 3  
bindings instead of 1 (content, contentValues and value). What are  
your bindings set to?. It's not going to work properly unless you  
you set all 3 bindings properly.


Also, make sure you set the bindings of the column, not the cell.


___

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/sandro.noel%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Bindings. weird behavior.

2008-08-13 Thread Quincey Morris

On Aug 13, 2008, at 15:19, Sandro Noel wrote:


the colums is bound with Value, transaction.transactiontype.name
the combo box is content bound to a array controller that manages  
the items i want to choose from in the combo box. as content values  
(transactionTypes) name.



Try this:

Set the column's content binding to the transaction types array  
controller, controller key arrangedObjects, model key blank or self.


Set the column's contentValues binding to the transaction types  
array controller, controller key arrangedObjects, model key field1.


Set the column's value binding to the transactions (not transaction  
types) array controller, controller key arrangedObjects, model key  
transactionType.field1.


Don't bind the combo box cell's bindings to anything -- that's done  
automatically for you every time the cell is used.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get array of characters from NSString

2008-08-13 Thread Ross Carter


On Aug 12, 2008, at 2:04 PM, Andy Lee wrote:


This is also good:

http://icu-project.org/userguide/unicodeBasics.html


I found this much clearer and better-written than the first document  
you referenced.  It defines terms and concepts in an orderly  
progression.  But I would have found it drier and more difficult if  
I hadn't read Spolsky first.  Unless Spolsky is plainly,  
misleadingly, dangerously wrong about something, I would recommend  
his article first for anyone (like me) who needs to bone up on this  
stuff.




There's also an Apple Tech Note, TN 2078, that gives a very brief but  
comprehensible explanation of characters, code points, BMP, surrogate  
pairs, combining marks, and grapheme clusters.http://developer.apple.com/technotes/tn2002/tn2078.html#FSREFSANDLONGNAMES


I think I'll file a documentation bug on characterAtIndex: requesting  
that it contain a reference to  
rangeOfComposedCharacterSequenceAtIndex:, or alternatively that the  
String Programming Guide For Cocoa explain the hazard of relying on  
characterAtIndex:.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controlling line-breaking in a text view

2008-08-13 Thread Ross Carter


On Aug 12, 2008, at 9:07 PM, Ken Ferry wrote:


Hi Andy,

I'm still not familiar with the text system, so I don't know if the
proxy was a good way to do this.


The basics of subclassing NSTextStorage are described here:
http://www.cocoabuilder.com/archive/message/cocoa/2002/2/5/14848
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTypesetter layoutParagraphAtPoint:

2008-08-13 Thread Aki Inoue
Each glyph should have the location, not shown, draws outside line  
fragment, and bidi level in order for NSLayoutManager to properly  
render.
Usually the default values for attributes other than the location is  
fine.


Please file a bug for documentation enhancement.

Thanks,

Aki

On 2008/08/13, at 14:04, chaitanya pandit wrote:


Thanks Aki, that what exactly what i was looking for.
Is there any documentation that describes other essential attributes  
that i need to set?

Thanks again,
Chaitanya

On 13-Aug-08, at 12:38 AM, Aki Inoue wrote:

You need to specify all essential glyph attributes for  
NSLayoutManager.


In this case, you're not specifying the not shown attribute for  
the attachment.  Attachment glyph should not be shown.


Aki

On 2008/08/12, at 19:54, chaitanya pandit wrote:


Hello,
Well i've been struggling with this for quite a while and would  
appreciate if anyone could point me in the right direction.
I am trying to implement a custom NSTypesetter, to start with i  
just want to lay 2 characters, an A and an inline image, thats it.
The character A gets drawn properly, but there is some problem  
with the inLine image. I see a small square besides the inLine  
image.


Here is what i am doing in my custom NSTypesetter class, which i  
have hard coded to draw just the two glyphs:


- (NSUInteger)layoutParagraphAtPoint:(NSPointPointer) 
lineFragmentOrigin

{
// Begin para
[self beginParagraph];

// Begin Line
[self beginLineWithGlyphAtIndex:0];

// Start at 0,0 (the size of the inLine image is (53, 57))
NSRect r = NSMakeRect(0, 0, 100, 57);
NSPoint loc = NSMakePoint(0, 0);

// Set the line fragment rectangle for the entire glyph range
	[super setLineFragmentRect:r forGlyphRange:NSMakeRange(0, 2)  
usedRect:r baselineOffset:57];

// Set the location for A
	[super setLocation:loc withAdvancements:0  
forStartOfGlyphRange:NSMakeRange(0, 1)];

// Set the attachment size for the inLine image
	[super setAttachmentSize:NSMakeSize(53, 57)  
forGlyphRange:NSMakeRange(1, 1)];

// Position the image a bit further on the right of A
loc = NSMakePoint(21, 0);
	[super setLocation:loc withAdvancements:0  
forStartOfGlyphRange:NSMakeRange(1, 1)];


// End line
[self endLineWithGlyphRange:NSMakeRange(0, 2)];

// End para
[self endParagraph];

return 2;
}

Thanks,
Chaitanya
___

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/aki%40apple.com

This email sent to [EMAIL PROTECTED]






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Bindings. weird behavior.

2008-08-13 Thread Sandro Noel

Quincey
Again thank you!

I did just that, 12 seconds before receiving your mail, so i'm glad  
i'm not totaly lost:)
but the value still get's changed wrong, instead of changing the  
relationship object it changes the display name of that object.


transactionType.name

I've tried to have the column value set to transactionType, but the I  
get
*** -[NSManagedObject copyWithZone:]: unrecognized selector sent to  
instance 0x155987b0

Grrr...

so i guess I should focus on trying to get it to change the  
relationship object instead of it's display name.
is there a way to do that with bindings, or will i have to do it  
manually ?


Thank you !
Sandro,


On 13-Aug-08, at 6:37 PM, Quincey Morris wrote:


On Aug 13, 2008, at 15:19, Sandro Noel wrote:


the colums is bound with Value, transaction.transactiontype.name
the combo box is content bound to a array controller that manages  
the items i want to choose from in the combo box. as content values  
(transactionTypes) name.



Try this:

Set the column's content binding to the transaction types array  
controller, controller key arrangedObjects, model key blank or  
self.


Set the column's contentValues binding to the transaction types  
array controller, controller key arrangedObjects, model key  
field1.


Set the column's value binding to the transactions (not  
transaction types) array controller, controller key  
arrangedObjects, model key transactionType.field1.


Don't bind the combo box cell's bindings to anything -- that's done  
automatically for you every time the cell is used.



___

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/sandro.noel%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Accessing memory of another application?

2008-08-13 Thread has

Josh wrote:

I'm trying to get started w/viewing/editing/interacting with the  
memory of
another running application but I'm not where to get started.  You  
could
think of this as being a simple game trainer - which basically  
allows you

to view and edit values in memory.


Use a formal IPC mechanism to communicate between two processes.  
There's an overview of available options at:


http://developer.apple.com/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemTechnology/chapter_3_section_5.html

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

This email sent to [EMAIL PROTECTED]


compile error when protocol not implemented?

2008-08-13 Thread Rua Haszard Morris
I'd like to get an error, not just a warning, when I pass an instance  
of a class to a method that takes a parameter conforming to some  
protocol, and the passed object does not implement the protocol. Is  
this possible? Is there a good way to set things up so an error is  
generated.. or is there some dynamism reason why a warning is more  
suited?


e.g. for this code

@protocol MyProtocol
//...
@end

// (some class)
-(void)doSomethingWithProtocol:(id MyProtocol)proto;

@interface BobClientClass : NSObject // does not even attempt to  
implement MyProtocol!


@end

// some code somewhere where I want an error
BobClientClass* bob;
[someClass doSomethingWithProtocol:bob]; // generates warning

instead of this warning

warning: class 'BobClientClass' does not implement the 'MyProtocol'  
protocol'


get an error something like

error: class 'BobClientClass' does not implement the 'MyProtocol'  
protocol'


thanks
Rua HM.
___

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

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

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

This email sent to [EMAIL PROTECTED]


@property and @synthesize not working

2008-08-13 Thread Nathan Gilmore

Hello everyone,

I am a newbie and I am having trouble getting my setter to work when I  
use @synthesize.  Here is the code:


**Header File**

@interface DayTaskController : NSArrayController {

NSCalendarDate *searchDate;

}
- (void)search:(id)sender;

@property(readwrite, assign) NSCalendarDate *searchDate;

@end

**Implementation File**
@implementation DayTaskController

@synthesize searchDate;
@synthesize appController;
.
.
.

**AppController**
I try and just set the searchdate field and then output it:

- (id) init
{
[super init];

[self setDayOneDate:[NSCalendarDate calendarDate]];
NSLog(@self dayOneDate = %@,dayOneDate);
[dayOneTasks setSearchDate:dayOneDate];
NSLog(@dayOneTasks search date = %@, [dayOneTasks searchDate]);
return self;
}

The above code gives this output:
2008-08-13 21:30:23.081 LifeTask2[20085:10b] self dayOneDate =  
2008-08-13 21:30:23 -0400
2008-08-13 21:30:23.082 LifeTask2[20085:10b] dayOneTasks search date =  
(null)


Any suggestions as to what I am doing wrong?

Thank you!
Nathan

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: @property and @synthesize not working

2008-08-13 Thread Andrew Merenbach

On Aug 13, 2008, at 6:47 PM, Nathan Gilmore wrote:


Hello everyone,

I am a newbie and I am having trouble getting my setter to work when  
I use @synthesize.  Here is the code:


**Header File**

@interface DayTaskController : NSArrayController {

NSCalendarDate *searchDate;

}
- (void)search:(id)sender;

@property(readwrite, assign) NSCalendarDate *searchDate;

@end

**Implementation File**
@implementation DayTaskController

@synthesize searchDate;
@synthesize appController;
.
.
.

**AppController**
I try and just set the searchdate field and then output it:

- (id) init
{
[super init];

[self setDayOneDate:[NSCalendarDate calendarDate]];
NSLog(@self dayOneDate = %@,dayOneDate);
[dayOneTasks setSearchDate:dayOneDate];
NSLog(@dayOneTasks search date = %@, [dayOneTasks searchDate]);
return self;
}

The above code gives this output:
2008-08-13 21:30:23.081 LifeTask2[20085:10b] self dayOneDate =  
2008-08-13 21:30:23 -0400
2008-08-13 21:30:23.082 LifeTask2[20085:10b] dayOneTasks search date  
= (null)


Any suggestions as to what I am doing wrong?

Thank you!
Nathan



Hi, Nathan!

Have you checked to ensure that dayOneTasks itself is not nil?  Also,  
are you using Garbage Collection?  If *not*, then try changing from  
assign to retain in your property declaration.


Also, a couple of suggestions: be sure to write your first line as  
self = [super init]; (instead of [super init]; by itself).   
Additionally, you may wish to consider using the standard property  
syntax, such as:



dayOneTasks.searchDate = dayOneDate;



NSLog(@dayOneTasks search date = %@, dayOneTasks.searchDate);



-- instead of using the bracketed accessors.  That's one reason, in my  
opinion, that properties are a good idea -- they can simplify syntax  
and/or improve readability for certain cases.


Cheers,
Andrew


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

Re: DICOM images in Cocoa

2008-08-13 Thread Ken Ferry
Hi Thomas,

ImageIO is not extensible, so far as I know, except that I know it
will fall back to QuickTime in some cases, and I'm not sure if the
fallback types might be determined dynamically.

Cocoa has filter services, but I'm not familiar with them.  I'll
probably need to be at some point.

http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbFilters.html

-Ken
Cocoa Frameworks

On Wed, Aug 13, 2008 at 4:49 AM, Thomas Engelmeier
[EMAIL PROTECTED] wrote:

 Am 13.08.2008 um 10:55 schrieb Ken Ferry:

 Implementing an NSImageRep subclass is pretty similar to implementing
 a custom view.

 Is there an similar concept of QuickTime Graphics Importers, i.e. system
 wide extensible formats ImageIO and / or NSImage can handle, possible?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Allowing menu item selection in a modal session

2008-08-13 Thread Matt Neuburg
On Wed, 13 Aug 2008 15:11:47 +0800 (WST), [EMAIL PROTECTED] said:
Hi,

I have an application that sometimes runs a modal window (entered via
[NSApplication runModalForWindow:]).  During this modal session, I'd like
to allow the user to select a menu item (namely, the Quit item),
however, all menu items are automatically disabled when the modal session
is entered.

Is there any way to keep a menu item enabled during a modal session?

In the case of the Quit item, since this is connected directly to the app
object, you will have to subclass the application class, declare your
subclass as the target's primary class, and in your subclass implement
validateMenuItem and worksWhenModal. See, always see:

http://www.cocoabuilder.com/archive/message/cocoa/2004/10/7/119051

m.


-- 
matt neuburg, phd = [EMAIL PROTECTED], http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: @property and @synthesize not working

2008-08-13 Thread Nathan Gilmore

Hi Andrew,

Thanks so much for your quick response and all of the great tips!

You were right.  dayOneTasks was nil.

I am a little confused about how this works with Interface Builder.   
In MainMenu.nib, I have a DayOneTasks Controller.  It's class is set  
to DayTaskController.


I also have the outlet for AppController.dayOneTasks set to the  
DayOneTasks Controller Object in the nib file. So, I guess by doing  
that, AppController.dayOneTasks still does not get initialized unless  
I call the alloc and init methods?


Thank you,
Nathan

On Aug 13, 2008, at 9:55 PM, Andrew Merenbach wrote:


On Aug 13, 2008, at 6:47 PM, Nathan Gilmore wrote:


Hello everyone,

I am a newbie and I am having trouble getting my setter to work  
when I use @synthesize.  Here is the code:


**Header File**

@interface DayTaskController : NSArrayController {

NSCalendarDate *searchDate;

}
- (void)search:(id)sender;

@property(readwrite, assign) NSCalendarDate *searchDate;

@end

**Implementation File**
@implementation DayTaskController

@synthesize searchDate;
@synthesize appController;
.
.
.

**AppController**
I try and just set the searchdate field and then output it:

- (id) init
{
[super init];

[self setDayOneDate:[NSCalendarDate calendarDate]];
NSLog(@self dayOneDate = %@,dayOneDate);
[dayOneTasks setSearchDate:dayOneDate];
NSLog(@dayOneTasks search date = %@, [dayOneTasks searchDate]);
return self;
}

The above code gives this output:
2008-08-13 21:30:23.081 LifeTask2[20085:10b] self dayOneDate =  
2008-08-13 21:30:23 -0400
2008-08-13 21:30:23.082 LifeTask2[20085:10b] dayOneTasks search  
date = (null)


Any suggestions as to what I am doing wrong?

Thank you!
Nathan



Hi, Nathan!

Have you checked to ensure that dayOneTasks itself is not nil?   
Also, are you using Garbage Collection?  If *not*, then try changing  
from assign to retain in your property declaration.


Also, a couple of suggestions: be sure to write your first line as  
self = [super init]; (instead of [super init]; by itself).   
Additionally, you may wish to consider using the standard property  
syntax, such as:



dayOneTasks.searchDate = dayOneDate;



NSLog(@dayOneTasks search date = %@, dayOneTasks.searchDate);



-- instead of using the bracketed accessors.  That's one reason, in  
my opinion, that properties are a good idea -- they can simplify  
syntax and/or improve readability for certain cases.


Cheers,
Andrew


___

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

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

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

This email sent to [EMAIL PROTECTED]


Does NSNotificationCenter have zeroing weak references to observers ?

2008-08-13 Thread Erik Buck

Does NSNotificationCenter use zeroing weak references to observers ?

I want to say When using Cocoa’s automated memory garbage collection,  
NSNotificationCenter automatically un-registers observers that are no  
longer in use somewhere else in the application.  I'm just not sure  
it's true.  Can anyone save me the time of writing a test  
application?  In my test program, how can I tell the difference  
between an observer for which the NSNotificationCenter has a strong  
reference and an observer that is about to be finalized but hasn't  
been yet ?  Is this the classic halting problem?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: @property and @synthesize not working

2008-08-13 Thread Andrew Merenbach

Hi, Nathan,

Ah!  I have a suggestion, but there's one thing that I forgot: as a  
*general* rule of thumb for *most* init methods, do not do anything  
between self = [super init]; and return self; that isn't in a  
conditional to test the validity of self -- that is to say:


- (id)init {
self = [super init];
if (self) {
// do stuff here
}
return self;
}

This helps with avoiding various problems, such was wasted code  
execution and potential crashes, if super's -init method returns nil.


Now, on to your problem:

If you have a connection set in Interface Builder, the outlet won't  
generally be available until -awakeFromNib gets called in the  
controller -- rather than -init.  Thus you may wish to do the  
following (warning, typed in Mail):


- (id)init {
self = [super init];
if (self) {
		[self setDayOneDate:[NSCalendarDate calendarDate]];	// you may wish  
to use a property for this accessor, too, if you don't already

}
return self;
}

- (void)awakeFromNib {
dayOneTasks.searchDate = [self dayOneDate];
}

-- that should do the trick, assuming that everything's wired up  
properly in Interface Builder.


One other thing, though: it is my understanding that NSCalendarDate  
will likely be deprecated in a future release of Mac OS X.  This, from  
the docs:


Important: Use of NSCalendarDate strongly discouraged. It is not  
deprecated yet, however it may be in the next major OS release after  
Mac OS X v10.5. For calendrical calculations, you should use  
suitable combinations of NSCalendar, NSDate, and NSDateComponents,  
as described in Calendars in Dates and Times Programming Topics for  
Cocoa.



Instead, one may wish to use a combination of NSDate and NSCalendar.   
The archives have had periodic posts on the topic.


Cheers,
Andrew

On Aug 13, 2008, at 7:27 PM, Nathan Gilmore wrote:


Hi Andrew,

Thanks so much for your quick response and all of the great tips!

You were right.  dayOneTasks was nil.

I am a little confused about how this works with Interface Builder.   
In MainMenu.nib, I have a DayOneTasks Controller.  It's class is set  
to DayTaskController.


I also have the outlet for AppController.dayOneTasks set to the  
DayOneTasks Controller Object in the nib file. So, I guess by doing  
that, AppController.dayOneTasks still does not get initialized  
unless I call the alloc and init methods?


Thank you,
Nathan

On Aug 13, 2008, at 9:55 PM, Andrew Merenbach wrote:


On Aug 13, 2008, at 6:47 PM, Nathan Gilmore wrote:


Hello everyone,

I am a newbie and I am having trouble getting my setter to work  
when I use @synthesize.  Here is the code:


**Header File**

@interface DayTaskController : NSArrayController {

NSCalendarDate *searchDate;

}
- (void)search:(id)sender;

@property(readwrite, assign) NSCalendarDate *searchDate;

@end

**Implementation File**
@implementation DayTaskController

@synthesize searchDate;
@synthesize appController;
.
.
.

**AppController**
I try and just set the searchdate field and then output it:

- (id) init
{
[super init];

[self setDayOneDate:[NSCalendarDate calendarDate]];
NSLog(@self dayOneDate = %@,dayOneDate);
[dayOneTasks setSearchDate:dayOneDate];
NSLog(@dayOneTasks search date = %@, [dayOneTasks searchDate]);
return self;
}

The above code gives this output:
2008-08-13 21:30:23.081 LifeTask2[20085:10b] self dayOneDate =  
2008-08-13 21:30:23 -0400
2008-08-13 21:30:23.082 LifeTask2[20085:10b] dayOneTasks search  
date = (null)


Any suggestions as to what I am doing wrong?

Thank you!
Nathan



Hi, Nathan!

Have you checked to ensure that dayOneTasks itself is not nil?   
Also, are you using Garbage Collection?  If *not*, then try  
changing from assign to retain in your property declaration.


Also, a couple of suggestions: be sure to write your first line as  
self = [super init]; (instead of [super init]; by itself).   
Additionally, you may wish to consider using the standard property  
syntax, such as:



dayOneTasks.searchDate = dayOneDate;



NSLog(@dayOneTasks search date = %@, dayOneTasks.searchDate);



-- instead of using the bracketed accessors.  That's one reason, in  
my opinion, that properties are a good idea -- they can simplify  
syntax and/or improve readability for certain cases.


Cheers,
Andrew






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

Re: compile error when protocol not implemented?

2008-08-13 Thread Michael Ash
On Wed, Aug 13, 2008 at 8:39 PM, Rua Haszard Morris
[EMAIL PROTECTED] wrote:
 I'd like to get an error, not just a warning, when I pass an instance of a
 class to a method that takes a parameter conforming to some protocol, and
 the passed object does not implement the protocol. Is this possible? Is
 there a good way to set things up so an error is generated.. or is there
 some dynamism reason why a warning is more suited?

As far as I know, there's no way to make this one thing into an error.

Objective-C is based around the idea of duck typing. This is just a
funny way of saying that the type of an object is irrelevant. All that
matters is what methods it implements (i.e. what it can do; if it
looks like a duck, quacks like a duck, then it's a duck). As such,
*all* static typing information in an Objective-C program is strictly
advisory in nature. Code like this is perfectly legal, although weird:

NSString *array = [NSArray arrayWithObject:@hello];
NSLog(@%@, [array lastObject]);

Now, protocols are supposed to *be* an indicator of capabilities
rather than of type, but the same principle still applies to the use
of protocols as part of static types. For example, you could implement
the protocol methods without actually declaring conformance to the
protocol.

That said, good code should compile with no warnings anyway. I don't
treat warnings much differently from errors. Occasionally I will
tolerate a warning during development, for expediency or to denote
something that I need to change later, and I am occasionally forced to
accept warnings in external code that I didn't write but that I
compile, but overall I treat warnings the same as errors, so the
difference is not all that important to you.

If you follow this approach but still want an actual stop-the-compile
*error*, then you may be interested in the -Werror flag. This turns
*all* warnings into errors, not just this one, but then again that may
very well be a good thing.

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


Re: @property and @synthesize not working

2008-08-13 Thread Michael Ash
On Wed, Aug 13, 2008 at 10:27 PM, Nathan Gilmore [EMAIL PROTECTED] wrote:
 Hi Andrew,

 Thanks so much for your quick response and all of the great tips!

 You were right.  dayOneTasks was nil.

 I am a little confused about how this works with Interface Builder.  In
 MainMenu.nib, I have a DayOneTasks Controller.  It's class is set to
 DayTaskController.

 I also have the outlet for AppController.dayOneTasks set to the DayOneTasks
 Controller Object in the nib file. So, I guess by doing that,
 AppController.dayOneTasks still does not get initialized unless I call the
 alloc and init methods?

The problem is just that your code is running too early.

IBOutlets are connected after your class is alloc/inited. If you think
about it, this is how it must be: they cannot be connected *before*
that, because nothing exists to connect them *to*.

Happily, Apple (or rather, NeXT) anticipated this problem and provided
a solution: you can put initialization code that depends on
IBOutlets being properly connected in an -awakeFromNib method and that
code will be called after outlets are connected but before control is
returned to the nib loader.

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


Re: What's the use of the Z_UUID in the Z_METADATA table?

2008-08-13 Thread Gustavo Vera
Well, I´m aware that problems in the future are a possibility with the
approach I choose to take. That´s the reason why I´m trying to take all the
cares I can to avoid those future problems as much as I can. In the mean
time, I´m winning a lot of time by avoiding using or implementing the
possible but tedious (I´m citing Jim Correia here) migration
functionalities using the Core Data API directly. I know the advantages and
disadvantages, and I´m ready to pay the price when that moment arives. I´m
aware that I don´t have a full understand of the underlying sqlite
structure, but I know (and learned) enough to keep using my approach. I´m
just trying to increase my knowledge to extend in time my capacity of using
the current approach.

Does anybody know if the original designers of  the underlying sqlite
structure are available to clarify some details about it? Just in case?

By the way, thanks for the Leopard Core Data migrator info, I´m gonna check
that when the moment of porting to Leopard arrives (for the moment, we are
developing this app on and for Tiger only).

Thanks to everybody for your suggestions!

On Wed, Aug 13, 2008 at 6:49 PM, Louis Gerbarg [EMAIL PROTECTED] wrote:

 Performing migrations by altering the underlying structure of files you do
 not understand will most likely result in data corruption. Even if the file
 appears to work correctly now, that does not mean it is correct, and it does
 not mean that it will continue to work in the future, especially if you have
 violated any assumption that future schema migrators make about the DB file.
 Louis

 On Wed, Aug 13, 2008 at 9:56 AM, Gustavo Vera [EMAIL PROTECTED]wrote:

 Maybe I should not, but I'm doing it anyway :D
 I'm looking inside and also I'm manipulating the structure and data of the
 sqlite file since about 200 revisions in my project. I'm doing this to
 provide newer versions of the app that has the possibility of performing
 database migrations / upgrades from older versions of the app if
 available.
 With the new functionalities, occasionally a change in the database
 structure results necessary, and when the change is simple (for example,
 just adding a new attribute to an entity) altering the data model and the
 data structures in an old sqlite is far easier and faster than
 implementing
 the migration functionality suggested in the documentation. In fact, I
 think
 this is faster and easier even when more complex changes are necessary.
 Anyway... I was wondering if I should take care of the Z_UUID during the
 perform of this upgrades, or if I can just ignore it. I'm currently
 ignoring
 it... can this become a problem in the future?


 On Tue, 12 Aug 2008 17:28:39 -0300, Marcelo Alves
 [EMAIL PROTECTED] wrote:

 
   It is a implementation detail. You should not look inside the sqlite
 file.
 
  2008/8/12 Gustavo Vera [EMAIL PROTECTED]:
   What's the use of the Z_UUID in the Z_METADATA table?
   Is some kind of check sum or something like that?
   CoreData uses this value for something?
   Why is this value different every time the DB is regenerated?
   Is the generation of it a random-based one? Or is it based on
   random+another thing?
  
   Please don't answer my question with another question!!! At least not
 at
   first instance! :D
  
   Thanks in advance!
 
 ___

 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/lgerbarg%40gmail.com

 This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: compile error when protocol not implemented?

2008-08-13 Thread Rua Haszard Morris
I figured this must be the reason.. thanks for the detailed  
explanation. It did occur to me when i'd implemented the protocol  
method but hadn't yet declared conformance.


At the moment this is a zero-warnings build so the warning stands out  
almost as much as an error...


I guess a potential language feature would be some kind of option/ 
keyword in a protocol declaration to say this protocol must be used  
in an old-school, compile-time-typesafe way. But only objc newbies  
would want to use it, right?


thanks

On Aug 14, 2008, at 4:18 PM, Michael Ash wrote:


On Wed, Aug 13, 2008 at 8:39 PM, Rua Haszard Morris
[EMAIL PROTECTED] wrote:
I'd like to get an error, not just a warning, when I pass an  
instance of a
class to a method that takes a parameter conforming to some  
protocol, and
the passed object does not implement the protocol. Is this  
possible? Is
there a good way to set things up so an error is generated.. or is  
there

some dynamism reason why a warning is more suited?


As far as I know, there's no way to make this one thing into an error.

Objective-C is based around the idea of duck typing. This is just a
funny way of saying that the type of an object is irrelevant. All that
matters is what methods it implements (i.e. what it can do; if it
looks like a duck, quacks like a duck, then it's a duck). As such,
*all* static typing information in an Objective-C program is strictly
advisory in nature. Code like this is perfectly legal, although weird:

NSString *array = [NSArray arrayWithObject:@hello];
NSLog(@%@, [array lastObject]);

Now, protocols are supposed to *be* an indicator of capabilities
rather than of type, but the same principle still applies to the use
of protocols as part of static types. For example, you could implement
the protocol methods without actually declaring conformance to the
protocol.

That said, good code should compile with no warnings anyway. I don't
treat warnings much differently from errors. Occasionally I will
tolerate a warning during development, for expediency or to denote
something that I need to change later, and I am occasionally forced to
accept warnings in external code that I didn't write but that I
compile, but overall I treat warnings the same as errors, so the
difference is not all that important to you.

If you follow this approach but still want an actual stop-the-compile
*error*, then you may be interested in the -Werror flag. This turns
*all* warnings into errors, not just this one, but then again that may
very well be a good thing.

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/r.haszardmorris%40adinstruments.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


CoreData, Object/Array Controllers and KVO

2008-08-13 Thread Jeff Hellman
Hi Folks-

I've got a document based CoreData application.

When I open a file and add some of my NSManagedObject subclass objects
to either an NSArrayController (bound to an entity in my NIB) or
NSObjectController (-setContent) the

- (void)willChangeValueForKey:(NSString *)key

is called.  So is

- (void)didChangeValueForKey:(NSString *)key

Why is this?  I'm not actually changing the object values, am I?

Thanks-
Jeff




-- 
Jeff Hellman
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]