Re: shared preferences.

2009-10-15 Thread Sandro Noel

Thank a bunch guy's , this is exactly what i was looking for!

Tegards.
Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this email.





On 2009-10-15, at 11:20 AM, Robert Douglas wrote:


___

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

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

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

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


shared preferences.

2009-10-14 Thread Sandro Noel

Hello,

I'm experiencing problems with my application preference, some part of  
the preferences are user specific but the licensing part is meant to  
be global for the computer.
I am looking for a document that would explain how I can get some  
preferences installed in /Library or if someone could suggest a better  
place to store license information I'l willing to try anything out  
just as long as all users can have access to it even if not admin level.


thank you!


Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this 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 arch...@mail-archive.com


Re: base32

2009-09-23 Thread Sandro Noel

Hey Gleb,

Using CocoaFob for my application was my first goal, but could never  
get it to work nice with the PHP implementation i have.
and since i've never dealt to much with C and never really had to digg  
into binary code and slices, i'm just starting to understand the  
concept.
yes i know, that makes me one of those click happy programmers...  
everything is so easy these days, kind of makes on's brain lazy.  
anyways.


thank for the leads!

Sandro.



On 2009-09-23, at 4:42 PM, Gleb Dolgich wrote:



On 23 Sep 2009, at 21:14, Sandro Noel wrote:

I've been looking all around the internet for a simple Base 32  
encode/decode cocoa function
but all i can find are somehow not compatible with the PHP  
implementation on my web site.


see, if i encode and then decode on the website everything  
validates perfectly. ( same value in as value out )
if i use the same encoded string and try to decode with my local  
computer it does not validate.


so i'm trying to find a simple cocoa base32 encode/decode function  
that would be as simple as this php one,.
or a good specification that i can build from.. Any pointer would  
be ok,


In CocoaFob <http://github.com/gbd/cocoafob/> I'm using Samuel  
Tesla's C implementation taken from base32 Ruby gem: <http://rubyforge.org/projects/base32/ 
>


There is also a slightly incompatible version of Base32 encoding by  
Douglas Crockford <http://www.crockford.com/wrmg/base32.html>,  
implemented in Ruby here: <http://github.com/levinalex/base32>, but  
it doesn't look like it is compatible with your version of base32.


Another slightly different version in C is z-base-32: <http://zooko.com/repos/z-base-32/base32/ 
>


Hope this helps.

--
Gleb Dolgich
http://pixelespressoapps.com/decloner -- Find and remove duplicate  
files on your Mac


___

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

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

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

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


base32

2009-09-23 Thread Sandro Noel

This is probably stupid but i need to ask, sorry.

I've been looking all around the internet for a simple Base 32 encode/ 
decode cocoa function
but all i can find are somehow not compatible with the PHP  
implementation on my web site.


see, if i encode and then decode on the website everything validates  
perfectly. ( same value in as value out )
if i use the same encoded string and try to decode with my local  
computer it does not validate.


so i'm trying to find a simple cocoa base32 encode/decode function  
that would be as simple as this php one,.

or a good specification that i can build from.. Any pointer would be ok,

thank you in advance.

Sandro




___

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

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

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

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


Re: observeValueForKeyPath returns null in the change directory???

2009-08-15 Thread Sandro Noel

thanks guy's


Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.

P
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this email.




On 15-Aug-09, at 7:05 PM, Kyle Sluder wrote:

Unfortunately, NSController's implementation of -bind:… ignores your  
options and does not fill in the change information. It's incredibly  
frustrating.


File a Radar, they'll add it to the pile…

--Kyle Sluder


___

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

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

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

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


observeValueForKeyPath returns null in the change directory???

2009-08-15 Thread Sandro Noel

Greetings.

I would like to watch to prefeences change in my application.
so i add these observers as so:

settings = [NSUserDefaultsController sharedUserDefaultsController];
[settings addObserver:self
forKeyPath:@"values.filesPath"
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
context:NULL];

My observers are registered in applicationDidFinishLaunching.

I do successfully receive the notification for my key path.
but the change directory only returns null values for the old and the  
new values, I do not know what i'm doing wrong.




if i fetch the new value directly from the UserDefaultsController the  
path did change and I can use it from there.

but I would need the old value to remove the old path from my monitor.

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object  
change:(NSDictionary *)change context:(void *)context {


[keyPath retain];
[change retain];

if ([keyPath isEqual:@"values.filesPath"]) {
NSString *old = [change objectForKey:NSKeyValueChangeOldKey];
NSString *new = [change objectForKey:NSKeyValueChangeNewKey];

// both are NSNull
[fileMonitor removePath:old];
[fileMonitor addPath:new];

// this works fine
[fileMonitor addPath:[[settings values] 
valueForKey:@"filesPath"]];
}

[change release];
[keyPath release];  
}

Any clues would be great !!!
thank you !

Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.

P
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this 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 arch...@mail-archive.com


Re: Main Event queue

2009-08-05 Thread Sandro Noel

Dave, Ken thank you very much for the information.

what I would like to do is broad range, get information about every  
action for every application in my current desktop session.


Window movement, hide, show, activate, deactivate, open, close, mouse  
movement, drag and drop operations, contextual menus pop-up.

I want to know everything.

Raw mouse movements, or mouse clicks are of little interest, so are  
keyboard events.
What i am interested in is the action happening after a mouse movement  
or click, or keyboard shortcuts, menu selections has happened.

anything that influences display of content on the desktop.


This subject is still in research mode for me so please excuse me if  
it seems like i don't know what I'm talking about
I'm trying to find out what can actually be done, so it's kind of hard  
to use the right terminology.


thank you very much for your help it's greatly appreciated.

Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.

P
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this email.




On 5-Aug-09, at 5:24 AM, Ken Thomases wrote:

On Aug 4, 2009, at 7:10 PM, Sandro Noel wrote:

Is there a cocoa or carbon framework that would allow my software to  
hook onto the system main event queue, like in windows?

or to hook into the window manager.

I would like to peek at every message that traverse the main queue.


Do you mean just your own application's event queue or all on the  
system?  Event taps are fine for either, but perhaps at too low a  
level or too broad a scope.  If you only want to monitor the events of  
your own application, you might consider subclassing NSApplication and  
overriding -sendEvent:.  That will be limited, however, to the main  
event loop.  Modal event loops implemented around - 
nextEventMatchingMask:... methods don't necessarily pass events  
through -[NSApplication sendEvent:].


Regards,
Ken


___

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

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

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

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


Re: Main Event queue

2009-08-04 Thread Sandro Noel

On 4-Aug-09, at 8:20 PM, Dave Keck wrote:

It sounds like an event tap might help:

http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#/ 
/apple_ref/c/func/CGEventTapCreate

http://prefabsoftware.com/eventtapstestbench/


Dave,

Nice... I think it's exactly what I need, I did not know to look for  
Quartz,
Will this enable me to trap "drag begin" "drag end" a window moving  
around messages ?
prety much everything that happens in my session? not just the  
keyboard and mouse events ?


.
Sandro
___

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

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

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

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


Main Event queue

2009-08-04 Thread Sandro Noel

Greetings,

Is there a cocoa or carbon framework that would allow my software to  
hook onto the system main event queue, like in windows?

or to hook into the window manager.

I would like to peek at every message that traverse the main queue.

Thank you for any information or pointers to the subject.

regards
Sandro.
___

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

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

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

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


Activating and deactivating core layer animation

2009-07-16 Thread Sandro Noel

Greetings!

I was looking at core animation in interface builder, and I really  
like what one can do there.
I need a quick tip... when i define a shadow, or an animation, i would  
like to be able to control in code or bindings
when the shadow appears or when the animation will start in response  
to user mouse input.


where should i look for these informations or tutorial.

I hope I'm being clear.
thank you all!

Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.

P
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this 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 arch...@mail-archive.com


Re: Getting iPod icon, was Getting the network Machine Icon

2009-01-20 Thread Sandro Noel

dave

The only one i found was the one for he ipod touch,

enjoy.

//-
// returns the default iPod Touch icon.
+ (NSImage *) getDefaultiPodTouchIcon{

IconRef iconRef;
	OSErr err = GetIconRef (kOnSystemDisk, kSystemIconsCreator, 'ipdt',  
&iconRef);

if (!err){
		NSImage *image =[[[NSImage alloc] initWithIconRef:iconRef]  
autorelease];

ReleaseIconRef(iconRef);
return image;
}
else
return nil;
}

Sandro Noel.

On 20-Jan-09, at 9:38 AM, Dave wrote:


Hi All,

I would like to something similar which is to display the Icons of  
iPods. I can get the .icns files for the iPhone and iPod Touch from:


/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/

But where to locate the icons for iPods?

Thanks a lot
All the Best
Dave

On 11 Jan 2009, at 19:31, Sandro Noel wrote:


Greetings

I'm looking for a way to programatically get the machine icon from  
my servers, just like finder does in the finder.
for every type of mac it has a different icon, and for windows  
computers, it;s the nice crash screen icon.


I would like my application to represent the network hosts as  
finder does.


I looked over the internet but could not find how finder does it.
I did however find the icons in /System/Library/CoreServices/ 
CoreTypes.bundle/Contents/Resources/


Any suggestions on where to look??

Thank you in advance.
Sandro Noel.
___

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/dave%40looktowindward.com

This email sent to d...@looktowindward.com



___

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

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

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

This email sent to sandro.n...@mac.com


___

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

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

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

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


Re: NsCollectionView Selection

2009-01-19 Thread Sandro Noel

ok I agree, once customized it looks ok.
rounded to 6 and transparent borders with a width of 4 .

in your experience what does look better... as a rounded and border  
width ( to move it away from the container borders)


regards
Sandro Noel


On 20-Jan-09, at 1:22 AM, Graham Cox wrote:



On 20 Jan 2009, at 4:59 pm, Sandro Noel wrote:

NSbox will not let me set the background color if the Box Type is  
not custom,

If I do that I lose the rounded borders. :(
and i can't set the border colors either if the box type is not  
custom.



That's not the case - you ONLY get rounded corners if the box type  
is custom.


You can set it all in IB - the border width, margins and corner  
radius are all set in the "size" section of the palette. The colours  
for the border and fill are set in the main section.


--Graham






___

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

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

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

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


Re: NsCollectionView Selection

2009-01-19 Thread Sandro Noel

HA! the radius does the trick 
thank you I did not see that.

Sandro Noel.

On 20-Jan-09, at 1:22 AM, Graham Cox wrote:



On 20 Jan 2009, at 4:59 pm, Sandro Noel wrote:

NSbox will not let me set the background color if the Box Type is  
not custom,

If I do that I lose the rounded borders. :(
and i can't set the border colors either if the box type is not  
custom.



That's not the case - you ONLY get rounded corners if the box type  
is custom.


You can set it all in IB - the border width, margins and corner  
radius are all set in the "size" section of the palette. The colours  
for the border and fill are set in the main section.


--Graham






___

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

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

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

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


Re: NsCollectionView Selection

2009-01-19 Thread Sandro Noel

Graham.

NSbox will not let me set the background color if the Box Type is not  
custom,

If I do that I lose the rounded borders. :(
and i can't set the border colors either if the box type is not custom.

do you have a suggestion?

Sandro Noel.

On 19-Jan-09, at 11:24 PM, Graham Cox wrote:



On 20 Jan 2009, at 3:10 pm, Sandro Noel wrote:


But I'm not looking for the lazy approach,
I really want the app to be good looking, I like Mac apps because  
they are fancy, I want my app to be fancy too :)


Besides I'm learning, so I might as well learn to do it the right  
way :)

that's why i ask :))

So i hear that if i want something to look good i have to subclass  
it ?



Can you be more specific about what doesn't look good with the NSBox  
approach? Most collection views I've seen (and those I've  
implemented myself) use this approach and they look fine. Apple  
appear to be adopting a round-cornered selection for standard UI  
(such as IKImageBrowserView) and a custom NSBox provides this  
functionality perfectly. (Note, depending on your needs you might  
find that IKImageBrowserVIew might do what you want - it's higher  
level than NSCollectionView and takes care of a lot of the ugly  
details for you.).


The only thing I can think of that you might be after is a selection  
that contained a gradient or background other than a flat colour  
(note NSBox can have a semi-transparent background also). In this  
case you'd probably need to subclass.


As for it being a lazy approach, I don't see that. If you want to  
spend all your time implementing a selection highlight go ahead, but  
most of us have better things to do! Lazy it may (arguably) be, but  
it's definitely not the wrong way.


--Graham




___

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

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

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

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


Re: NsCollectionView Selection

2009-01-19 Thread Sandro Noel

Graham.

I did not mean Lazy in an offensive way :)
I meant it as I want to learn the real stuff and understand how it  
works.
The documentation is hefty and sometimes confusing, so I ask for  
advice :)


I do want a gradient semi-transparent look, it find it sleek.
besides once it's designed, I can reuse, so to me it's not a waste of  
time.


I'll give a closer look at the NSBox, see what I can pull out of it.
If I can subclass the NSBox and have it draw a gradient then that  
would be ok for me.


Thank you Graham.

Sandro Noel.

On 19-Jan-09, at 11:24 PM, Graham Cox wrote:



On 20 Jan 2009, at 3:10 pm, Sandro Noel wrote:


But I'm not looking for the lazy approach,
I really want the app to be good looking, I like Mac apps because  
they are fancy, I want my app to be fancy too :)


Besides I'm learning, so I might as well learn to do it the right  
way :)

that's why i ask :))

So i hear that if i want something to look good i have to subclass  
it ?



Can you be more specific about what doesn't look good with the NSBox  
approach? Most collection views I've seen (and those I've  
implemented myself) use this approach and they look fine. Apple  
appear to be adopting a round-cornered selection for standard UI  
(such as IKImageBrowserView) and a custom NSBox provides this  
functionality perfectly. (Note, depending on your needs you might  
find that IKImageBrowserVIew might do what you want - it's higher  
level than NSCollectionView and takes care of a lot of the ugly  
details for you.).


The only thing I can think of that you might be after is a selection  
that contained a gradient or background other than a flat colour  
(note NSBox can have a semi-transparent background also). In this  
case you'd probably need to subclass.


As for it being a lazy approach, I don't see that. If you want to  
spend all your time implementing a selection highlight go ahead, but  
most of us have better things to do! Lazy it may (arguably) be, but  
it's definitely not the wrong way.


--Graham




___

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

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

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

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


Re: NsCollectionView Selection

2009-01-19 Thread Sandro Noel

Thank you Graham,

But I'm not looking for the lazy approach,
I really want the app to be good looking, I like Mac apps because they  
are fancy, I want my app to be fancy too :)


Besides I'm learning, so I might as well learn to do it the right way :)
that's why i ask :))

So i hear that if i want something to look good i have to subclass it ?

Sandro Noel.

On 19-Jan-09, at 10:50 PM, Graham Cox wrote:



On 20 Jan 2009, at 2:42 pm, Sandro Noel wrote:

When I select an element, there is no selection indicator to show  
the selected item.


True, you have to arrange this.

I've also looked at the example provided by apple, but they use and  
NSBox as the represented object view and

the transparent property to show selection, witch is kind of cheep.


The great advantage of this approach is that you can simply bind the  
"visible" property of the box to the selection and it just works.  
Cheap? Yes, that's what's good about it!


I was wondering, if i want to have a nice selection indicator, with  
the common colors of the current system

what is it that i have to do ?


You could use the custom NSBox approach and set its background  
colour to your system highlight colour. That would require a very  
minimal amount of code and no subclassing.


--Graham




___

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

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

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

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


NsCollectionView Selection

2009-01-19 Thread Sandro Noel


Greetings.

I'm using NSCollectionView in my application.
I've defined the represented object's layout in interface builder.
and now everything displays nicely on screen
with a couple of exceptions.

When I select an element, there is no selection indicator to show the  
selected item.
( blue color in the background ) like all the other applications on my  
Mac.


and when i click on one of the elements in the represented object,
wether it might be an image or a Label the selection does not happen.
How can i avoid that?

I've looked at apple's documentation on NSCollectionView and well,  
it's kind of thin.


I've also looked at the example provided by apple, but they use and  
NSBox as the represented object view and

the transparent property to show selection, witch is kind of cheep.

I was wondering, if i want to have a nice selection indicator, with  
the common colors of the current system

what is it that i have to do ?

do I have to subclass the NSView and implement my own drawing routines?
do I have to implement a controller for the view?

Can someone point me in he right direction :) please?

regards
Sandro Noel.

___

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

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

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

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


Re: bindings and sub array modification notification.

2009-01-19 Thread Sandro Noel

mmalc.

after looking at the example page you sent me it gave me some answers  
about

controllers that I was getting ready to ask, so thank you!

Sandro Noel.

On 18-Jan-09, at 8:36 PM, mmalc Crawford wrote:



On Jan 18, 2009, at 5:02 PM, Sandro Noel wrote:

How could I possibly observe the changes in the information array  
or each host element?



<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>

mmalc



___

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

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

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

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


Re: bindings and sub array modification notification.

2009-01-18 Thread Sandro Noel

Quincey,

Thank you for taking the time to explain. It is very appreciated.

With this explanation in mind my approach to save my files when the  
array changes is not a good way to go.

I'll change the code.

Thank you very much. :)

Who owns what/who is a little confusing for me at this stage in my  
learning of the Cocoa/Objective-C structure
Memory management, bindings, delegates, controllers, Key-Value, some  
Carbon, I'm mixing in all the elements and
all the new terms, Sorry if it causes confusion and makes helping more  
tedious. I'll get there :)


Sandro Noel.

On 18-Jan-09, at 11:37 PM, Quincey Morris wrote:


On Jan 18, 2009, at 17:02, Sandro Noel wrote:

How could I possibly observe the changes in the information array  
or each host element?

or if no possible, the currently selected host...

I currently have an observer on the hosts array, and that works  
when the array is changed(added/deleted),
but i would need to get notification when the content of a "host"  
is also changed.

is that possible ?


There's no magic involved. Your observer has to say it wants to  
observe, with object/key-path granularity:


[host addObserver: self forKeyPath: @"firstProperty" ...];
[host addObserver: self forKeyPath: @"secondProperty" ...];
...

Repeat for each host (as you add it to the array of hosts, for  
example).


Of course, in many cases you don't need or want to set up systematic  
observations of all properties of all objects like this*. In many  
cases, observations result from the use of bindings. When you use a  
binding in IB (from, say, a NSTableColumn), adding itself as an  
observer is one of the things that the observing UI element does for  
itself, and supporting bindings by watching for the comings and  
goings of objects in array properties is in fact the fundamental  
purpose of the NSArrayController class.


BTW, you don't "have an observer on the hosts array", you have an  
observer on the "hosts" property of the object that owns the hosts  
array. If you religiously train yourself to think and speak in terms  
of (owning) object *having* a property instead of (value) object  
*being* a property, you'll save yourself a lot of grief.



*One good reason for systematically observing all properties of all  
objects in your data model is automatic invocation-based undo.



___

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 sandro.n...@mac.com


___

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

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

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

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


Re: bindings and sub array modification notification.

2009-01-18 Thread Sandro Noel

Qiuncey,

Solution 1 works like a charm
thank you so much !!!

that raises another question.

How could I possibly observe the changes in the information array or  
each host element?

or if no possible, the currently selected host...

I currently have an observer on the hosts array, and that works when  
the array is changed(added/deleted),
but i would need to get notification when the content of a "host" is  
also changed.

is that possible ?

Thank you!
Sandro Noel.

On 18-Jan-09, at 7:53 PM, Sandro Noel wrote:




Quincey, thank you for replying.

Are you saying that the "information collection view" is a  
NSCollectionView which displays a subview for each information  
element in the currently selected host?


information collection view displays a sub-view for every element of  
the information array inside the currently selected host element.




Are you saying that the "information collection view" fails to show  
an additional subview when a new information element is added, or  
that an existing subview fails to update when its information is  
changed, or something else?


I fails to show the new element added to the information array of  
the host element.

Editing works just fine.

"Add window controller" is the controller for my sheet that displays  
the fields required to create a new information element to a host  
element.
and is responsible for adding the new information element to the  
host element's information array.

Sorry I should of been more clear .. :s

What is an "add window controller"? If you mean it's the window  
controller that has some "add" button's action method, it's  
irrelevant -- it doesn't matter what *makes* the change, but what  
the change is *made to* (and how).


There are basically two routes to changing an array that has a  
NSArrayController bound to it:


1. Change the data model directly. Logically, this would be  
[informationElements addObject: ...] (or some similar thing), but  
that is not KVO-compliant, so you must instead write [[host  
mutableArrayValueForKey: @"informationElements"] addObject: ...].



I think solution 1 sounds like a winner.

I'll try that.
Thank you!

Sandro Noel.
___

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 sandro.n...@mac.com


___

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

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

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

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


Re: bindings and sub array modification notification.

2009-01-18 Thread Sandro Noel



Quincey, thank you for replying.

Are you saying that the "information collection view" is a  
NSCollectionView which displays a subview for each information  
element in the currently selected host?


information collection view displays a sub-view for every element of  
the information array inside the currently selected host element.




Are you saying that the "information collection view" fails to show  
an additional subview when a new information element is added, or  
that an existing subview fails to update when its information is  
changed, or something else?


I fails to show the new element added to the information array of the  
host element.

Editing works just fine.

"Add window controller" is the controller for my sheet that displays  
the fields required to create a new information element to a host  
element.
and is responsible for adding the new information element to the host  
element's information array.

Sorry I should of been more clear .. :s

What is an "add window controller"? If you mean it's the window  
controller that has some "add" button's action method, it's  
irrelevant -- it doesn't matter what *makes* the change, but what  
the change is *made to* (and how).


There are basically two routes to changing an array that has a  
NSArrayController bound to it:


1. Change the data model directly. Logically, this would be  
[informationElements addObject: ...] (or some similar thing), but  
that is not KVO-compliant, so you must instead write [[host  
mutableArrayValueForKey: @"informationElements"] addObject: ...].



I think solution 1 sounds like a winner.

I'll try that.
Thank you!

Sandro Noel.
___

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

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

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

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


bindings and sub array modification notification.

2009-01-18 Thread Sandro Noel

Greetings.

I'm having a problem getting my collection view to update when i  
insert and element in my model.


My model is like this.

Host (custom class).
NSString *hostName
NSArray *informationElements.

In interface builder I have the host collection view bound to an array  
controller (arangedObjects.)

who itself is bound to the :hosts: array  of my window controller
and the information collection view is bound to and array controller
who is bound to the host Array Controller as (Selection)

This works just fine.

The problem I am having is this, when I add a host to the array  
controller, the view get's updated with the new values.
but when i add information to an already existing host, the  
information is there but it does not get displayed until

the selection changes and comes back to that element.

I've tried to use   

from the add window controller. witch is not where the hosts variable  
is declared.

[self willChangeValueForKey:@"informationElements"];
[self didChangeValueForKey:@"informationElements"];   

[hosts willChangeValueForKey:@"informationElements"];
[hosts didChangeValueForKey:@"informationElements"];  

[self willChangeValueForKey:@"hosts.informationElements"];
[self didChangeValueForKey:@"hosts.informationElements"]; 

nothing happens.

I'm not using the InformationArraycontroller because
I am not sure of current selection when the information is saved.

Can anyone advise?

Thank you !
Sandro Noel.

___

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

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

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

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


Properties and memory management with overrides.

2009-01-18 Thread Sandro Noel

Greetings.

This is probably a stupid question.

if i have a property declared as
@property (readwrite, copy) NSString *name;

if I override the -(void) setName(NSString*)value{}

The object that I get as value is it already a copy?

Will the object still copy if I just
instanceVariable = value;

or do I have to
instanceVariable = [value copy];

Thank you!

Sandro Noel.
___

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

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

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

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


Function for Retrieving icon from bundle's.

2009-01-16 Thread Sandro Noel

Greetings.

I have now completed my quest for the Machine model, :) Yé!

i'm faced yet with another problem, retriving the icon from a bundle.
/System/Library/CoreServices/CoreTypes.bundle

I've tried.

NSImage *icon = [[NSWorkspace sharedWorkspace]  
iconForFileType:modelName];


But that just gives me a nice default icon witch is not what i was  
aiming for.

i've also tried

GetIconRef (kOnSystemDisk, kSystemIconsCreator, modelName, &theIconRef);

But that just also gibes me the default unknown document icon.
or am i going about  this the wrong way ?

is there another way to get machine icons with the machine model code?

for example. iMac6,1

Thank you !
Sandro Noel.___

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

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

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

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


Re: Getting the network Machine Icon

2009-01-16 Thread Sandro Noel

sorry I typed it to quickly.

[computer bonjour name].[_device-info._tcp].[domain]


but I get error -72004 when i try it. :(
witch is an invalid parameter.

I've searched the internet for _device-info.
and apparently i'm not the only one asking about this feature, but no  
one seems to be getting an answer :|


Oh well... Discovery time :)

Sandro Noel.

On 16-Jan-09, at 2:21 AM, Sandro Noel wrote:


Guy's I think I found it.

Using a packet analyzer on my laptop, and using my iphone with  
DataCase (AFP server for iphone)
when the service is resolved, finder sends a special bonjour query.  
called device-info.

Packet: 5, Packetlength: 252 bytes, Packet follows:

00030   00 05 00 00 00 00 16 53  61 6e 64 72 6f 20 4e  
6f...Sandro No
00040   65 6c e2 80 99 73 20 69  50 68 6f 6e 65 0b 5f 61el...s  
iPhone._a
00050   66 70 6f 76 65 72 74 63  70 04 5f 74 63 70 05 6c 
fpovertcp._tcp.l
00060   6f 63 61 6c 00 00 21 80  01 00 00 00 78 00 11 00 
ocal..!.x...
00070   00 00 00 15 38 08 69 50  68 6f 6e 65 2d 37 c0 34 
8.iPhone-7.4
00080   c0 0c 00 10 80 01 00 00  11 94 00 01 00 09 5f  
73.._s
00090   65 72 76 69 63 65 73 07  5f 64 6e 73 2d 73 64 04 
ervices._dns-sd.
000a0   5f 75 64 70 c0 34 00 0c  00 01 00 00 11 94 00 02_udp. 
4..
000b0   c0 23 c0 23 00 0c 00 01  00 00 11 94 00 02 c0  
0c.#.#
000c0   16 53 61 6e 64 72 6f 20  4e 6f 65 6c e2 80 99 73    .Sandro  
Noel...s
000d0   20 69 50 68 6f 6e 65 0c  5f 64 65 76 69 63 65 2d  
iPhone._device-
000e0   69 6e 66 6f c0 2f 00 10  00 01 00 00 11 94 00 0c 
info./..
000f0   0b 6d 6f 64 65 6c 3d 4d  36 38 41  
50.model=M68AP


can you see the model=M68AP ?

the service reference here :http://www.dns-sd.org/ServiceTypes.html  
says

device-info
Device Info Stuart Cheshire , Marc Krochmal  Not a service type.  
Special name reserved for DNS-SD device info.


So the query would be .

[computer bonjour name].[service-info.tcp].[domain]
resolve that, and you get your model info.

This is just speculation for now but i'll try it tomorrow and let  
you guy's know ! :)


I. Savant thank you for being curious as I am :)


Sandro Noel.

On 13-Jan-09, at 2:51 PM, Sandro Noel wrote:


Well it's not that bad of a place to put it...
there is not way to know beforehand if the servers are going to be  
present
So it makes sense to ask the server what it is. when Bonjour  
declares it's presence.

or when the SMB server broadcasts.

The icons for every possible mac model are local to the computer,  
if you have a Mac.

/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/

I suspect that the icon in the reply from the FPGetSrvrInfo is  
useful for other platforms.
because with the model number, there is pretty much no more  
information needed to

associate an icon from the local resource.

The only problem I find it VERY complicated for such a simple  
feature.
to have to implement sockets UDP or TCP "have not gotten a reply  
yet".

Just to get an image to show up on screen :) is quite an overhead :)

Perhaps it would of been nice to add the model number of the  
machine to a NSNetService(Bonjour) TXT record.

Instead of having to uery the host directly. IMHO

I might be wrong, what do I know :)

Sandro Noel.

On 13-Jan-09, at 12:09 PM, I. Savant wrote:

On Tue, Jan 13, 2009 at 11:32 AM, Sandro Noel  
 wrote:


The AFP client sends the FPGetSrvrInfo command to obtain server  
information.
The FPGetSrvrInfo command returns server information including  
the following
server parameters: server name, machine type, AFP version  
strings, UAM
strings, volume icon and mask, a bitmap of flags, and optionally,  
a list of
available Open Directory names. For descriptions of server  
parameters, see

FPGetSrvrInfo in the Reference section.



Neat! That seems an odd place to put that functionality, but
hopefully it'll be better-placed when all that stuff is eventually
cocoa-ized. Thanks for the follow-up. Very informative.

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


This email sent to sandro.n...@mac.com




___

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

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

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

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


Re: Getting the network Machine Icon

2009-01-15 Thread Sandro Noel

Guy's I think I found it.

Using a packet analyzer on my laptop, and using my iphone with  
DataCase (AFP server for iphone)
when the service is resolved, finder sends a special bonjour query.  
called device-info.

Packet: 5, Packetlength: 252 bytes, Packet follows:

00030   00 05 00 00 00 00 16 53  61 6e 64 72 6f 20 4e  
6f...Sandro No
00040   65 6c e2 80 99 73 20 69  50 68 6f 6e 65 0b 5f 61el...s  
iPhone._a
00050   66 70 6f 76 65 72 74 63  70 04 5f 74 63 70 05 6c 
fpovertcp._tcp.l
00060   6f 63 61 6c 00 00 21 80  01 00 00 00 78 00 11 00 
ocal..!.x...
00070   00 00 00 15 38 08 69 50  68 6f 6e 65 2d 37 c0 34 
8.iPhone-7.4
00080   c0 0c 00 10 80 01 00 00  11 94 00 01 00 09 5f  
73.._s
00090   65 72 76 69 63 65 73 07  5f 64 6e 73 2d 73 64 04 
ervices._dns-sd.
000a0   5f 75 64 70 c0 34 00 0c  00 01 00 00 11 94 00 02_udp. 
4..
000b0   c0 23 c0 23 00 0c 00 01  00 00 11 94 00 02 c0  
0c.#.#
000c0   16 53 61 6e 64 72 6f 20  4e 6f 65 6c e2 80 99 73.Sandro  
Noel...s
000d0   20 69 50 68 6f 6e 65 0c  5f 64 65 76 69 63 65 2d  
iPhone._device-
000e0   69 6e 66 6f c0 2f 00 10  00 01 00 00 11 94 00 0c 
info./..

000f0   0b 6d 6f 64 65 6c 3d 4d  36 38 41 50.model=M68AP

can you see the model=M68AP ?

the service reference here :http://www.dns-sd.org/ServiceTypes.html says
device-info
Device Info Stuart Cheshire , Marc Krochmal  Not a service type.  
Special name reserved for DNS-SD device info.


So the query would be .

[computer bonjour name].[service-info.tcp].[domain]
resolve that, and you get your model info.

This is just speculation for now but i'll try it tomorrow and let you  
guy's know ! :)


I. Savant thank you for being curious as I am :)


Sandro Noel.

On 13-Jan-09, at 2:51 PM, Sandro Noel wrote:


Well it's not that bad of a place to put it...
there is not way to know beforehand if the servers are going to be  
present
So it makes sense to ask the server what it is. when Bonjour  
declares it's presence.

or when the SMB server broadcasts.

The icons for every possible mac model are local to the computer, if  
you have a Mac.

/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/

I suspect that the icon in the reply from the FPGetSrvrInfo is  
useful for other platforms.
because with the model number, there is pretty much no more  
information needed to

associate an icon from the local resource.

The only problem I find it VERY complicated for such a simple feature.
to have to implement sockets UDP or TCP "have not gotten a reply yet".
Just to get an image to show up on screen :) is quite an overhead :)

Perhaps it would of been nice to add the model number of the machine  
to a NSNetService(Bonjour) TXT record.

Instead of having to uery the host directly. IMHO

I might be wrong, what do I know :)

Sandro Noel.

On 13-Jan-09, at 12:09 PM, I. Savant wrote:

On Tue, Jan 13, 2009 at 11:32 AM, Sandro Noel   
wrote:


The AFP client sends the FPGetSrvrInfo command to obtain server  
information.
The FPGetSrvrInfo command returns server information including the  
following
server parameters: server name, machine type, AFP version strings,  
UAM
strings, volume icon and mask, a bitmap of flags, and optionally,  
a list of
available Open Directory names. For descriptions of server  
parameters, see

FPGetSrvrInfo in the Reference section.



Neat! That seems an odd place to put that functionality, but
hopefully it'll be better-placed when all that stuff is eventually
cocoa-ized. Thanks for the follow-up. Very informative.

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

This email sent to sandro.n...@mac.com


___

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

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

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

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


Re: Getting the network Machine Icon

2009-01-13 Thread Sandro Noel

Well it's not that bad of a place to put it...
there is not way to know beforehand if the servers are going to be  
present
So it makes sense to ask the server what it is. when Bonjour declares  
it's presence.

or when the SMB server broadcasts.

The icons for every possible mac model are local to the computer, if  
you have a Mac.

/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/

I suspect that the icon in the reply from the FPGetSrvrInfo is useful  
for other platforms.
because with the model number, there is pretty much no more  
information needed to

associate an icon from the local resource.

The only problem I find it VERY complicated for such a simple feature.
to have to implement sockets UDP or TCP "have not gotten a reply yet".
Just to get an image to show up on screen :) is quite an overhead :)

Perhaps it would of been nice to add the model number of the machine  
to a NSNetService(Bonjour) TXT record.

Instead of having to uery the host directly. IMHO

I might be wrong, what do I know :)

Sandro Noel.

On 13-Jan-09, at 12:09 PM, I. Savant wrote:

On Tue, Jan 13, 2009 at 11:32 AM, Sandro Noel   
wrote:


The AFP client sends the FPGetSrvrInfo command to obtain server  
information.
The FPGetSrvrInfo command returns server information including the  
following
server parameters: server name, machine type, AFP version strings,  
UAM
strings, volume icon and mask, a bitmap of flags, and optionally, a  
list of
available Open Directory names. For descriptions of server  
parameters, see

FPGetSrvrInfo in the Reference section.



 Neat! That seems an odd place to put that functionality, but
hopefully it'll be better-placed when all that stuff is eventually
cocoa-ized. Thanks for the follow-up. Very informative.

--
I.S.


___

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

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

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

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


Re: Getting the network Machine Icon

2009-01-13 Thread Sandro Noel

Follow UP.

Here is what i got from the Carbon-dev list


I'd guess it just uses AFP to ask the server:

From <http://developer.apple.com/documentation/Networking/Conceptual/AFP/UsingLoginCommands/chapter_3_section_1.html#//apple_ref/doc/uid/TP4854-CH4-SW1 
>:


The AFP client sends the FPGetSrvrInfo command to obtain server  
information. The FPGetSrvrInfo command returns server information  
including the following server parameters: server name, machine type,  
AFP version strings, UAM strings, volume icon and mask, a bitmap of  
flags, and optionally, a list of available Open Directory names. For  
descriptions of server parameters, see FPGetSrvrInfo in the Reference  
section.


I will post my code here as soon as i'm done, if this is the proper  
solution, it does makes sense.


regards

Sandro Noel.

On 12-Jan-09, at 2:01 PM, I. Savant wrote:

On Mon, Jan 12, 2009 at 1:52 PM, Sandro Noel   
wrote:



Thanks guy's i'll ask in the Carbon-dev list.


 Sorry - I didn't see the "remote" part of the requirement at first.
After spending some time searching the docs, tech notes, and even some
headers for this myself (because it's an intriguing question), I
couldn't find any good leads either. I'll second the suspicion that
Carbon will likely be needed, but there doesn't appear to be a
well-documented way to do so.

 If you wouldn't mind following up on this thread with any references
you might get on carbon-dev (for those who aren't subscribed), it
would be greatly appreciated.

--
I.S.


___

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

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

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

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


Re: Getting the network Machine Icon

2009-01-12 Thread Sandro Noel

Thanks guy's i'll ask in the Carbon-dev list.

Sandro Noel.

On 11-Jan-09, at 2:31 PM, Sandro Noel wrote:


Greetings

I'm looking for a way to programatically get the machine icon from  
my servers, just like finder does in the finder.
for every type of mac it has a different icon, and for windows  
computers, it;s the nice crash screen icon.


I would like my application to represent the network hosts as finder  
does.


I looked over the internet but could not find how finder does it.
I did however find the icons in /System/Library/CoreServices/ 
CoreTypes.bundle/Contents/Resources/


Any suggestions on where to look??

Thank you in advance.
Sandro Noel.
___

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 sandro.n...@mac.com


___

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

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

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

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


Getting the network Machine Icon

2009-01-11 Thread Sandro Noel

Greetings

I'm looking for a way to programatically get the machine icon from my  
servers, just like finder does in the finder.
for every type of mac it has a different icon, and for windows  
computers, it;s the nice crash screen icon.


I would like my application to represent the network hosts as finder  
does.


I looked over the internet but could not find how finder does it.
I did however find the icons in /System/Library/CoreServices/ 
CoreTypes.bundle/Contents/Resources/


Any suggestions on where to look??

Thank you in advance.
Sandro Noel.
___

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

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

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

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


Re: Problem sending notification from C callback function

2009-01-09 Thread Sandro Noel

Ken thank you.

the problem was elsewhere in a dictionary key name...

thank you for your help!!!

Sandro Noel.

On 9-Jan-09, at 2:09 AM, Ken Thomases wrote:


On Jan 8, 2009, at 7:57 PM, Sandro Noel wrote:


I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.


Does not seem to work in what way?  Are you getting compiler errors  
or warnings?  Crashes at runtime?  What?




the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;

NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"]; 

	[[NSNotificationCenter defaultCenter]  
postNotificationName:ADD_REMOVE_NOTIFICATION object:nil  
userInfo:nil];

}

Obviously, default center does not exist in the callback,


Actually, I don't know what you mean here, so it's far from obvious.

The default notification center is a singleton.  It always "exists"  
in the sense that you can always retrieve it using  
[NSNotificationCenter defaultCenter], just as you have.




but i cant seem to typecast the context to
my object type and retrieve the notification center from the  
object. i just do not know how to do it.


Well, since the default notification center is a singleton, it is  
effectively globally available.  You don't need to stash a reference  
to it in your object and retrieve it from there.


With regard to the general question of how you can message the  
object passed in context: given that the context is an object  
pointer, you can just cast it:


id myObject = (id)context;
[myObject someMethod:someArgument];

If you have a more specific type than id, go ahead and use that.

Regards,
Ken



___

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

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

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

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


Re: A Data Object in Cocoa

2009-01-09 Thread Sandro Noel
the compiler is complaining just because they all have the same name  
and he is confused about witch to choose

to resolve the issue, just rename the parameters of your procedure.

IE:  - (id)initWithLabel:(NSString *)initLabel pin:(NSString *)initPin  
seed:(NSString *)initSeed {


or whatever name that makes them different than your classe's  
definition.


Sandro Noel..


On 9-Jan-09, at 2:49 AM, nik heger wrote:

I am trying to define a pure data object in Cocoa. This object  
doesn't do anything, it should just act as a container for three  
strings. This is generally a good design pattern, at least in Java.


In Cocoa, I am running into a lot of resistance. The constructor is  
rather complicated.


And the compiler complains about this:

- (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed: 
(NSString *)seed {

if (self = [super init]) {
self.label = label; ///<--- compiler complains
self.pin = pin;
self.seed = seed;
}
return self;
}

I get three warnings that say "local declaration of x overrides  
instance variables. I thought I could differentiate between the  
parameters and the instance variables using self.variable vs just  
variable.


What's the Cocoa way of doing this? Do I really have to name the  
parameters pLabel, pSeed, and pPin? Or would it be better to just  
keep that stuff in a Dictionary object?


Thanks for any help,

Nik
___

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 sandro.n...@mac.com


___

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

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

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

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


Problem sending notification from C callback function

2009-01-08 Thread Sandro Noel

Greetings.

I'm having a little problem due to lack of knowledge here.

I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.

the callback is registered like this.
daSession  = DASessionCreate(kCFAllocatorSystemDefault);
DASessionScheduleWithRunLoop(daSession, [[NSRunLoop currentRunLoop]  
getCFRunLoop], kCFRunLoopCommonModes);
DARegisterDiskDisappearedCallback(daSession, NULL,  
&DiskDisappearedCallback, (void *)self);



the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;

NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"]; 

	[[NSNotificationCenter defaultCenter]  
postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil];

}

Obviously, default center does not exist in the callback, but i cant  
seem to typecast the context to
my object type and retrieve the notification center from the object. i  
just do not know how to do it.


could someone enlighten me please ?

thank you Sandro Noel.
___

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

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

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

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


Re: NSOperation Question

2009-01-07 Thread Sandro Noel

i meant main app.

On 7-Jan-09, at 9:00 PM, Sandro Noel wrote:

Thanks Ken i was not aware of run Loops, besides the one for the  
mail app

I did not know i could just create one like that :)

i'll try that.

Sandro Noel.

On 7-Jan-09, at 8:42 PM, Ken Thomases wrote:


On Jan 7, 2009, at 6:45 PM, Sandro Noel wrote:

How would I go about having an operation stay alive as long as my  
application is alive,


If this is what you want, then it's no longer an operation, it's  
just a thread.  Don't use NSOperation for this.



I use DiskAppearedCallback / DiskDisappearedCallback from the  
DiskArbitration Framework

in my application and I want the to be in their separate thread.


Why do you want them to be in a separate thread?  The run loop is  
designed specifically to allow for monitoring of various input  
sources without the need to spawn threads.



How can i have the thread not quit as soon as the callback's are  
registered?


If you really want to use a thread, add a dummy NSPort to the  
thread's run loop and then just run the run loop.  The thread will  
just sit in the run loop and process DiskArbitration callbacks when  
they happen.


Cheers,
Ken



___

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

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

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

This email sent to sandro.n...@mac.com


___

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

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

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

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


Re: NSOperation Question

2009-01-07 Thread Sandro Noel
Thanks Ken i was not aware of run Loops, besides the one for the mail  
app

I did not know i could just create one like that :)

i'll try that.

Sandro Noel.

On 7-Jan-09, at 8:42 PM, Ken Thomases wrote:


On Jan 7, 2009, at 6:45 PM, Sandro Noel wrote:

How would I go about having an operation stay alive as long as my  
application is alive,


If this is what you want, then it's no longer an operation, it's  
just a thread.  Don't use NSOperation for this.



I use DiskAppearedCallback / DiskDisappearedCallback from the  
DiskArbitration Framework

in my application and I want the to be in their separate thread.


Why do you want them to be in a separate thread?  The run loop is  
designed specifically to allow for monitoring of various input  
sources without the need to spawn threads.



How can i have the thread not quit as soon as the callback's are  
registered?


If you really want to use a thread, add a dummy NSPort to the  
thread's run loop and then just run the run loop.  The thread will  
just sit in the run loop and process DiskArbitration callbacks when  
they happen.


Cheers,
Ken



___

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

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

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

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


NSOperation Question

2009-01-07 Thread Sandro Noel

Greetings!

I've been using NSOperation in my applications and I enjoy it's  
simplicity.

All my Operations go into a NSOperationQueue.

How would I go about having an operation stay alive as long as my  
application is alive,


This is what I want to do.

I use DiskAppearedCallback / DiskDisappearedCallback from the  
DiskArbitration Framework

in my application and I want the to be in their separate thread.

How can i have the thread not quit as soon as the callback's are  
registered?


something like this ?
- (void) main{
// register the callbacks and get the runloop
// wait for cancellation.
while (!isCancelled){}
}

thank you !
Sandor Noel.
___

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

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

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

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


Re: Problem with AFP server Notification seek advice.

2009-01-07 Thread Sandro Noel
Is there any documentation available for this framework besides the  
Header files description ?


Thanks you.
Sandro Noel.


On 7-Jan-09, at 9:39 AM, Alastair Houghton wrote:


On 6 Jan 2009, at 16:58, Sandro Noel wrote:

when a server is mounted, and it notifies that it is going offline,  
I get a bonjour notification that the service disappeared,
but so does Finder or OS X, and it dismounts the drives before BM  
has time to dismount them.
and the annoying point is that it notifies the user that the server  
just left.


This isn't really a Cocoa question (and this is the Cocoa mailing  
list).  Omni's macosx-dev list or one of Apple's other mailing lists  
would have been a better place to ask (not least because cocoa-dev  
is very high traffic and it's hard enough to keep up with it without  
adding lots of non-Cocoa-related queries as well).


That said, I think you might want to use the DiskArbitration  
framework here.  You probably want to refuse to allow others to  
unmount the disk, and only allow it to unmount *after* your Bonjour  
Mounter is finished with it.  Take a look at  
DARegisterDiskUnmountApprovalCallback() in the Xcode docs; to use  
it, you'll need a DAApprovalSession, which must be scheduled in a  
run loop.


Kind regards,

Alastair.

--
http://alastairs-place.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 arch...@mail-archive.com


Re: Problem with AFP server Notification seek advice.

2009-01-07 Thread Sandro Noel

Thank you so much !!
it's really appreciated.

Sandro Noel.

On 7-Jan-09, at 9:39 AM, Alastair Houghton wrote:


On 6 Jan 2009, at 16:58, Sandro Noel wrote:

when a server is mounted, and it notifies that it is going offline,  
I get a bonjour notification that the service disappeared,
but so does Finder or OS X, and it dismounts the drives before BM  
has time to dismount them.
and the annoying point is that it notifies the user that the server  
just left.


This isn't really a Cocoa question (and this is the Cocoa mailing  
list).  Omni's macosx-dev list or one of Apple's other mailing lists  
would have been a better place to ask (not least because cocoa-dev  
is very high traffic and it's hard enough to keep up with it without  
adding lots of non-Cocoa-related queries as well).


That said, I think you might want to use the DiskArbitration  
framework here.  You probably want to refuse to allow others to  
unmount the disk, and only allow it to unmount *after* your Bonjour  
Mounter is finished with it.  Take a look at  
DARegisterDiskUnmountApprovalCallback() in the Xcode docs; to use  
it, you'll need a DAApprovalSession, which must be scheduled in a  
run loop.


Kind regards,

Alastair.

--
http://alastairs-place.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 arch...@mail-archive.com


Problem with AFP server Notification seek advice.

2009-01-06 Thread Sandro Noel

Greetings!

I created a little application called Bonjour Mounter.
and i'm having a little problem.

when a server is mounted, and it notifies that it is going offline, I  
get a bonjour notification that the service disappeared,
but so does Finder or OS X, and it dismounts the drives before BM has  
time to dismount them.
and the annoying point is that it notifies the user that the server  
just left.


I noticed that finder will not notify if there is nothing mounted from  
that server.
so I'm trying to dismount before finder does it so the mount and  
dismount is transparent.


some of my users use Bonjour Mounter with media centers, and do not  
have a keyboard or mouse to click on the dialogue.


Is there a way I can tell finder to let me unmount the drives before  
it reacts ?

or just tell him not to notify?

thank you all!!

Sandro Noel.
___

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

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

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

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


AFP server loss notification.

2009-01-06 Thread Sandro Noel

Greetings!

I created a little application called Bonjour Mounter.
and i'm having a little problem.

when a server is mounted, and it notifies that it is going offline, I  
get a bonjour notification that the service disappeared,
but so does Finder or OS X, and it dismounts the drives before BM has  
time to dismount them.
and the annoying point is that it notifies the user that the server  
just left.


I noticed that finder will not notify if there is nothing mounted from  
that server.
so I'm trying to dismount before finder does it so the mount and  
dismount is transparent.


some of my users use Bonjour Mounter with media centers, and do not  
have a keyboard or mouse to click on the dialogue.


Is there a way I can tell finder to let me unmount the drives before  
it reacts ?

or just tell him not to notify?

thank you all!!

Sandro Noel.
___

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

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

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

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


Re: Very strange behaviour of NSCollectionView

2008-12-29 Thread Sandro Noel

Matteo,

Did you ever get a response on this issue?
Did you find a solution ?
I am having the exact same problem.

Thank you!
Sandro Noel.

On 20-Nov-08, at 4:21 AM, Matteo Manferdini wrote:


Hi everyone.
I'm battling against a very strange behaviour of NSCollectionView.  
To tell
the truth this is not the first time that I have problems with this  
new

class, but other times I have always found a workaround.
I tried to search the web for more information, but all I can find  
are very

basic examples of NSCollectionView use.

Here it is: in my app I have a window attached to the main one which  
opens
when the user double clicks on some items. Inside this window there  
is the
NSCollectionView. It is bound to a normal prototype view made in  
interface

builder, inside of which there are normal text fields bound to the
NSCollectionViewItem representedObject properties. The collection  
view takes
its content from a standard NSArrayController arrangedObjects  
binding. So,
everything is quite standard. The problem is that when this window  
opens,
some of the bindings for the text fields simply don't work and these  
text
fields display their title text instead of the values, while others  
work.
The strangest part is that the bindings that don't work change  
randomly:
sometimes all bindings work, sometimes they don't work at all,  
sometimes
only some of them (randomly chosen) work. Everything is set up the  
same for

each binding.

This strange behaviour is present only when I open the window. If I  
add
items keeping the window open, everything work for the newly added  
items.
The old ones still do not work. If I close the window and then  
reopen it,

everything does not work, even the new items that worked.

Does anyone know what's happening?
Thank you very much.
Cheers.

Matteo Manferdini
Pawn Software
www.pawn-soft.com
___

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

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

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

This email sent to sandro.n...@mac.com


___

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

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

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

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


Re: Modal Session not stopping main thread.

2008-12-24 Thread Sandro Noel

 Followup.

I have also tried...

- (void) showHostPasswordWindow:(MountDefinition *) mount{

NSInteger response = [NSApp runModalForWindow:hostPasswordWindow];

[hostPasswordWindow orderOut:self];
}

But that just seems to lock up my application even when i call
[NSApp stopModal]; in my ok button.

after the window disappears, the menus and everything is still grayed  
out, and my main

window still wont accept user input.

Thank you.
Sandro Noel.
___

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

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

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

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


Modal Session not stopping main thread.

2008-12-24 Thread Sandro Noel

Greetings.

I am trying to get a modal window, to stop processing notifications  
while the window is opened.

so the scenatio is,

My application received notifications that are sent from my objects  
like this.
[[NSNotificationCenter defaultCenter]  
postNotificationName:SERVICE_ADD_REMOVE_NOTIFICATION object:self  
userInfo:service];


the application controller responds to those notifications by calling  
functions that pop a modal window.

like this.

- (void) showHostPasswordWindow:(MountDefinition *) mount{

[hostPasswordWindow makeFirstResponder:hostPassword];
[hostPasswordWindow makeKeyAndOrderFront:nil];  

	NSModalSession session = [NSApp  
beginModalSessionForWindow:hostPasswordWindow];

NSInteger response;
for (;;) {
response=[NSApp runModalSession:session];
if (response != NSRunContinuesResponse)
break;
}

if (response == NSRunStoppedResponse){
HostPassword *hPWD = [HostPassword new];
hPWD.hostName = [hostHostName stringValue];
hPWD.password = [hostPassword stringValue];
[hostPasswords addObject:hPWD];
mount.password =[hostPassword stringValue];
}   

//when the user exits the window, hide the window
[NSApp endModalSession:session];
[hostPasswordWindow close];
}

the problem i am having here is that if i receive 5 notifications, i  
get the same window for all the 5 notifications

but only the last one is taken into account.

what i would really need is for the application to pause while the  
first notification is being processed by the user

and then pop another window, for the second notification.

i can not seem to achieve this with this code, i've tried other  
approaches but they did pretty much the same thing.


can anyone tell me what I'm doing wrong here? please ?
thank you !!!

Sandro Noel.

___

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

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

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

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


Detecting SMB servers on the network

2008-12-01 Thread Sandro Noel

Greetings.

i am looking for a way to detect the presence or advertisement of  
samba servers on my network in cocoa
kind of the same thing Bonjour does, the finder seems able to detect  
them and i would like to do the
same thing, and i have been researching the documentation but found  
nothing that was helpful


can anyone point me in the right direction ?

thank you !!
Sandro Noel.
___

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: OutlineView, bindings and array of NSDictionaries.

2008-11-17 Thread Sandro Noel

Thank you Quincey,
Very nice explanation i'll adjust my code.

Sandro Noel.

On 17-Nov-08, at 6:45 PM, Quincey Morris wrote:


On Nov 17, 2008, at 13:51, Sandro Noel wrote:

I cant seem to get my data to display properly in the Outline View,  
and i am sure it is because of the organisation of my data


See here:


http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTreeController_Class/Reference/Reference.html

(the overview), and here:

	http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/CntrlContent.html#/ 
/apple_ref/doc/uid/TP40002147-185041


You're basically going to need an additional set of objects that  
represent the servers, each of which has an array of volumes. The  
trick is making sure that they all properly respond to the  
"children", "countOfChildren" and "isLeaf" property names that you  
specify to the tree controller.


In the simplest case, you just just need a "children" property:

Dictionary 0
serverName = Server1
VolumeName = @""
children = {Dictionary 1, Dictionary 2, Dictionary 3}

Dictionary 1
serverName = Server1
VolumeName = Volume1
children = {}

Dictionary 2
serverName = Server1
VolumeName = Volume2
children = {}

Dictionary 3
serverName = Server1
VolumeName = Volume3
children = {}

and then bind either the server dictionary as the content object for  
the tree controller or (if there are multiple servers) an array of  
server dictionaries as the content array.



___

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]


OutlineView, bindings and array of NSDictionaries.

2008-11-17 Thread Sandro Noel

Greetings!

Once again, I am faced with a problem :)

I cant seem to get my data to display properly in the Outline View,  
and i am sure it is because of the organisation of my data that it  
does not display

so I'm asking you guy's to sugest some ideas.

I have an array of Dictionaries the dictionary is organised like this.

"ServerName"
"VolumeName"
"TransportName"
"MountDirectory"
"UserName"
"Password"
"Async"

I would like to use the ServerName as a root node (grouped) an then  
use the VolumeName as child nodes of that server name.

using bindings if possible. so for instance, if i had,

Dictionary 1
serverName = Server1
VolumeName = Volume1

Dictionary 2
serverName = Server1
VolumeName = Volume2

Dictionary 3
serverName = Server1
VolumeName = Volume3

in the outline view they would be displayed as:

> Server 1
Volume1
Volume2
Volume3

is that at all possible with my model, or do i have to change the  
model to fit with some requirements ?
I cant find a tutorial on the outline view that explains how to use  
bindings in this way.


Thank you!
Sandro Noel.
___

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: Two arrays sharing the same adress space.

2008-11-17 Thread Sandro Noel
Thank you all, for taking the time to explain the workings this was  
very instructive and very apreciated!!!


Thank you
Sandro Noel.

___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

OK.
the double initialization was the problem.
the first init was giving me a pointer, and the second one was  
returning nothing because the file did not exist,

and i guess the compiler was reusing it...

the problem was fixed like this, sorry for the confusion guy's and  
thanks for the help.

I guess it's past my bed time...

NSFileManager *fileManager;
fileManager = [NSFileManager defaultManager];
		if ( [fileManager fileExistsAtPath:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@"Bonjour Mounter.plist"]  
isDirectory:NULL] ) {
			mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@"Bonjour  
Mounter.plist"]];

}
else{
mounts = [[NSMutableArray alloc] init];
}


On 17-Nov-08, at 12:52 AM, Sandro Noel wrote:

as it turns out. with the bug fixed the mounts array is left null  
because the file does not exist yet.
so further in the program is i try to add to the array, nothing  
happens.


and if i try "mounts = [[NSMutableArray alloc] init];" only the two  
arrays get the same pointer.


	transportTypes = [NSArray  
arrayWithObjects:@"afp",@"smb",@"cifs",@"nfs",nil];


		mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@"Bonjour  
Mounter.plist"]];	


bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];

AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@"_afpovertcp._tcp." domain:nil];
[SMBScanner searchForService:@"_smb._tcp." domain:nil];
[NFSScanner searchForService:@"_nfs._tcp." domain:nil];

}
return self;
}

On 17-Nov-08, at 12:47 AM, Charles Steinman wrote:

Have you fixed the [mounts initWithContentsOfFile:...] bug and it  
still happens?


Cheers,
Chuck



- Original Message 

From: Sandro Noel <[EMAIL PROTECTED]>
To: Scott Ribe <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, November 16, 2008 9:16:15 PM
Subject: Re: Two arrays sharing the same adress space.

I'm actually checking here in this function.

- (IBAction)mountSomeServers:(id)sender
{

  NSDictionary *mountDictionary;

  mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
 [server stringValue], ServerNameKey,
 [share stringValue], VolumeNameKey,
 [type title], TransportNameKey,
 @"", MountDirectoryKey,
 [user stringValue], UserNameKey,
 [password stringValue], PasswordKey,
 [NSNumber numberWithBool:YES], AsyncKey, NULL];
  [mounts addObject:mountDictionary];

this is the only place where objects are being added to the mount  
array.


I checked the init function and as soon as the bonjourServices  
array is

initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what  
i can deduce

it's because the mounts array is empty
at the time, because the file it is trying to load does not exist  
yet.


I'm just guessing here, I've never encountered that kind of  
problem in 17 years

of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem  
in any of my

other cocoa programs.

Sandro Noel.

On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:

This is a debug built, and I'm checking in the code where mounts  
is

being assigned objects


Which, if I recall correctly, is before bonjourServices is  
allocated. What

do you think the problem is?

--Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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/acharlieblue%40yahoo.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-admin

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
as it turns out. with the bug fixed the mounts array is left null  
because the file does not exist yet.

so further in the program is i try to add to the array, nothing happens.

and if i try "mounts = [[NSMutableArray alloc] init];" only the two  
arrays get the same pointer.


	transportTypes = [NSArray  
arrayWithObjects:@"afp",@"smb",@"cifs",@"nfs",nil];


		mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@"Bonjour  
Mounter.plist"]];	


bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];

AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@"_afpovertcp._tcp." domain:nil];
[SMBScanner searchForService:@"_smb._tcp." domain:nil];
[NFSScanner searchForService:@"_nfs._tcp." domain:nil];

}
return self;
}

On 17-Nov-08, at 12:47 AM, Charles Steinman wrote:

Have you fixed the [mounts initWithContentsOfFile:...] bug and it  
still happens?


Cheers,
Chuck



- Original Message 

From: Sandro Noel <[EMAIL PROTECTED]>
To: Scott Ribe <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, November 16, 2008 9:16:15 PM
Subject: Re: Two arrays sharing the same adress space.

I'm actually checking here in this function.

- (IBAction)mountSomeServers:(id)sender
{

   NSDictionary *mountDictionary;

   mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
  [server stringValue], ServerNameKey,
  [share stringValue], VolumeNameKey,
  [type title], TransportNameKey,
  @"", MountDirectoryKey,
  [user stringValue], UserNameKey,
  [password stringValue], PasswordKey,
  [NSNumber numberWithBool:YES], AsyncKey, NULL];
   [mounts addObject:mountDictionary];

this is the only place where objects are being added to the mount  
array.


I checked the init function and as soon as the bonjourServices  
array is

initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what  
i can deduce

it's because the mounts array is empty
at the time, because the file it is trying to load does not exist  
yet.


I'm just guessing here, I've never encountered that kind of problem  
in 17 years

of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem in  
any of my

other cocoa programs.

Sandro Noel.

On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:


This is a debug built, and I'm checking in the code where mounts is
being assigned objects


Which, if I recall correctly, is before bonjourServices is  
allocated. What

do you think the problem is?

--Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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/acharlieblue%40yahoo.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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

I'm actually checking here in this function.

- (IBAction)mountSomeServers:(id)sender
{

NSDictionary *mountDictionary;

mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
   [server stringValue], ServerNameKey,
   [share stringValue], VolumeNameKey,
   [type title], TransportNameKey,
   @"", MountDirectoryKey,
   [user stringValue], UserNameKey,
   [password stringValue], PasswordKey,
   [NSNumber numberWithBool:YES], 
AsyncKey, NULL];
[mounts addObject:mountDictionary];

this is the only place where objects are being added to the mount array.

I checked the init function and as soon as the bonjourServices array  
is initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what i  
can deduce it's because the mounts array is empty

at the time, because the file it is trying to load does not exist yet.

I'm just guessing here, I've never encountered that kind of problem in  
17 years of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem in  
any of my other cocoa programs.


Sandro Noel.

On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:


This is a debug built, and I'm checking in the code where mounts is
being assigned objects


Which, if I recall correctly, is before bonjourServices is  
allocated. What

do you think the problem is?

--
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

Forgot to answer the first question.

This is a debug built, and I'm checking in the code where mounts is  
being assigned objects


I have not enabled any optimization that I know of ...

Sandro Noel.

On 16-Nov-08, at 11:37 PM, Scott Ribe wrote:

At what point in the code are you checking? Is this a release build,  
or a

debug build in which you've gone & enabled some optimizations?

In the code you posted mounts is init'd (twice actually, which is
unecessary), then never used. It's perfectly possible that the two  
variables
mounts & bonjourServices will be stored in the same register-- 
depending on

compiler settings.

In other words, the two arrays would certainly have different  
addresses. But
since you're not referring to mounts after it's initialized, the  
space where
the pointer to mounts is stored can be reused to store the different  
pointer

to bonjourServices.

Step it line by line, and watch the values of those variables. Or  
actually
do something with mounts later in the method. Or get rid of mounts  
if you're

not going to use it.

--
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

Scott.

thank you for your explanation.

Mounts is being used, but just not in the init function.
it is being used later in the code.

that is why i was geting confused because the 2 arrays, are not meant  
to hold the same type of data.

and right now, they contain mixed data type.

witch makes my other functions crash.

On 16-Nov-08, at 11:37 PM, Scott Ribe wrote:

At what point in the code are you checking? Is this a release build,  
or a

debug build in which you've gone & enabled some optimizations?

In the code you posted mounts is init'd (twice actually, which is
unecessary), then never used. It's perfectly possible that the two  
variables
mounts & bonjourServices will be stored in the same register-- 
depending on

compiler settings.

In other words, the two arrays would certainly have different  
addresses. But
since you're not referring to mounts after it's initialized, the  
space where
the pointer to mounts is stored can be reused to store the different  
pointer

to bonjourServices.

Step it line by line, and watch the values of those variables. Or  
actually
do something with mounts later in the method. Or get rid of mounts  
if you're

not going to use it.

--
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
I just declared a third NSMutableArray to see if that one would have a  
different pointer, and well it had the same pointer somehow...

what is this ?

is it some type of setting ?

Sandro Noel.

On 16-Nov-08, at 11:22 PM, Sandro Noel wrote:


Greetings.

I'm having a weird behaviour, i have 2 arrays declared in the same  
controller, and for some reason they both share the same memory space.
well actually in debug they share the same pointer, witch is not  
something I asked for.


the bonjourservices and the mounts array's are the ones geting the  
same pointer.


here is my code.

NSMutableArray *bonjourServices;
NSMutableArray *mounts;


		transportTypes = [NSArray  
arrayWithObjects:@"afp",@"smb",@"cifs",@"nfs",nil];


mounts = [[NSMutableArray alloc] init];
		[mounts initWithContentsOfFile:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@"Bonjour Mounter.plist"]];	


		// the bonjourScanner sends a notification when the content of the  
passed array is modified, we will pick it up here.

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(bonjourServiceNotigficationUpdate)
 name:SERVICE_ADD_REMOVE_NOTIFICATION
 object:nil];

bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];
AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@"_afpovertcp._tcp." domain:nil];
[SMBScanner searchForService:@"_smb._tcp." domain:nil];
[NFSScanner searchForService:@"_nfs._tcp." domain:nil];

did anyone ever have that kind of problem ? i'm a little puzzled,
thank you ...

Sandro Noel.

___

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]


Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

Greetings.

I'm having a weird behaviour, i have 2 arrays declared in the same  
controller, and for some reason they both share the same memory space.
well actually in debug they share the same pointer, witch is not  
something I asked for.


the bonjourservices and the mounts array's are the ones geting the  
same pointer.


here is my code.

NSMutableArray *bonjourServices;
NSMutableArray *mounts;


		transportTypes = [NSArray  
arrayWithObjects:@"afp",@"smb",@"cifs",@"nfs",nil];


mounts = [[NSMutableArray alloc] init];
		[mounts initWithContentsOfFile:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@"Bonjour Mounter.plist"]];	


		// the bonjourScanner sends a notification when the content of the  
passed array is modified, we will pick it up here.

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(bonjourServiceNotigficationUpdate)
 name:SERVICE_ADD_REMOVE_NOTIFICATION
 object:nil];

bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];
AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@"_afpovertcp._tcp." domain:nil];
[SMBScanner searchForService:@"_smb._tcp." domain:nil];
[NFSScanner searchForService:@"_nfs._tcp." domain:nil];

did anyone ever have that kind of problem ? i'm a little puzzled,
thank you ...

Sandro Noel.

___

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]


Mounting AFP Programatically.

2008-11-13 Thread Sandro Noel

Greetings.

I would like to mount the drives off a server programatically without  
having the window open itself when the drive is mounted.
I've tried a shell script, the drive does get mounted but it does not  
sow up on the desktop like it should.

I can see it in the finder tho.

can anyone point me towards the right framework ?

Thank you!
Sandro Noel.

___

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: Hud window controls

2008-10-23 Thread Sandro Noel

Thank you pretty cool stuff 

Sandro

On 23-Oct-08, at 5:52 PM, Kiel Gillard wrote:

This framework looks pretty good too <http://www.binarymethod.com/content/bghudappkit.php 
>


Kiel

On 24/10/2008, at 3:06 AM, I. Savant wrote:

On Thu, Oct 23, 2008 at 11:52 AM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:


I am trying to design a HUD window, but the controls (buttons,  
edit boxes)

don't fit color wise, is there a property i should set
to have them look like the hud window?


There are no properties available to control this (they're all
Apple's own custom stuff), but there is this:

http://lipidity.com/apple/ilife-controls-hud-windows-and-more

It looks alright but I haven't tried it personally.

--
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/kiel.gillard%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]


Hud window controls

2008-10-23 Thread Sandro Noel

Greetings.  

I am trying to design a HUD window, but the controls (buttons, edit  
boxes) don't fit color wise, is there a property i should set

to have them look like the hud window?

thank you.
Sandro 
___


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: Instruments leaks.

2008-10-12 Thread Sandro Noel

Fritz.

description is a local function variable, but at this particular point  
it is getting replaced by the new assignation.

description = [description trimWhiteSpace];

and access to the pointer of the old value will be lost.
at least that's what I understand.

but i wonder, will the variable automatically be released when it  
falls out of scope? i don't think so but i  might be wrong.

i'll have to look it up in the doc again :)

Thank you for the language correction :) i'll remember it :)
Sandro.


On 12-Oct-08, at 10:35 AM, Fritz Anderson wrote:


On 11 Oct 2008, at 11:31 PM, Sandro Noel wrote:

for instance, the leek tells me that i have a leek here in this  
functions.

it is a NSString categorie.


- (NSString *) trimWhiteSpace {

NSMutableString *s = [[self mutableCopy] autorelease];

CFStringTrimWhitespace ((CFMutableStringRef) s);

return (NSString *) [[s copy] autorelease];
} /*trimWhiteSpace*/


and the way the function is being used is like this.

description = [description trimWhiteSpace];

i'm still looking into understanding, so it's kind of hard for me  
to be more precise, i'm sorry...


The question is then what happens to the "description" pointer later.

Suppose "description" is an instance variable. Do you later retain/ 
copy it? When you make the assignment you show, into "description,"  
do you first release/autorelease the old value (if you had retained/ 
copied/alloced it)?


It's that sort of history, of what you do later with the pointer,  
that determines whether the pointer has been leaked.


Another thought: It appears you are not using garbage collection,  
but are you? I understand -- someone please correct me --  
Instruments/Leaks is not accurate under GC.


By the way, the word you want is "leak." A "leek" is a vegetable.

— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- <http://x3u.manoverboard.org/ 
>




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Instruments leaks.

2008-10-12 Thread Sandro Noel
Joar, thank you for the clear explanation, it will help with my leak  
research.


Sandro.

On 12-Oct-08, at 1:07 AM, j o a r wrote:



On Oct 11, 2008, at 9:31 PM, Sandro Noel wrote:

for instance, the leek tells me that i have a leek here in this  
functions.



So this is actually not really true. What leaks will initially tell  
you is where the leaked object was created. That's not the same  
thing as where that object was leaked. Leaks can't tell you exactly  
where the object was leaked, unfortunately. What it can tell you  
though, is all the places where the object was retained & released  
(and autoreleased). Using this information, you can typically figure  
out where you retained some object when you shouldn't have, creating  
a leak.


Example:

- (NSString *) giveMeAString {
// String created here. No memory management error at this 
point.
return [NSString stringWithString: @"A String"];
}

- (void) someMethod {
NSString *aString = [self giveMeAString];
		[aString retain]; // String retained here, but never subsequently  
released. This is a leak!

}

Notice how the string is created in one place, but how the actual  
memory management error that leaks that object happens elsewhere.



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: Instruments leaks.

2008-10-11 Thread Sandro Noel
for instance, the leek tells me that i have a leek here in this  
functions.

it is a NSString categorie.


- (NSString *) trimWhiteSpace {

NSMutableString *s = [[self mutableCopy] autorelease];

CFStringTrimWhitespace ((CFMutableStringRef) s);

return (NSString *) [[s copy] autorelease];
} /*trimWhiteSpace*/


and the way the function is being used is like this.

description = [description trimWhiteSpace];

i'm still looking into understanding, so it's kind of hard for me to  
be more precise, i'm sorry...


Sandro

On 12-Oct-08, at 12:20 AM, j o a r wrote:



On Oct 11, 2008, at 8:45 PM, Sandro Noel wrote:

most of the leeks are created by NSString's from functions i  
gathered off the net.


assignations like

var1 = [var1 message];

This created a leek because the string being replaced is never  
released.

or am I wrong.



You need to provide a bit more information:
Is "var1" an instance variable or local variable? How was the  
original value of var1 assigned? Is the object returned from "- 
message" autoreleased? Can you provide more code from the actual  
implementation?


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: Instruments leaks.

2008-10-11 Thread Sandro Noel
most of the leeks are created by NSString's from functions i gathered  
off the net.


assignations like

var1 = [var1 message];

This created a leek because the string being replaced is never released.
or am I wrong.

On 11-Oct-08, at 11:12 PM, j o a r wrote:



On Oct 11, 2008, at 7:58 PM, Sandro Noel wrote:

I'm in the optimizing phase of my little project and I'm trying to  
understand instruments to get most of the leeks out of my software.  
but instruments throws tons of leaked blocks for objects that  
should be auto-released, and objects that are still in use. how do  
I determine what is a leek and what is not ?



Put a log statement in their dealloc methods to verify that they're  
actually being deallocated.


NSLog(@"Dealloc: %@", self);

False positives from Leaks should be rare, but I'm sure that it can  
happen.


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]


Instruments leaks.

2008-10-11 Thread Sandro Noel

Greetings.

I'm in the optimizing phase of my little project and I'm trying to  
understand instruments to get most of the leeks out of my software.
but instruments throws tons of leaked blocks for objects that should  
be auto-released, and objects that are still in use.


how do I determine what is a leek and what is not ?

Thank you all.

Sandro.

___

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: comparing Strings.

2008-10-07 Thread Sandro Noel

Ok that's simple :) I Like it :)

thanks you all !!

On 7-Oct-08, at 6:32 AM, Negm-Awad Amin wrote:

NSArray* components = [source componentsSeperatedByCharactersInSet: 
[NSCharacterSet …]];

NSString* result = [components componentsJoinedByString:@""];


___

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]


comparing Strings.

2008-10-06 Thread Sandro Noel

Gretings.

i'm having a problem comparing some type of strings, for example the  
one giving me a problem right now.

is let's say in my database i have 4 version of the same string .

"sandro's computer"
"sandro's_computer"
"sandros computer"
"sandros_computer"

I would like them to compare as being equal,
is there a way I can mingle with the comparing routine
to ask it to ignore some characters in the comparison?

thank you!
Sandro.

___

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]


performSelectorOnMainThread Help

2008-10-06 Thread Sandro Noel

Greetings.

I need to gain a better understanding of performSelectorOnMainThread

I have my main window that had a delegate and the delegate spawns  
threads, once the threads(NSOperation) are done they return a string,
I use to do it thru a delegate but Core Data does not appreciate  
multiple access at the same time:)


so I looked at the synchronization mechanisms and I would like to use  
the performSelectorOnMainThread.


I defined a selector in my Aplication delegate like this.
- (void) updateAirDate:(ShowAirDateItem *)showAirDateItem;

and i call it from my thread like this.
[MyApp_AppDelegate  
performSelectorOnMainThread:@selector(updateAirDate:)  
withObject:airDate waitUntilDone:NO];


unfortunately, this gives me this message in the run log.
*** +[MyApp_AppDelegate updateAirDate:]: unrecognized selector sent to  
class


I know i'm not doing this right, but i cant figure it out... must be  
to simple.


could someone point me in the right direction ?

thank you !
Sandro.
___

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: XML XPath question

2008-10-01 Thread Sandro Noel

Chris,
thank you that worked just fine, to bad the piece of information i  
read did not mention that... :(


Sandro.

On 1-Oct-08, at 12:47 PM, Chris Patterson wrote:


Your XPath is almost correct, as far as I can tell. All you need to  
do is insert an "@" character before the "id" attribute predicate,  
like so:


".//data/department/[EMAIL PROTECTED]"[EMAIL PROTECTED]"]"


Chris Patterson   chris dot s dot patterson at gmail dot com
"The only problem with Microsoft is they just have no taste."
-- Steve Jobs 



___

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]


XML XPath question

2008-10-01 Thread Sandro Noel

Greetings.

I am trying to retrieve some specific data from a XML document.




abcd


efrh


ijkl


mnop




so I'm trying to query the XML document with the following XPath string.

[... stringWithFormat:@".//data/department/employe[id=\"[EMAIL PROTECTED]"]",  
[employeID stringValue]]


this returns no objects.

if i try the same line without th attribute in the query
[".//data/department/employe"]

I receive an array with all the employe records, witch is the expected  
behavior.


what am I doing wrong in the first query, the documentation says this.
.//part/chapter[1]/section[title="Path Expressions"]
The evaluation of a path expression works from left to right. This  
expression first gets all the elements named part and from that  
selects the first element named chapter; from that it gets all child  
elements named section, and from that sequence it returns the section  
element whose title is “Path Expressions”. XPath also lets you find  
attributes by name by using an at-sign (@) prefix. For example, the  
following path expression gets the modification date (an attribute) of  
the first chapter:




Thank you any help is appreciated.

Sandro.___

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]


Autostart item in user profile.

2008-09-25 Thread Sandro Noel

Gretings.

I would like my application to have the option to auto-start itself  
when the user log's in
but I cant seem to find information on how to do it in the  
documentation.
I'm probably not looking for the right keywords, could someone point  
me in the right direction ?


thank you !
Sandro.
___

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: NSOperation NSOperationQueue

2008-09-24 Thread Sandro Noel

Shawn.

Very clear, thank you 

Sandro.
On 24-Sep-08, at 12:18 PM, Shawn Erickson wrote:

On Wed, Sep 24, 2008 at 8:56 AM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:

Greetings.

I need a clarification about the NSOpration ans NSOperationQueue

I read in the documentation that the NSOperation itself is non  
concurrent.
and that i can program it to be, if I override this and that  
method. and

configure the runtime env.
I assume that means create my own threads(NSTasks).


I am not sure if the last sentence above shows some confusion on
thread and task or was just noting either could be used but just in
case...

NSTasks are processes each of which may have one or more threads.
NSThreads are threads each of which has a thread stack, thread  
context, etc.


A "concurrent" operation is called from the "managing" thread of the
operation queue and it is left up to the operation on how it wants to
execute its operation. For example it could do the computation
directly when main is called but that would prevent the operation
queue from moving on to another operation (likely defeats the purpose
of using a queue and run contrary to the intent of returning true to
isConcurrent). Or it could startup a thread or task to do the
operation or fire off an async request, etc (more inline with the
intent of isConcurrent) and return back to the operation queue
(allowing it to move onto the next operation).

A "non-concurrent" operation is called by a worker thread that the
operation queue manages. This operation will then run in this worker
thread and the operation queue can move onto other operations (since
the operation queue managing thread isn't blocked).

It basically means does the operation manage its own concurrency
(isConcurrent = YES) or does the operation queue need to do it for the
operation (isConcurrent = NO).

If I use NSOperation, override only the main method, I get a non  
concurrent

object to run a particular piece of code.
Stack these lovely objects in an operationQueue and set
setMaxConcurrentOperationCount to 4.
The Queue itself is the one managing the concurrency. and I will  
have 4

operations runing at the same time?


Correct assuming your operations don't state dependencies that
prevent concurrency, the system has the ability to execute 4 threads
(enough physical or virtual "cores", aka hyper threading) and current
system pressure doesn't prevent reaching max concurrency.

-Shawn


___

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]


NSOperation NSOperationQueue

2008-09-24 Thread Sandro Noel

Greetings.

I need a clarification about the NSOpration ans NSOperationQueue

I read in the documentation that the NSOperation itself is non  
concurrent.
and that i can program it to be, if I override this and that method.  
and configure the runtime env.

I assume that means create my own threads(NSTasks).

But the NSOperationQueue can be set to execute X number of  
NSOperations at the same time.
in fact you have to set a limit to this guy or else he executes all of  
them at the same time.
when execute and look at my logs strings they are all mixed up as if  
everything was running concurrently.


so is this the right assumption:)

If I use NSOperation, override only the main method, I get a non  
concurrent object to run a particular piece of code.
Stack these lovely objects in an operationQueue and set  
setMaxConcurrentOperationCount to 4.
The Queue itself is the one managing the concurrency. and I will have  
4 operations runing at the same time?


thank you!
Sandro
___

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: NsPredicateEditor

2008-09-21 Thread Sandro Noel

Thank you,  that did it!!!

Sandro.

On 21-Sep-08, at 7:24 PM, Chris Idou wrote:



There's one or two demo apps on the apple site. I think it's called  
PredicateEditorSample. If the editor is totally empty on start you  
may have to initialise it with an empty NSCompoundPredicate so that  
you can at least see the add button.


You can also search the archives for some tips.

--- On Thu, 9/18/08, Sandro Noel <[EMAIL PROTECTED]> wrote:


From: Sandro Noel <[EMAIL PROTECTED]>
Subject: NsPredicateEditor
To: "cocoa-dev Users" 
Date: Thursday, September 18, 2008, 10:12 PM
Greetings.

I would like to use NSPredicateEditor to build a filtering
string to
filter out items from an array.
but i cant seem to find a tutorial on the matter, and the
cocoa
documentation gets me lost, there is not enough information
in there
for me to really grasp what i should do to make it work, it
must be
one of those " it's so simple it's complicated
to understand"

would someone be so kind to explain how i can achieve this.

in the interface builder i have a NSPredicateEditor
I edited the templates that are in place in the designer,
I created an outlet for it in my controller and connected
them together.
but when I run the application the editor is empty.

then once he predicate is running i want to compare every
tiems in my
array with it, and delete from the array the items that do
not match.

thank you so much.

Sandro.
___

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/idou747%40yahoo.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: escaping a string

2008-09-21 Thread Sandro Noel

Oups, I did not think of that ... newbe error :)

Thanks.



On 21-Sep-08, at 4:25 PM, Andrew Farmer wrote:


On 21 Sep 08, at 11:14, Sandro Noel wrote:
so basically what i'm dooing here, is that if i find the caracter  
"d" and i'm at least 4 bytes into the file,
i check to see if the 4 caracters before my location contain the  
word "info", so then i know that my

current location is the start of the info values.


Or it's in the middle of a string which contains "infod" - perhaps  
the torrent contains a file called "infodump". The appropriate way  
to deal with the bencoded data is to parse it out into native data  
structures (NSArray and NSDictionary). Trying to take shortcuts like  
this will cause unpredictable errors.


___

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: escaping a string

2008-09-21 Thread Sandro Noel

Stephen.

I'm really new at a lot of things at this point in time...(torrents,  
cocoa, binary format, )
in this litle adventure of mine, so please excuse if the questions  
seem a little beginner's type.


Would this function make more sense?
is this the "right way to do it" ?

so basically what i'm dooing here, is that if i find the caracter "d"  
and i'm at least 4 bytes into the file,
i check to see if the 4 caracters before my location contain the word  
"info", so then i know that my

current location is the start of the info values.

the info values typically go to the end of the file so I grab  
everything (length - location)


then call the hashing function, use the code to convert it to string  
and return that data.




typedef struct {
NSUInteger  length;
NSUInteger  offset;
const char  *bytes;
} BEDataStruct;

+(id)sha1HashFromEncodedData:(NSData *)sourceData
{
BEDataStruct data;
data.bytes = [sourceData bytes];
data.length = [sourceData length];
data.offset = 0;
NSData *infoDirectory;

while (data.offset < data.length) {
// we want to check if the 4 caracters before are the string 
"info"
		if ((data.bytes[data.offset] > 4) && (data.bytes[data.offset] ==  
'd') &&
			(data.bytes[data.offset-4] == 'i') && (data.bytes[data.offset-3] ==  
'n') &&
			(data.bytes[data.offset-2] == 'f') && (data.bytes[data.offset-1] ==  
'o') ){

// we now have the location of the info directory.
NSRange range;
range.location = data.offset;
range.length = (data.length - data.offset);
infoDirectory = [sourceData subdataWithRange:range];
NSData *sha1 = [infoDirectory sha1Hash];

// code taken from sugested function
			NSMutableString *stringBuffer = [NSMutableString stringWithCapacity: 
([sha1 length] * 2)];

const unsigned char *dataBuffer = [sha1 bytes];
int i;
for (i = 0; i < [sha1 length]; ++i)
[stringBuffer appendFormat:@"%02X", (unsigned 
long)dataBuffer[ i ]];
return [[stringBuffer copy] autorelease];
}
data.bytes++;
}
return nil;
}


By the way, I took some code from another bencoding class I found.
and the hash generated by this looks like this.
915C2524D383CB49C67F8EC2A684BB207707

used in the url it looks like this, but it does not work.
http://eztv.tracker.thepiratebay.org/scrape?info_hash=915C2524D383CB49C67F8EC2A684BB207707
i even tried it like this just in case... :)
http://eztv.tracker.thepiratebay.org/scrape?info_hash=915c2524d383cb49c67f8ec2a684bb207707

the tracker replies : Invalid Request

Thank you so much for your help... it's really appreciated.
Sandro.

___

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: escaping a string

2008-09-20 Thread Sandro Noel

Mike, thank you for the explanation,
I am using NSData to unbencode the torrent file.
ans sucessfully store it to a NSDictionary, "plist" so i can read it  
outside the software.

that works just fine...


The sha1 hash data is embedded raw, right in the file.
No escaping is done, because there is no need: the length of the  
data is given in the file.


The Data that needs to be used to create the SHA1 Hash is the data of  
the "info" key in raw bencoded form.


How would you go about extracting just that part of the data, if  
converting it to string is not the right way to go.

This is how i do it :  but obviously this does not work.

NSData *torrentData = [[NSData alloc]initWithContentsOfURL:[NSURL  
URLWithString:itemLink]];

if (0 < [torrentData length]){
	NSString *torrentString = [[[NSString alloc]initWithData:torrentData  
encoding:NSASCIIStringEncoding]autorelease];

// find the range of the info section.
	NSRange infoRange = [torrentString rangeOfString:@"4:info"  
options:NSCaseInsensitiveSearch];
	torrentString = [torrentString substringFromIndex:(infoRange.location  
+ infoRange.length)];
	torrentString = [torrentString substringToIndex:[torrentString  
length]];

NSString *infoHash = [torrentString sha1HexHash];
}

sorry Honestly I had no clue that string escaping was so broad, if i  
did, i'd never chosen that subject :)
thanks for explaining, there is no mention on the documentation on  
what type of escaping that need to be done

on the torrent data.

Thank you for your help.
Sandro
___

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]


escaping a string

2008-09-20 Thread Sandro Noel

Greetings.

i'm playing around with the torrent specification. and i'm trying to  
talk to a tracker.

for that i need to generate an info_hash
acording to the protocol definition the string needs to be escaped.

The 20 byte sha1 hash of the bencoded form of the info value from the  
metainfo file. Note that this is a substring of the metainfo file.  
This value will almost certainly have to be escaped.


my question here, if anyone has done that in the past, in cocoa, how  
was it done.
and if you have any pointers on "escaping" a string in cocoa, any  
information would be usefull..


i've tried
torrentString = [torrentString  
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];

and
torrentString = [torrentString  
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


they both produce a null string, so obviously this is not it...
if it can help this is the string I have to escape.

start here--
6:lengthi367464134e4:name48:Stargate.Atlantis.S05E09.HDTV.XviD-0TV. 
[VTV].avi12:piece lengthi1048576e6:pieces7020:‹Olz;hBfï/k	 
Òîvd˙Ù̉0>j’+‡;|8_Wg
Ü:∏ˇHPR‰¯÷ó·êÎ∆BABÄ"<Ñgÿ| 
%Fˇ,Âw8th˜U*ÏâUR(‰¤F1>ÑìΩ‘•

o…ˆsÆ
eƒÎûÍCH	˙¥¸û∆Â, œ6Pn˙¡‡¯| 
ÑNù∆àoÏˇqÈxR4‰ù⁄Ñjˇ… 
gMÜÊ 
®~‡c>[EMAIL PROTECTED](ÚÇ˝˛V‹– 
ã⁄TA( ûsØæ>[EMAIL PROTECTED] 
¥ÈtNÜuØ˘æk›¿Úê踇R%Ë«π€®ÅŸ 
¢YÕ◊`⁄o˘ãe˝s¥„îl0æÇ∫hÍÒedÈ∞g^h"An0˚H/˜¬R 
$Y∏ŸCEæ/˙ˇ§≤¶$“GÊA§wnÂñ'é[~›ãϱU˝‡-¯øö 
$û˚U|˜¯0⁄4¯ª‰ÜNNz†OÖ˛tbåùèZ√≥0(¿®ˆ 
¤z≠Åx~mˇ}˙S]˚·ölk.∫≈ÿô/OV`ɉp]U¡o 
¤Nu'[¥˘áπÙÁ2ñ€ç! ŒDRê8M„«x≈≈qfi•GÌèÙK,d  
kQg≠E}ılå´#ô8Ù©?Â~

õ∫–Üá"€öıÎ
∂ÖHV5Ô}‹|ÏÂV¥
•›ZdÎÕ
cüsqÄfi}Ã58<ëq	ƒöƒlïÔ èıI≈º⁄•óR9Z/ 
í÷∫Ê©êyÂYŒ≤w	VZ~N˘Y"D"!–¶√≠ª… 
¨S‡¸Ê¯√ëâñ€f– 
® 
 
xÜ]T˚m§¿∆<:lŸmùô𕆩Cóm]MjÅWvy9«Ÿòµó∑ªÇÚ  
∫5ûéÔL‡ù∂¨ù"M©;“Áã≠lÍA#ÈX[ã≥t$l∏C<≈?ïO 
+7kΩó·Ç†\0:‹fl‘∆Øâˇùˇ¥+!<º¡(Ÿ£UZà0Ÿ  
FÑOµ™$ï\ùz¬Mi/A†WÉb=à~¢?Q2ä/êhô•õ˘™ÿ  
I'QŸ=†u^’ΩÈ)÷2Mœ,CbÃfl≥ÒÜfØÊòæ=⁄2“r

M∞LÅ3nB≠ó¤\‰p√¢…¨Y+?ã◊;ıÈÏØ^¡
ò§Óç9òæv¥c©ÑZÜj‚ÿ=ºÏ$5Ÿ£§ÔÑe*Ÿ«BÇ8flv. 
‡fl1A#‹¤I9kπ†M—åÇ$¡ÍdãhEıbã[”kl}p8w⁄– 
MPÀ.p’»√ 4PÉ„°¿•(u;fiiÜÒGΩ§U&UR—◊“≠ö| 
^ 
ÊôJAZcz'3ª≠úÁ„–}:.¬gÉÈõF˘Ø¶pr˙vÚ";kq[Äô 
‰C\ÍÕV笺ïÙQ2Ã:/≥Á%õçÓÆÚãªø‹– 
∞áËÃ8˝NHY‹“îãd%âÍ¥1•˝º‘‚°åÍçù 
¥[82qfl∞πpâ≈›U÷+™±Å3Tï∆kV£‹ÄÒH¸Kÿ)9æ¶
f.RÁ'O欶Ÿñgfl≤bÅm˙X≠¤j·±ÕÌUÕmK 
¤Ã]Ê>•:«6_.˝å

Å≠~flfiàu€âÌÁq¥èNSa“¬Óå§{o≤+åT
[EMAIL PROTECTED] 
°#sì≠Rf<¢Ô≈&Œƒ¢=Æ	G≈Ωπ:ó±û6’yÁ

WüÂ’27tjÉ≈%‚Ø£¤Dé±8â˛Ë…≥
»;=‚zä}ãHiáÏúUêˆå¤‘Xé´§=ÇWÙ∂*∂®ïQÌ´œ$ɯ 
‰V”X±ÇîáPÀ£fF˝;¥ºëÜ∑Õ†Ó»©√¶c| 
°k`˝Ôö`ÆJËï∞‡≤p1’àÔÀ∂* 
\≥ïπƒŒÿØ◊Jîâ3ø£á5·c 
´4b0C≠¬)ºW8=•Ï∂∆ZsñJMJû^;8=|wy|ƒˆóJÌ 
0“ËX´‘W‚ª†~a~÷ä”M>è◊§OÆP  
˘∞πë*Ç"T5ª#õÿ,ØF‰Ò’S÷ßn,ˆ_æ†∞!óèc˚+ 
{jj9ÁSÿ∞oµÄ¡XgÿaP√oëö“•ùbM3Z˙– 
7˝≠Ælfi˘Ay˘ñ3TË‚û¸%˛g	à"+*Ê~â3Cï- 
~zï*à3ÎOM'ìD˘·Õ±êAÙQÁ≈õ¿ÂóYõñ?/ 
Óf8ºˇΩÈ’öN#á!¨XAe≤Æß”ÓMâ~Å¡∏Ê 
¤hƒ¯Èrbr≠ÃíÖyNWÅßp$p 
[EMAIL PROTECTED]([EMAIL PROTECTED]<ë⁄ı™Zàœ2¤ufwüÏ	ƒø˜bpEuT
_=dÈyµZ≠¶SBÆ©W⁄'Çeâ‘´TE.˙Yà’Dy(uˇbÂ> 
%i†zókr‚+Lêï¶ØÁ¸"[EMAIL PROTECTED])Oπ(	 
§Gòø›Òeˇ>ee

end HERE--

thank you
Sandro.___

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]

NsPredicateEditor

2008-09-18 Thread Sandro Noel

Greetings.

I would like to use NSPredicateEditor to build a filtering string to  
filter out items from an array.
but i cant seem to find a tutorial on the matter, and the cocoa  
documentation gets me lost, there is not enough information in there
for me to really grasp what i should do to make it work, it must be  
one of those " it's so simple it's complicated to understand"


would someone be so kind to explain how i can achieve this.

in the interface builder i have a NSPredicateEditor
I edited the templates that are in place in the designer,
I created an outlet for it in my controller and connected them together.
but when I run the application the editor is empty.

then once he predicate is running i want to compare every tiems in my  
array with it, and delete from the array the items that do not match.


thank you so much.

Sandro.
___

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: alloc]init] VS new]

2008-09-18 Thread Sandro Noel

Woua cool ...
Thank you Nick!

my assumption was incorrect.


Sandro

On 18-Sep-08, at 5:04 PM, Nick Zitzmann wrote:



On Sep 18, 2008, at 2:50 PM, Sandro Noel wrote:


couls someone point me to the doc ?



>


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



___

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

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

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

This email sent to [EMAIL PROTECTED]


alloc]init] VS new]

2008-09-18 Thread Sandro Noel

Greetings.

I'm looking thru the examples for NSOperation <-- my god thread made  
easy, what a dream come true.


I noticed the [Object new] message instead of [[Object alloc]init]

i've been looking for the diference, and couls not yet find it in the  
documentation.

could someone explain ?

what i'm thinking is that the "new" message creates "alloc-init- 
autorelease" object,

but that's just a beginer's assumptions.

couls someone point me to the doc ?

thank you all !!
Sandro.
___

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: 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 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

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]


Core Data Bindings. weird behavior.

2008-08-12 Thread Sandro Noel

Greetings.  

I'm having a weird behavior with the bindings and core data.
i'm sure it's the way the bindings are set that causes my problem but  
i can not find the answer.

so i'll ask you guy's :)

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


does this make any sense?

Sandro.
thank you again.!
___

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 question

2008-08-10 Thread Sandro Noel

Graham.
Wow, that worked ...
Thank you so Much !

Sandro.

On 10-Aug-08, at 9:51 PM, Graham Perks wrote:


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

So I think my question here, is, what should I use when inserting a  
detail object to properly set the relationship to Account.
some example on how I should approach the problem would be nice, or  
a step-by-step :D


I do this, where I have an EventImage that refers back to a main  
Event, "self" is the managed object for the Event, which is your  
Account:



// create new EventImage, this would be akin to your  
AccountDetails

imageHolder = (EventImage*)
[NSEntityDescription  
insertNewObjectForEntityForName:@"EventImage"
  inManagedObjectContext: 
[self managedObjectContext]];


[imageHolder setImage:image]; // set some data in the  
new object


// Add reference from Event to it's Image
[self setValue:imageHolder forKey:@"imageHolder"];

	// Add the reverse relationship, from the image back to the  
event.

[imageHolder setValue:self forKey:@"event"];



___

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 question

2008-08-10 Thread Sandro Noel

Graham.
Thank you for the code.

so what I should do if I understand your code, is fetch my account's  
managed object,

before i insert any details.

Sandro.

On 10-Aug-08, at 9:51 PM, Graham Perks wrote:


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

So I think my question here, is, what should I use when inserting a  
detail object to properly set the relationship to Account.
some example on how I should approach the problem would be nice, or  
a step-by-step :D


I do this, where I have an EventImage that refers back to a main  
Event, "self" is the managed object for the Event, which is your  
Account:



// create new EventImage, this would be akin to your  
AccountDetails

imageHolder = (EventImage*)
[NSEntityDescription  
insertNewObjectForEntityForName:@"EventImage"
  inManagedObjectContext: 
[self managedObjectContext]];


[imageHolder setImage:image]; // set some data in the  
new object


// Add reference from Event to it's Image
[self setValue:imageHolder forKey:@"imageHolder"];

	// Add the reverse relationship, from the image back to the  
event.

[imageHolder setValue:self forKey:@"event"];



___

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 question

2008-08-10 Thread Sandro Noel

Greetings.

I've read the documentation on core data over again, and I'm still  
confused about how to manipulate relationships.
every time I try an insert/add and there is a relationship involved,  
the insert crashes.

(programatically that is, bindings work just fine)

maybe, the way I think it is just not right, you see I think it in  
terms of SQL,
I've done SQL fir the past 17 years, so. it's kind of hard to think  
otherwise.


table Account
table Account details.
Relationship: Account <---one to many--->> AcountDetails

If I want to insert an account detail, the foreign key of that account  
detail will be linked to the Primary key of the Account.
usually I use the auto-incremented id's, if I enforce integrity on  
that relationship, there is no way I will be able to insert

an account detail if the account I want to link to is non existent.

If I want to use an specific account i'll just query the database and  
ask the user to choose an account, i'll keep it's ID

and use it for the future inserts.

In Core Data, I'm out of clues on how to insert an object that has a  
relationship.
I've tried to query the account table for the NSManagedObject, and  
assign it to the property account in my account details object.
but that failed. Then I tried using the account name as a string and  
assign it to the same property, and, well it failed.


So I think my question here, is, what should I use when inserting a  
detail object to properly set the relationship to Account.
some example on how I should approach the problem would be nice, or a  
step-by-step :D


Thank you in advance!
Sandro.


___

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 question

2008-08-08 Thread Sandro Noel

Chris, thank you!
the database itself is designed as a relational database would be,
it's quite large actually, I just posted here two tables to illustrate  
the problem.


The software I am building is a personal one, to help me track my  
budget.
the goal is to import my transactions at the end of every month, and  
compare
it to the budget, and the software will point out the out of budget  
spending habits so I can either budget them in,

or correct them.

I know other software out there do that, but it's a learning  
project ... to learn cocoa :)
and I want to make it really simple, import, compare, report. that's  
all.


>>Instead of different types of transactions, transactions always  
have debits and credits.
humm, not in the bank statement, they also have CHECK. and I want to  
track that too.



I retrieve/create/insert (not quite sure yet :)) an object from the  
context, and set the values like this.


NSManagedObject *transaction = [NSEntityDescription  
insertNewObjectForEntityForName:@"Transactions"

 inManagedObjectContext:[self 
managedObjectContext]];


This is inserting a new instance of that entity in the managed  
object context.


That's how he manual says to insert records, kind of works well, if  
you do not have relationships.
it crashes on me as soon as i have a relationship on the table i want  
to insert to.





The Transaction(tr) Object Used in the code above is defined like  
this:


@interface OFXTransaction : NSObject {


Why do you even have this class?  It looks like its whole purpose is  
to replicate what you already have defined in your Transaction  
entity.  You can just use an NSManagedObject subclass to represent  
one directly.


This class is the class used to import the data from my OFX file, My  
OFX importer has a class for every section of the OFX specification.




Yes, you will need to insert or fetch an instance of your  
TransactionType entity.  You'll just take that and set it as the  
value of your Transaction instance's transactionType relationship.



Cool, that's simple.


Hope this helps!


It does thanks Chris.

-- Chris



Sandro.
___

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 question

2008-08-08 Thread Sandro Noel


On 8-Aug-08, at 2:41 PM, Negm-Awad Amin wrote:
You should name your entities in the singular, as if you were  
naming classes, and you should name the properties (attributes &  
relationships) of your entities starting with a lower-case letter  
as if you were naming the properties of a class.
That is definetly correct, but if Apple would start call it an  
entity-type instead of using the term entity, less people would  
become confused. ;-)


Oups ... will do.

Sandro
___

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 question

2008-08-07 Thread Sandro Noel

Quincey & Marco,

Thank you guy's, Very helpful information!
:)


Sandro

On 6-Aug-08, at 3:31 PM, Sandro Noel wrote:



Greetings! :)

I'm experimenting with core data, bindings work just fine, I love  
them and it's great and all. :)
but I want to import a massive file into the database. so I'm trying  
to create it programatically.


So far I've been able to insert records in simple entities, using  
some code from the Core Data Documentation.
Where my problem lies, is with relationships, and data types other  
than NSString, so here comes the code.

--
I have entities like this.

TransactionTypes
Atributes : Name:String
Relationships: Transaction

Transactions
Atributes: Amount:Double, Date:Date, Memo:String, Payee:String
Relationships: TransactionType
---
I retrieve/create/insert (not quite sure yet :)) an object from the  
context, and set the values like this.


NSManagedObject *transaction = [NSEntityDescription  
insertNewObjectForEntityForName:@"Transactions"

 inManagedObjectContext:[self 
managedObjectContext]];

[transaction setValue:tr.transactionAmount forKey:@"Amount"];
[transaction setValue:tr.transactionType
forKey:@"TransactionType.Name"];

[transaction setValue:tr.displayName   forKey:@"Name"];
[transaction setValue:tr.memo  forKey:@"Memo"];
[transaction setValue:tr.datePostedforKey:@"Date"];

---
The Transaction(tr) Object Used in the code above is defined like  
this:


@interface OFXTransaction : NSObject {
NSString*transactionType;
	NSDate	  	*datePosted; //-mm-dd / converted from string  
20080201125910

NSNumber*transactionAmount;
NSString*uniqueID;
NSString*displayName;
NSString*memo;
}
@property (readwrite, copy) NSString*transactionType;
@property (readwrite, copy) NSDate  *datePosted;
@property (readwrite, copy) NSNumber*transactionAmount;
@property (readwrite, copy) NSString*uniqueID;
@property (readwrite, copy) NSString*displayName;
@property (readwrite, copy) NSString*memo;
-
Now, when I try to set the value for the [date] or [Amount] or  
[TransactionType], of the ManagedObject, i get an error:
*** -[NSCFString managedObjectContext]: unrecognized selector sent  
to instance 0xXeXX
The only thing that really works fine are the strings, I don't get  
it... must be a simple mistake from my part here.

or something I missed in the documentation...:S

another thing I would like to understand, do relationships work like  
constraints in SQL ?
in the sense that if there is no transactionType defined in the  
TransactionTypes Entity,
I would not be able to insert a value in the transactionType field  
of the transactions entity?


do I have to first select/fetch an object from the transactionsType  
entety, and assign that to the transactionType atribute of the

transactions entety...?


Again, thank you guy's for being there, and helping out the  
newcomers :)

Sandro.


___

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]


Core Data question

2008-08-06 Thread Sandro Noel


Greetings! :)

I'm experimenting with core data, bindings work just fine, I love them  
and it's great and all. :)
but I want to import a massive file into the database. so I'm trying  
to create it programatically.


So far I've been able to insert records in simple entities, using some  
code from the Core Data Documentation.
Where my problem lies, is with relationships, and data types other  
than NSString, so here comes the code.

--
I have entities like this.

TransactionTypes
Atributes : Name:String
Relationships: Transaction

Transactions
Atributes: Amount:Double, Date:Date, Memo:String, Payee:String
Relationships: TransactionType
---
I retrieve/create/insert (not quite sure yet :)) an object from the  
context, and set the values like this.


NSManagedObject *transaction = [NSEntityDescription  
insertNewObjectForEntityForName:@"Transactions"

 inManagedObjectContext:[self 
managedObjectContext]];

[transaction setValue:tr.transactionAmount forKey:@"Amount"];
[transaction setValue:tr.transactionType
forKey:@"TransactionType.Name"];

[transaction setValue:tr.displayName   forKey:@"Name"];
[transaction setValue:tr.memo  forKey:@"Memo"];
[transaction setValue:tr.datePostedforKey:@"Date"];

---
The Transaction(tr) Object Used in the code above is defined like this:

@interface OFXTransaction : NSObject {
NSString*transactionType;
	NSDate	  	*datePosted; //-mm-dd / converted from string  
20080201125910

NSNumber*transactionAmount;
NSString*uniqueID;
NSString*displayName;
NSString*memo;
}
@property (readwrite, copy) NSString*transactionType;
@property (readwrite, copy) NSDate  *datePosted;
@property (readwrite, copy) NSNumber*transactionAmount;
@property (readwrite, copy) NSString*uniqueID;
@property (readwrite, copy) NSString*displayName;
@property (readwrite, copy) NSString*memo;
-
Now, when I try to set the value for the [date] or [Amount] or  
[TransactionType], of the ManagedObject, i get an error:
*** -[NSCFString managedObjectContext]: unrecognized selector sent to  
instance 0xXeXX
The only thing that really works fine are the strings, I don't get  
it... must be a simple mistake from my part here.

or something I missed in the documentation...:S

another thing I would like to understand, do relationships work like  
constraints in SQL ?
in the sense that if there is no transactionType defined in the  
TransactionTypes Entity,
I would not be able to insert a value in the transactionType field of  
the transactions entity?


do I have to first select/fetch an object from the transactionsType  
entety, and assign that to the transactionType atribute of the

transactions entety...?


Again, thank you guy's for being there, and helping out the newcomers :)
Sandro.


___

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]


Interface Builder, tree view like Mac Mail or itunes

2008-08-03 Thread Sandro Noel

Hello!

I would like to know how to design an interface that resembles the Mac  
Mail application
most specifically, the tree view, I cant seem to set the proper  
properties in interface builder

to achieve the same thing...

so far, i've got the split view, and the right pane, just liek i want  
them,

but i can not get the tree view to behave.

Could any of you guru's out there point me in the correct direction?
Please :)


Thank you all!
Sandro.
___

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: Some crash.

2008-08-03 Thread Sandro Noel

Clark, thank you!
Great Example.

I just find it sad, that implementing KVC-KVO, is not enough to get  
the ball rolling,

and that i have to proxy my model classes to make it work. :(

I guess i'll have to rethink my Model classes :) and really separate  
functionality from data.

even if that functionality is manipulating the data itself.

Ah, still learning :)

Sandro.

On 3-Aug-08, at 11:56 AM, Clark Cox wrote:

On Sat, Aug 2, 2008 at 9:15 PM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:

Chris.

Thank you for the explaination!!

but it leaves me with a question, where should i use it.

I'm actually adding objects to the array, using addObject message,  
in the

model,
where should i use the mutableArrayValueForKey, and what keyPath  
should I

use.


My general strategy for this is to never access the instance variable
directly, except when implementing init, dealloc and the KVC
accessors. All other access (even from other methods of the same
class) uses the proxy returned by mutableArrayValueForKey:. Something
like:

@interface MyClass : NSObject {
 NSMutableArray *myObjects;
}

@end

@implementation MyClass

-(id)init {
 if(self = [super init]) {
   myObjects = [[NSMutableArray alloc] init];
 }
 return self;
}

-(void)dealloc {
 [myObjects release];
 [super dealloc];
}

-(NSUInteger)countOfMyObjects {
 return [myObjects count];
}

-(id)objectInMyObjectsAtIndex:(NSUInteger)index {
 return [myObjects objectAtIndex: index];
}

-(void)insertObject:(id)object inMyObjectsAtIndex:(NSUInteger)index {
 [myObjects insertObject: object atIndex: index];
}

-(void)removeObjectFromMyObjectsAtIndex:(NSUInteger)index {
 [myObjects removeObjectAtIndex: index];
}

-(void)doSomething {
 NSMutableArray *arrayProxy = [self mutableArrayValueForKey:  
@"myObjects"];


 [arrayProxy addObject: ...];
 [arrayProxy removeObjectAtIndex: ...];
 //Or any other NSMutableArray calls
}

@end


That way, all edits to the array provide the appropriate notifications
to any observing objects. It also allows me to change the
implementation at a future date, and only have to change the
accessors. The reason that it is safe to access the array directly in
init and dealloc is that another object can't yet be listening at the
time of init (also the reason that your code worked when you initially
filled the array), and by the time of -dealloc, all of the observers
should have stopped their listening.

the workflow is quite simple, the user selects a file, the  
controller calls

my model to load the file in various classes,
and one of the property of the model is transactions which is a
MutableArray,
that array is bound to the array controller, which is in turn  
providing the

tableview with data.

I'm new to cocoa... sorry bout that.
thank you for your help.


--
Clark S. Cox III
[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: Some crash.

2008-08-02 Thread Sandro Noel

Chris.

Thank you for the explaination!!

but it leaves me with a question, where should i use it.

I'm actually adding objects to the array, using addObject message, in  
the model,
where should i use the mutableArrayValueForKey, and what keyPath  
should I use.


the workflow is quite simple, the user selects a file, the controller  
calls my model to load the file in various classes,
and one of the property of the model is transactions which is a  
MutableArray,
that array is bound to the array controller, which is in turn  
providing the tableview with data.


I'm new to cocoa... sorry bout that.
thank you for your help.

On 2-Aug-08, at 8:08 PM, Chris Hanson wrote:


On Aug 2, 2008, at 2:07 PM, Sandro Noel wrote:

when the Array is filled on application init, the data displays  
fine, but if I add to the array "programatically"

the new data is not displayed, i've tried:  
[self didChangeValueForKey:@"transactions"];
and [transactionTableView reloadData];



If you're using bindings, you can't just manipulate an  
NSMutableArray instance variable directly and expect it to post KVO  
notifications.  And don't try to "cheat" and put KVO notifications  
around all of  the various manipulation of your mutable array,  
either; you'll clutter your code and wind up with subtle bugs if you  
forget one or use the wrong one in the wrong case.


Instead, just use -mutableArrayValueForKey: to get a proxy to the  
property and manipulate that.  It will post KVO notifications and  
also manipulate the instance variable that you have backing the  
property.  If you need to intercept the modifications to your  
property, you can override the mutable-array KVC methods described  
in  or in the Key-Value Coding Guide.


-- 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: Some crash.

2008-08-02 Thread Sandro Noel

Greetings.
I Do Have another question.

when the Array is filled on application init, the data displays fine,  
but if I add to the array "programatically"

the new data is not displayed, i've tried:  
[self didChangeValueForKey:@"transactions"];
and [transactionTableView reloadData];

But both have no effect.

any help is appreciated.
thank you all.

Sandro/



On 2-Aug-08, at 3:43 PM, Adam R. Maxwell wrote:



On Aug 2, 2008, at 11:03 AM, Sandro Noel wrote:


Greetings,

I don't quite know how to explain this.. :) so please excuse me if  
I'm not very precise.


[...]

2008-08-02 13:52:23.411 OFXImport[27702:10b] *** -[OFXTransaction  
copyWithZone:]: unrecognized selector sent to instance 0xf4fb80


Have you used the debugger to set a breakpoint on  
objc_exception_throw and see what's trying to copy your object?


--
Adam



___

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: Some crash.

2008-08-02 Thread Sandro Noel

Thanks guy's.

I figured it out, i'm using an array controller and my dataSource for  
the table view was set to my application controller.

instead of being set to the array controller.

the matter was resolved...

Sandro.


On 2-Aug-08, at 3:43 PM, Adam R. Maxwell wrote:



On Aug 2, 2008, at 11:03 AM, Sandro Noel wrote:


Greetings,

I don't quite know how to explain this.. :) so please excuse me if  
I'm not very precise.


[...]

2008-08-02 13:52:23.411 OFXImport[27702:10b] *** -[OFXTransaction  
copyWithZone:]: unrecognized selector sent to instance 0xf4fb80


Have you used the debugger to set a breakpoint on  
objc_exception_throw and see what's trying to copy your object?


--
Adam



___

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: Some crash.

2008-08-02 Thread Sandro Noel
I've tried enumerating the objects to the log, with a button on the  
interface.

and they are all still in memory, they are not being released.
all the items report.

anything else ?

Sandro.


On 2-Aug-08, at 2:06 PM, mm w wrote:


maybe a retain problem

On Sat, Aug 2, 2008 at 11:03 AM, Sandro Noel <[EMAIL PROTECTED]>  
wrote:

Greetings,

I don't quite know how to explain this.. :) so please excuse me if  
I'm not

very precise.

In my application controller i have an object "statement" that  
contains an

array of "transactions" called transactions.
here is the structure of transaction.
@interface OFXTransaction : NSObject {
  NSString*transactionType;
  NSDate  *datePosted;
  double  transactionAmount;
  NSString*uniqueID;
  NSString*displayName;
  NSString*memo;
}
@property (readwrite, copy) NSString*transactionType;
@property (readwrite, copy) NSDate  *datePosted;
@property (readwrite, assign)   double  transactionAmount;
@property (readwrite, copy) NSString*uniqueID;
@property (readwrite, copy) NSString*displayName;
@property (readwrite, copy) NSString*memo;

- (void) setStringDatePosted: (NSString *)dateString;
@end

In interface builder I've set my appController as the Datasource of  
the

tableview, implemented the methods for the table to load data.
the array controller is bound to "statement.transactions" as the  
keypath.
the table view is bound to the array controller, and each column is  
bound to

a field in the transaction class.

everything seems to be working good, except when i have a value in  
the

transactionAmount property.

can anyone enlighten me as for why it breaks ? please :)

I get this error.
2008-08-02 13:52:23.411 OFXImport[27702:10b] *** -[OFXTransaction
copyWithZone:]: unrecognized selector sent to instance 0xf4fb80
2008-08-02 13:52:23.412 OFXImport[27702:10b] An uncaught exception  
was

raised
2008-08-02 13:52:23.413 OFXImport[27702:10b] *** -[OFXTransaction
copyWithZone:]: unrecognized selector sent to instance 0xf4fb80
2008-08-02 13:52:23.413 OFXImport[27702:10b] *** Terminating app  
due to

uncaught exception 'NSInvalidArgumentException', reason: '***
-[OFXTransaction copyWithZone:]: unrecognized selector sent to  
instance

0xf4fb80'
2008-08-02 13:52:23.414 OFXImport[27702:10b] Stack: (
  2417631563,
  2425491707,
  2417660746,
  2417654092,
  2417654290,
  2519207652,
  2519290634,
  2519290371,
  2519978356,
  2519977828,
  2519975066,
  2519603468,
  2519598064,
  2520189316,
  2520183931,
  2520184850,
  2520184850,
  2520184850,
  2520184850,
  2520178129,
  2520176403,
  2520162871,
  2519379087,
  2519377981,
  2520146833,
  2520145384,
  2520350309,
  2519174399,
  2519133714,
  2519132020,
  2519131063,
  2519130869,
  2519130020
)



___

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]


Some crash.

2008-08-02 Thread Sandro Noel

Greetings,

I don't quite know how to explain this.. :) so please excuse me if I'm  
not very precise.


In my application controller i have an object "statement" that  
contains an array of "transactions" called transactions.

here is the structure of transaction.
@interface OFXTransaction : NSObject {
NSString*transactionType;
NSDate  *datePosted;
double  transactionAmount;
NSString*uniqueID;
NSString*displayName;
NSString*memo;
}
@property (readwrite, copy) NSString*transactionType;
@property (readwrite, copy) NSDate  *datePosted;
@property (readwrite, assign)   double  transactionAmount;
@property (readwrite, copy) NSString*uniqueID;
@property (readwrite, copy) NSString*displayName;
@property (readwrite, copy) NSString*memo;

- (void) setStringDatePosted: (NSString *)dateString;
@end

In interface builder I've set my appController as the Datasource of  
the tableview, implemented the methods for the table to load data.
the array controller is bound to "statement.transactions" as the  
keypath.
the table view is bound to the array controller, and each column is  
bound to a field in the transaction class.


everything seems to be working good, except when i have a value in the  
transactionAmount property.


can anyone enlighten me as for why it breaks ? please :)

I get this error.
2008-08-02 13:52:23.411 OFXImport[27702:10b] *** -[OFXTransaction  
copyWithZone:]: unrecognized selector sent to instance 0xf4fb80
2008-08-02 13:52:23.412 OFXImport[27702:10b] An uncaught exception was  
raised
2008-08-02 13:52:23.413 OFXImport[27702:10b] *** -[OFXTransaction  
copyWithZone:]: unrecognized selector sent to instance 0xf4fb80
2008-08-02 13:52:23.413 OFXImport[27702:10b] *** Terminating app due  
to uncaught exception 'NSInvalidArgumentException', reason: '*** - 
[OFXTransaction copyWithZone:]: unrecognized selector sent to instance  
0xf4fb80'

2008-08-02 13:52:23.414 OFXImport[27702:10b] Stack: (
2417631563,
2425491707,
2417660746,
2417654092,
2417654290,
2519207652,
2519290634,
2519290371,
2519978356,
2519977828,
2519975066,
2519603468,
2519598064,
2520189316,
2520183931,
2520184850,
2520184850,
2520184850,
2520184850,
2520178129,
2520176403,
2520162871,
2519379087,
2519377981,
2520146833,
2520145384,
2520350309,
2519174399,
2519133714,
2519132020,
2519131063,
2519130869,
2519130020
)



___

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]