Re: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
Perhaps I understand the problem...
NSString* imageName = [[NSBundle mainBundle] pathForResource:@"report" 
ofType:@"png"];if(imageName) {    // print the path for resource}
The path for resource is not displayed because the object 'imageName' is 
nil.Why this object is nil?I added the file "report.png" to the folder 
Resources of my project: I will check whether the image is actually into 
WhateverApp.app/Contents/Resources/
Thanks a lot!
Vincenzo
--- Mer 14/7/10, Wim Lewis  ha scritto:

Da: Wim Lewis 
Oggetto: Re: Adding an image to a project
A: "Cocoa-Dev List" 
Cc: "Vincenzo Morgante" 
Data: Mercoledì 14 luglio 2010, 19:52


On Jul 14, 2010, at 10:01 AM, Vincenzo Morgante wrote:
> I wrote the following code, but it does not work: the program crashes...
> NSString* imageName = [[NSBundle mainBundle] pathForResource:@"image1" 
> ofType:@"png"];
> IplImage *image = cvLoadImage([imageName UTF8String], ...);

That should work. Have you checked that 'imageName' actually holds the path to 
the image and is not nil? (If -pathForResource:ofType: fails, it will just 
return nil; and sending -UTF8String to nil will result in NULL, which perhaps 
cvLoadImage() does not check for.)

If you put the image into your project and add it to your application target, 
Xcode will automatically add it to a "Copy Files" build phase that places the 
image into WhateverApp.app/Contents/Resources/imagename.png. That is also the 
place that -pathForResource:ofType: will look for it. The link that Sam Reshu 
posted earlier explains this in more detail.

> Maybe the only solution is a copy pixel by pixel...
> If the source image is RGB, how can I get the pixel values? And what is the 
> range of these values? Are there integer or double?

This would be unnecessarily slow and complex, but you could do it in a couple 
of ways:
   - Look through the NSImage's representations array until you find an 
NSBitmapImageRep, and use -getBitmapDataPlanes: to get the data, and the other 
methods to figure out what format the data is in (lots of work, you need to 
handle many different possible pixel formats)
   - Find the NSBitmapImageRep and use -getPixel:atX:y: (very slow!)






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
You're right, but unfortunately the project deadline is near: after all, the 
goal of this university project on computer vision is another and therefore we 
prefer to concentrate on the real goal of the project.The image that we can not 
load should be used to display a simple report containing the results, so 
reluctantly I'd be happy even pixel by pixel copy from a NSImage object to an 
object IplImage.However, perhaps I understand the problem...
NSString* imageName = [[NSBundle mainBundle] pathForResource:@"report" 
ofType:@"png"];if(imageName) {    // print the path for resource}
The path for resource is not displayed because the object 'imageName' is 
nil.Why this object is nil?I added the file "report.png" to the folder 
Resources of my project: I will check whether the image is actually into 
WhateverApp.app/Contents/Resources/
Thanks a lot!
Vincenzo
--- Gio 15/7/10, Graham Cox  ha scritto:

Da: Graham Cox 
Oggetto: Re: Adding an image to a project
A: "Vincenzo Morgante" 
Cc: cocoa-dev@lists.apple.com
Data: Giovedì 15 luglio 2010, 01:49


On 15/07/2010, at 3:01 AM, Vincenzo Morgante wrote:

> I wrote the following code, but it does not work: the program crashes...

> Maybe the only solution is a copy pixel by pixel...


Code never crashes for no reason. And you have tools which will explain the 
reason, in excruciating detail if you want it, so find the problem and fix it. 
Why give up at the first whiff of trouble when the approach you're taking is 
basically right, and assume the solution must obtain by a ridiculously more 
complex and slow method?

--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: Adding an image to a project

2010-07-15 Thread Ron Fleckner

On 15/07/2010, at 5:18 PM, Vincenzo Morgante wrote:

> The path for resource is not displayed because the object 'imageName' is 
> nil.Why this object is nil?I added the file "report.png" to the folder 
> Resources of my project:

Hello Vincenzo,

just a wild guess from an amateur:  Did you just physically drag the image file 
into your project's folder in the Finder? I don't think that will be 
successful. I think you need to add it to your project via Xcode.  Right-click 
on the Resources folder in Xcode's files pane on left and choose "Add Existing 
files..." from the menu.

Ron

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
Right-click on the Resources folder in Xcode's files pane on left and 
choose "Add Existing files..." from the menu.
Then I selected the option "Copy..." in order to copy the image from the source 
folder.

Vincenzo

--- Gio 15/7/10, Ron Fleckner  ha scritto:

Da: Ron Fleckner 
Oggetto: Re: Adding an image to a project
A: "Vincenzo Morgante" 
Cc: cocoa-dev@lists.apple.com
Data: Giovedì 15 luglio 2010, 09:42


On 15/07/2010, at 5:18 PM, Vincenzo Morgante wrote:

> The path for resource is not displayed because the object 'imageName' is 
> nil.Why this object is nil?I added the file "report.png" to the folder 
> Resources of my project:

Hello Vincenzo,

just a wild guess from an amateur:  Did you just physically drag the image file 
into your project's folder in the Finder? I don't think that will be 
successful. I think you need to add it to your project via Xcode.  Right-click 
on the Resources folder in Xcode's files pane on left and choose "Add Existing 
files..." from the menu.

Ron





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Ron Fleckner
One last amateurish wild guess: does Xcode list the image along with all your 
source files and other files which are part of your project in the pane above 
the editor when you select the Target or Project icon in the Groups & Files 
list?  Does it list your image file in the Resources folder icon in the Groups 
& Files list?  If not, then the file is not actually added to the project.  If 
it is listed, then there's something very unusual about your project.  [NSImage 
imageNamed:@"report"] should Just Work™ as should the NSBundle method you 
showed.

???

Ron


On 15/07/2010, at 6:12 PM, Vincenzo Morgante wrote:

> Right-click on the Resources folder in Xcode's files pane on left and choose 
> "Add Existing files..." from the menu.
> Then I selected the option "Copy..." in order to copy the image from the 
> source folder.
> 
> Vincenzo
> 
> --- Gio 15/7/10, Ron Fleckner  ha scritto:
> 
> Da: Ron Fleckner 
> Oggetto: Re: Adding an image to a project
> A: "Vincenzo Morgante" 
> Cc: cocoa-dev@lists.apple.com
> Data: Giovedì 15 luglio 2010, 09:42
> 
> 
> On 15/07/2010, at 5:18 PM, Vincenzo Morgante wrote:
> 
> > The path for resource is not displayed because the object 'imageName' is 
> > nil.Why this object is nil?I added the file "report.png" to the folder 
> > Resources of my project:
> 
> Hello Vincenzo,
> 
> just a wild guess from an amateur:  Did you just physically drag the image 
> file into your project's folder in the Finder? I don't think that will be 
> successful. I think you need to add it to your project via Xcode.  
> Right-click on the Resources folder in Xcode's files pane on left and choose 
> "Add Existing files..." from the menu.
> 
> Ron
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
> One last amateurish wild guess: does Xcode list the image along with all your 
> source files> and other files which are part of your project in the pane 
> above the editor when you select> the Target or Project icon in the Groups & 
> Files list?Yes, it appears, but its role is empty...
> Does it list your image file in the Resources folder icon in the Groups & 
> Files list?Yes




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
> If you put the image into your project and add it to your application target, 
>Xcode will> automatically add it to a "Copy Files" build phase that places the 
>image into> WhateverApp.app/Contents/Resources/imagename.png. That is also the 
>place that -> pathForResource:ofType: will look for it. The link that Sam 
>Reshu posted earlier explains> this in more detail.
Into the folder containing my project there are the following files and 
folders:- the folders "build", "English.lproj" and "OsiriX Headers";- the files 
"Info.plist", "DisplayReport_Prefix.pch", "DisplayReport.xcodeproj", 
"DisplayReport.h", "DisplayReport.m", "version.plist", "report.png".I searched 
"report.png" into the folder "build", but I don't found it...The subfolder 
"Resources" does not exist...



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: atomic properties and KVC

2010-07-15 Thread Mike Abdullah
There is nothing magic about KVC in this regard. It is a layer atop the methods 
your class generates.

On 15 Jul 2010, at 06:50, Michael Link wrote:

> If I have a property declared and synthesized (e.g.
> @property BOOL foo;
> 
> and I use a KVC method to access the value of foo (e.g.
> [object valueForKey:@"foo"];
> 
> is it still accessed atomically? 
> 
> --
> Michael
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.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: Adding an image to a project

2010-07-15 Thread Andy Lee
On Jul 15, 2010, at 5:25 AM, Vincenzo Morgante wrote:

>>  If you put the image into your project and add it to your application 
>> target, Xcode will> automatically add it to a "Copy Files" build phase that 
>> places the image into> WhateverApp.app/Contents/Resources/imagename.png. 
>> That is also the place that -> pathForResource:ofType: will look for it. The 
>> link that Sam Reshu posted earlier explains> this in more detail.
> Into the folder containing my project there are the following files and 
> folders:- the folders "build", "English.lproj" and "OsiriX Headers";- the 
> files "Info.plist", "DisplayReport_Prefix.pch", "DisplayReport.xcodeproj", 
> "DisplayReport.h", "DisplayReport.m", "version.plist", "report.png".I 
> searched "report.png" into the folder "build", but I don't found it...The 
> subfolder "Resources" does not exist...

Actually I believe it is not enough for the image just to be in your project -- 
it must be in the Resources group (or at least that's the easiest way to get it 
automatically copied).  "Resources" is a group, which doesn't mean there is a 
folder with that name, it is just a conceptual grouping of files such as your 
nib files which are treated as application resources and therefore copied to 
the application bundle.  Try dragging imagename.png to the Resources group.

--Andy


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Ron Fleckner

On 15/07/2010, at 7:25 PM, Vincenzo Morgante wrote:

> The subfolder "Resources" does not exist...

The Resources folder exists inside your built executable's package.  You don't 
add files to that after the build using the Finder.

I suspect you have dragged your image into your projects folder in the Finder.  
That is not the way to add files to your project.  Do it via Xcode's interface, 
either through the menus or drag into the Groups & Files pane of the Xcode 
window.  If you haven't done it the right way, I doubt you'll get it to work.

Ron


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Live updating user defaults from a prefpane to a running app

2010-07-15 Thread Shamyl Zakariya
I have written a dummy app which uses the CFPreferences API to write
to the headless app's domain, and uses NSDistributedNotificationCenter
to broadcast an update message. The headless app receives that update
message, and calls synchronize on its standardUserDefaults instance.

However, this doesn't trigger the NSUserDefaultsController's bindings to update.

If I manually examine the defaults values, I see the newly set values,
which is great. But I can't figure out how to get the
NSUserDefaultsController to notice that the defaults have changed and
to accordingly cause bound values to update.

Any ideas?

On Wed, Jul 14, 2010 at 3:21 PM, Shamyl Zakariya  wrote:
>> Yes. The app that writes the pref should call synchronize and send its 
>> signal, then the app that reads calls synchronize when it receives it. I 
>> have a pair of apps that do that; I use NSDistributedNotificationCenter and 
>> the CF equivalent CFNotificationCenterGetDistributedCenter for the signals.
>
> That sounds quite elegant, thanks!
>
>
> --
>
> shamyl zakariya
>        - so much for pathos
>
>
>
> On Jul 14, 2010, at 3:03 PM, Lee Ann Rucker wrote:
>
>>
>> On Jul 14, 2010, at 9:20 AM, Greg Guerin wrote:
>>
>>> Shamyl Zakariya wrote:
>>>
>>>
 If not, what's the best practice here? And if I were to use some
 sort of apple event fired from the prefpane or some other technique
 to let the app know its defaults have changed, how do I get the
 user defaults controller in the headless app to apply the updates?
>>>
>>>
>>> If I understand the question correctly, then when the signal is
>>> received, your headless app calls -synchronize on the
>>> NSUserDefaults.  This assumes you don't have any shared-access
>>> contention issues.
>>
>> Yes. The app that writes the pref should call synchronize and send its 
>> signal, then the app that reads calls synchronize when it receives it. I 
>> have a pair of apps that do that; I use NSDistributedNotificationCenter and 
>> the CF equivalent CFNotificationCenterGetDistributedCenter for the signals.
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/shamyl%40gmail.com
>>
>> This email sent to sha...@gmail.com
>
>



-- 
so much for pathos
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSURLCredential and UTF-8 username

2010-07-15 Thread Benjámin Salánki

Hi List,

I am having problems with NSURLCredential and that the username and password 
are apparently sent in ISO Latin 1 encoding. At least the guys on the server 
development side are complaining this is the case.

I did not find any information on how the credential is encoded or if it is 
possible to change it at all.

The password I am having trouble with is the following: nővér.

I tried making sure the NSURL sent to the NSMutableURLRequest was encoded and 
escaped properly in UTF-8 and also added charset=utf-8 to the content-type 
header of the request as I have run out of options where to look.

I even tried to encode my NSString using UTF-8 into an NSData object and then 
creating a new UTF-8 encoded NSString from this data and set the username and 
password accordingly, but to no avail.

The strangest thing is if I try to access the password returned when I receive 
an authentication challenge ([[challenge proposedCredential] password]) it 
returns a properly formatted string.

Any ideas, pointers are greatly appreciated. 

Thanks,
Ben___

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

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

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

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


Re: NSTextView becomes temporarily unresponsive

2010-07-15 Thread David Swofford
In case anyone is interested...

I filed a bug.  In the meantime, I am able to work around the problem by 
subclassing NSTextStorage and overriding doubleClickAtIndex: (a suggestion by 
Doug Davidson).  I didn't have a clue how to write the primitive methods 
required for subclassing NSTextStorage, but a sample was kindly provided by 
Ross Carter, who even took a guess at the override, which worked perfectly!

Basically, this works by allocating our own NSMutableAttributedString object in 
the subclass init method and using this object in the implementations of the 
required primitives, mostly just calling the corresponding 
NSMutableAttributedString methods.  The same thing is done in the 
doubleClickAtIndex: override.

I think Aki is saying that NSTextView is doing some performance optimization 
that seems to go horribly wrong in my example.  I was curious if overriding 
this would degrade performance, but I don't see a noticeable difference between 
the original code and the one that uses the override (on an example not 
affected by the bug).

Dave 

On Jul 13, 2010, at 8:18 PM, Aki Inoue wrote:

> This is indeed an issue with the text system (trying to pre-heat the inserted 
> text range for various text checking tasks).
> Please file a bug.
> 
>> 4. As a workaround, could you use underscore characters instead of hyphens? 
>> I tried using en dash and got the same result as hyphens.
>> 
>> 5. May I suggest that it might not be meaningful to present 70 thousand 
>> characters, comprising only ACTG and -, in one scrolling text view? Mightn't 
>> you present only a snippet at a time, rather than the entire sequence? Just 
>> a thought.
> These suggestions should be able to help implementing workarounds for the 
> issue.
> 
> Thanks !!
> 
> Aki
> 
> On 2010/07/13, at 16:34, Ross Carter wrote:
> 
>> I don't think it has anything to do with wrapping. AFAICT, layout is 
>> complete before the delay begins. I think this is a bug that you need to 
>> report. Maybe Doug or Aki can chime in with a solution.
>> 
>> Here are some things that I found:
>> 
>> 1. The problem is indeed the hyphen characters. Replace all the - with + or 
>> _ and everything works fine.
>> 
>> 2. The NSTypesetter method -endParagraph, and the NSLayoutManager delegate 
>> method textContainer:didCompleteLayout: both fire quickly, as they 
>> should. That's why I think layout is already over by the time the delay 
>> kicks in. I don't know why -insertText: causes a call to 
>> -doubleClickAtIndex: after the insertion is complete, or why 
>> doubleClickAtIndex: takes so long to run. If you in fact double-click 
>> anywhere in the document, it runs instantly. 
>> 
>> 3. My app, Pagehand, handles the test file just fine. I've heavily 
>> subclassed all the components of the text system and I cannot tell what is 
>> fixing the problem.
>> 
>> 4. As a workaround, could you use underscore characters instead of hyphens? 
>> I tried using en dash and got the same result as hyphens.
>> 
>> 5. May I suggest that it might not be meaningful to present 70 thousand 
>> characters, comprising only ACTG and -, in one scrolling text view? Mightn't 
>> you present only a snippet at a time, rather than the entire sequence? Just 
>> a thought.
>> 
>> Hope this helps.
>> 
>> -Ross
>> 
>> On Jul 13, 2010, at 3:24 PM, David Swofford wrote:
>> 
>>> On Jul 13, 2010, at 2:38 PM, Ross Carter wrote:
>>> 
 Could you post a test file somewhere? I just tried creating 187 pages of 
 repeating ACCGACTACCGACT in TextEdit and it worked fine.
>>> 
>>> 
>>> Ah... I see a difference, and it's very relevant.  My example has a lot of 
>>> hyphen characters in it (FWIW these represent gaps in a sequence alignment 
>>> and are typically common in these kinds of files).  Your example was all 
>>> letters.  When I substitute all of the gaps in my example to letters, 
>>> TextEdit no longer has this slowdown.  It never occurred to me that this 
>>> would matter.
>>> 
>>> I'm guessing that it has something to do with line/word wrapping, and will 
>>> explore further.
>>> 
>>> Dave
>>> 
>>> 
>>> On Jul 13, 2010, at 2:38 PM, Ross Carter wrote:
>>> 
 On Jul 12, 2010, at 6:01 PM, David Swofford wrote:
 
> I'm beginning the conversion of a scientific app from Carbon to Cocoa, 
> and have run into a problem with NSTextView.  FWIW, I have it embedded in 
> an NSScrollView that is in turn included as an HICocoaView in a Carbon 
> window (but I don't think this is relevant to my problem).  It works, but 
> I've run into a glitch that I can't figure out how to solve.  In some 
> cases, I need to be able to edit files containing DNA sequences that look 
> like this:
> 
> sequence-name-1 ACCGACTACCGACT...
> sequence-name-2 GACCACTGACCACT...
> 
> The number of characters in the sequences may run into the tens of 
> thousands, with no spaces or other word breaks.
> 
> If a file like this is opened in TextEdit (o

Flipping coordinate system of a CALayer

2010-07-15 Thread Oleg Krupnov
Hi,

In a layer-hosting custom view, I'm flipping the root layer coordinate
system with the following code:

CGAffineTransform flipTransform;
flipTransform.a = 1.0;
flipTransform.b = 0.0;
flipTransform.c = 0.0;
flipTransform.d = -1.0;
flipTransform.tx = 0.0;
flipTransform.ty = 0.0;
[rootLayer setAffineTransform:flipTransform];

This code works fine and causes the layer and all its sublayers to
flip so that the origin is in the top left corner.


However, the problem is that when I place this custom view inside
another layer-backed view (or just check the "Wants Core Animation
Layer" box of the parent view in Interface builder), I observe that
the coordinate system of the layer is unflipped, like if the code
above did not have any effect.

Is this a bug? And how to work around it?

I could use the 10.6's geometryFlipped property, which is free of this
problem, but I'd still like to support 10.5.

Thanks!

Oleg.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSImage to IplImage (was: Adding an image to a project)

2010-07-15 Thread D'Angelo Emmanuel
Hi Vincenzo,

Besides getting an NSImage from the correct path in your app bundle, you'll 
have to get the pixel data.
An NSImage is an object that hides the raw pixel data from you, because of a 
display resolution independance purpose.

To access the pixel data, you have the choice between :
1. either getting an NSBimtmapImageRep
2. or creating a CGImage 
from your NSImage.
These 2 structures then have methods to copy their pixel data into a char or 
float array  (check the documentation of NSBitmapImageRep and Quartz Drawing, 
you may have to allocate inbetween a color space object).
It's fairly straightforward if you follow the documentation step by step.

An additional issue that you may have is that OpenCV expects BGR images instead 
of the usual RGB ordering. It seems a bit strange, but I didn't find any 
workaround (the cvCvtColor function does not modify the channel ordering 
property of teh IplImages).

Emmanuel___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Flipping coordinate system of a CALayer

2010-07-15 Thread Kyle Sluder
On Thu, Jul 15, 2010 at 9:18 AM, Oleg Krupnov  wrote:
> Is this a bug? And how to work around it?

There are lots of bugs with flipped layer-hosting views inside of
layer-backed views.. See this thread:
http://lists.apple.com/archives/cocoa-dev/2010/May/msg00988.html

The only workaround I was able to get working was to call a private
AppKit method to fix up the layer geometry.

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


NSUserDefaultsController and a document app.

2010-07-15 Thread Tony Romano
I have a document based cocoa app.  I am using a 
NSUserDefaultsController to bind the properties of the document to 
defaults values.  This all works.  Since the controller defaults are 
'shared', one side effect is every document window inherits the defaults 
even though the object for each document window is unique.  One approach 
I thought of is to have a section in the plist for each document window, 
since they appear to be unique.  Any other thoughts on how this may be 
accomplished?


Thanks,
-Tony
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Where to find info about infrared port

2010-07-15 Thread Travis Siegel
I've recently picked up a pair of wireless headphones.  I thought they  
were bluetooth, which I know osx supports.  Unfortunately, after I got  
the headphones home, and finally hunted down some aaa batteries for  
them, I discovered they were actually infrared headphones, not  
bluetooth ones.
I can't find anything that would allow me to use these on the osx os,  
Does anyone know where I can obtain information that would allow me to  
write (or modify) a driver to allow these headphones to work on osx?

Any and all information would be greatly appreciated.
Thanks in advance for any info.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Installation of screensaver fails

2010-07-15 Thread Gabriel Zachmann
I have developed a screensaver that seems to work fine, except one customer has 
the following problem when he tries to install it via double-clicking:

". I'm on a macbook pro mid 2009 unibody, 3.06 ghz processor. I'm booting 
10.6.4 in 32-bit kernel mode. Every time I double click the installer I get 
redirected to system prefs in the screen saver tab. At the bottom under "other" 
is your software, but it's grayed out and when I try to activate it I get a 
message saying to contact the developer for a newer version."

I have developed my screensaver under 10.6.3, and I have compiled it for 10.6 
and 10.5, Intel & PPC (if I have done everything correctly).

The same installation procedure does, of course, work just fine on my machine.

Does anybody have an idea, why it might be greyed out in system preferences?

Thanks a lot in advance.

Best regards,
Gabriel.

PS:
Should you want to try for yourself, here is the link:  
http://zach.in.tu-clausthal.de/software/ArtSaver.dmg




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Trying hard to get all domains in network

2010-07-15 Thread Meet Bhatha

Hello All,

I am trying to find out  all the intranet domains available in our network.

I have tried using NSNetServiceBrowser, DNSServiceEnumerateDomains, 
CFNetServiceBrowseDomains  but all three API's are returning only 'local.' and 
no other domains. (although I m connected to two domains).

If there is any API available to find out same, it would really be great.

I also tried the same using terminal with command scutill --dns and dig , but 
did not get required result.
Any pointers in this context would really be helpful.

Thanks

Meet B.

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


UIKit newbie user confusion with connections and touch events

2010-07-15 Thread rramage
I'm creating a calculator app, mostly for my own amusement. 
My design is - The UILabels on the left are stacked: FIRST,
LAST, DIFF.  The input/displays are on the right.  The
input/displays of each corresponding value are also
UILabels.  Over the label are UIButtons (set to zero alpha),
one for each unit.  One tap on a button lets the user enter
a value for the display.  Double tap lets the user enter
only the unit that the user tapped upon.  (That is, if the
display is 1234, and the user taps once on the 2, the
keyboard will display 1234, and the user inputs away.  If
the user double taps on the 2, the keyboard will display 2,
and the user can change only it.)  The user can also drag a
value from one display into another.  This list goes on and
on, but the important part is the one tap, two taps.  

At first, I thought I use UIKit to drag connectors to my
IBAction methods.  Some of these (will) parse the text out
of the input/displays, take the user's input, concatenate
the result and after closing the keyboard, displays the
corrected input.  It seemed simple thinking - drag the
UIButton tag for one tap to the one tap method, drag the tag
for two taps to the two tap method, so it was quite a
surprise to start setting up the connections, and find there
isn't a tag for TAP or 2TAPS, but instead the list below.

Did End On Exit
Editing Changed
Editing Did Begin
Editing Did End
Touch Cancel
Touch Down
Touch Down Repeat
Touch Drag Enter
Touch Drag Exit
Touch Drag Inside
Touch Drag Outside
Touch Up Inside
Touch Up Outside
Value Changed

So, fine I think.  I'll have to write code that gets armed
with a Touch Down or Touch Down Repeat, and fired if Touch
Up Inside also happens, else it will be a Touch Down
followed by a Touch Drag of some kind, and then the imagined
code started seeming very complicated.  One thing I've
learnt is that as soon as things start seeming very
complicated, I'm probably overthinking things, and there is
a simpler way of doing it that everybody else uses.  

My searching for answers brings up coding and coding
examples from UITouch and UIEvent .  I'm not finding
anything that helps me understand UIKit connections from a
UIButton in terms of TAP, TOUCH, DRAG etc, etc.  If anyone
could point me to a direct explanation, I'd be most
grateful.

Thank you,
Ronald Ramage
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Navigation controller management

2010-07-15 Thread Andrea Mattiuz
I'm developing an i Pad split view application, and I have to manage a 
navigation controller on the right side from the root view controller on the 
left side.
I can add many views but I can't reset the navigation controller, so even if 
i 
tap on the master pane I only add new views and I can't restart from the 
beginning of the navigation controller stack .
Any ideas?

Thanks
Andrea


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSTextView retain count and HICocoaView problems

2010-07-15 Thread Ryan Joseph
I have an NSTextView I am allocating programmatically then inserting into a 
HICocoaView for use in a Carbon app. The problem I'm experiencing has 2 points 
that are probably related.

1) The retainCount from the newly created NSTextView returns 4 and goes up to 7 
after I call HICocoaViewCreate on the NSTextView instance. I tried calling 
release on the NSTextView and DisposeControl on the HICocoaView but neither 
actually dispose of the instance because dealloc is never invoked. I suspect 
this is because of the retain count being what it is.

2) I have a Carbon event handler for mouse moved events installed on the 
application target which after the NSTextView is created stops working, 
probably because the NSTextView was never really deallocated it's consuming the 
mouse events.

Is this a bug in NSTextView or is there some special way I need to dispose of 
the HICocoaView? I did some tests using other Cocoa views like NSScrollView but 
they returned 1 as the retainCount and sure enough calling release would 
deallocate the view. Any ideas? Thanks.

Regards,
Ryan Joseph
thealchemistguild.org

___

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

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

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

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


Re: Installation of screensaver fails

2010-07-15 Thread Nick Zitzmann

On Jul 15, 2010, at 2:56 AM, Gabriel Zachmann wrote:

> I have developed a screensaver that seems to work fine, except one customer 
> has the following problem when he tries to install it via double-clicking:
> 
> ". I'm on a macbook pro mid 2009 unibody, 3.06 ghz processor. I'm booting 
> 10.6.4 in 32-bit kernel mode. Every time I double click the installer I get 
> redirected to system prefs in the screen saver tab. At the bottom under 
> "other" is your software, but it's grayed out and when I try to activate it I 
> get a message saying to contact the developer for a newer version."
> 
> I have developed my screensaver under 10.6.3, and I have compiled it for 10.6 
> and 10.5, Intel & PPC (if I have done everything correctly).
> 
> The same installation procedure does, of course, work just fine on my machine.
> 
> Does anybody have an idea, why it might be greyed out in system preferences?

In order for a screen saver to be fully compatible with Snow Leopard, you must 
add an Intel 64 slice that supports GC. The reason is because both the screen 
saver engine and System Preferences run as Intel 64 apps on Snow Leopard if the 
user's Mac supports 64-bit addressing, and at least System Preferences also 
uses GC in the Intel 64 slice.

Nick Zitzmann


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Where to find info about infrared port

2010-07-15 Thread M Pulis

Now you need a Mac with an IR transmitter port you have one?

Gary



On Jul 14, 2010, at 7:44 PM, Travis Siegel wrote:

I've recently picked up a pair of wireless headphones.  I thought  
they were bluetooth, which I know osx supports.  Unfortunately,  
after I got the headphones home, and finally hunted down some aaa  
batteries for them, I discovered they were actually infrared  
headphones, not bluetooth ones.
I can't find anything that would allow me to use these on the osx  
os, Does anyone know where I can obtain information that would allow  
me to write (or modify) a driver to allow these headphones to work  
on osx?

Any and all information would be greatly appreciated.
Thanks in advance for any info.

___

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

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

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

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


non-pointer instance variable

2010-07-15 Thread Michael Link
Is it necessary to use objc_atomicCompareAndSwapInstanceVariableBarrier when 
setting an instance variable such as an NSInteger in a GC app? Or would 
OSAtomicCompareAndSwap64Barrier be more appropriate?

--
Michael___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Trying hard to get all domains in network

2010-07-15 Thread Dave Carrigan
When you say "domain", what are you referring to. I can think of at least two 
different concepts that have the term "domain" applied to them.

On Jul 15, 2010, at 6:40 AM, Meet Bhatha wrote:

> 
> Hello All,
> 
> I am trying to find out  all the intranet domains available in our network.
> 
> I have tried using NSNetServiceBrowser, DNSServiceEnumerateDomains, 
> CFNetServiceBrowseDomains  but all three API's are returning only 'local.' 
> and no other domains. (although I m connected to two domains).
> 
> If there is any API available to find out same, it would really be great.
> 
> I also tried the same using terminal with command scutill --dns and dig , but 
> did not get required result.
> Any pointers in this context would really be helpful.
> 
> Thanks
> 
> Meet B.
> 
> DISCLAIMER
> ==
> This e-mail may contain privileged and confidential information which is the 
> property of Persistent Systems Ltd. It is intended only for the use of the 
> individual or entity to which it is addressed. If you are not the intended 
> recipient, you are not authorized to read, retain, copy, print, distribute or 
> use this message. If you have received this communication in error, please 
> notify the sender and delete all copies of this message. Persistent Systems 
> Ltd. does not accept any liability for virus infected mails.
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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%40rudedog.org
> 
> This email sent to d...@rudedog.org

___

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

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

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

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


Re: non-pointer instance variable

2010-07-15 Thread Greg Parker
On Jul 15, 2010, at 2:13 PM, Michael Link wrote:
> Is it necessary to use objc_atomicCompareAndSwapInstanceVariableBarrier when 
> setting an instance variable such as an NSInteger in a GC app? Or would 
> OSAtomicCompareAndSwap64Barrier be more appropriate?

The objc version is necessary only for GC pointers. For other values both 
functions will work, but the OSAtomic version may be faster.


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


___

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

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

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

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


Re: Live updating user defaults from a prefpane to a running app

2010-07-15 Thread Shamyl Zakariya
Since calling [[NSUserDefaults standardUserDefaults] synchronize] doesn't cause 
bindings to be triggered, I took a brute force approach and used a privately 
created NSUserDefaultsController, made it a property of my app delegate, and 
let my bindings use it as part of the key path. When my client app receives the 
signal that preferences have been edited, it creates a new 
NSUserDefaultsController and overwrites the old one:

DebugLog( @"goosing defaults bindings" );
self.defaultsController = [[[NSUserDefaultsController alloc] 
initWithDefaults:[NSUserDefaults standardUserDefaults] initialValues: 
self.initialDefaults] autorelease];  

This works, but it seems really primitive. Is it really the case that there's 
NO way to tell NSUserDefaultsController that the underlying NSUserDefaults 
store has changed? Really? Seems like a serious oversight to me.

Anyway, problem (sort of, and in an ugly manner) solved for anybody searching 
the list.

--

shamyl zakariya
- so much for pathos



On Jul 15, 2010, at 8:19 AM, Shamyl Zakariya wrote:

> I have written a dummy app which uses the CFPreferences API to write
> to the headless app's domain, and uses NSDistributedNotificationCenter
> to broadcast an update message. The headless app receives that update
> message, and calls synchronize on its standardUserDefaults instance.
> 
> However, this doesn't trigger the NSUserDefaultsController's bindings to 
> update.
> 
> If I manually examine the defaults values, I see the newly set values,
> which is great. But I can't figure out how to get the
> NSUserDefaultsController to notice that the defaults have changed and
> to accordingly cause bound values to update.
> 
> Any ideas?
> 
> On Wed, Jul 14, 2010 at 3:21 PM, Shamyl Zakariya  wrote:
>>> Yes. The app that writes the pref should call synchronize and send its 
>>> signal, then the app that reads calls synchronize when it receives it. I 
>>> have a pair of apps that do that; I use NSDistributedNotificationCenter and 
>>> the CF equivalent CFNotificationCenterGetDistributedCenter for the signals.
>> 
>> That sounds quite elegant, thanks!
>> 
>> 
>> --
>> 
>> shamyl zakariya
>>- so much for pathos
>> 
>> 
>> 
>> On Jul 14, 2010, at 3:03 PM, Lee Ann Rucker wrote:
>> 
>>> 
>>> On Jul 14, 2010, at 9:20 AM, Greg Guerin wrote:
>>> 
 Shamyl Zakariya wrote:
 
 
> If not, what's the best practice here? And if I were to use some
> sort of apple event fired from the prefpane or some other technique
> to let the app know its defaults have changed, how do I get the
> user defaults controller in the headless app to apply the updates?
 
 
 If I understand the question correctly, then when the signal is
 received, your headless app calls -synchronize on the
 NSUserDefaults.  This assumes you don't have any shared-access
 contention issues.
>>> 
>>> Yes. The app that writes the pref should call synchronize and send its 
>>> signal, then the app that reads calls synchronize when it receives it. I 
>>> have a pair of apps that do that; I use NSDistributedNotificationCenter and 
>>> the CF equivalent CFNotificationCenterGetDistributedCenter for the signals.
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/shamyl%40gmail.com
>>> 
>>> This email sent to sha...@gmail.com
>> 
>> 
> 
> 
> 
> -- 
> so much for pathos

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Reading in UTF-8 to Data

2010-07-15 Thread Brad Stone
I'm having trouble getting text to appear properly in an NSTextView which is 
binded to an NSData attribute in core data.  I've been all over the internet 
but I'm still stumped.

The original text looks like this:
There is a period at the end of this sentence.
You should have also just seen a line return and here • is a option-8 bullet 
character.

This text is saved in an XML file that starts with 

My goal is to write code to read this XML file and create an NSData object for 
the text.  This is what I've written:
NSString *s = [childNode stringValue];  //assume this child is the correct text 
NSData *noteData = [s dataUsingEncoding:NSUnicodeStringEncoding 
allowLossyConversion:YES];  // I also tried NSUTF8StringEncoding

This results in the following appearing in my NSTextView
There is a period at the end of this sentence=2E=0DYou should have also jus= t 
seen a line return and here =E2=80=A2 is a option-8 bullet character= =2E


I'd like to do the correct encoding but there's something wrong and I don't 
want to resort to the find and replace method. (i.e. find =2E and replace with 
".") 

The actual text in the XML file is:
There is a period at the end of this sentence=2E=0DYou should have also 
jus=
t seen a line return and here =E2=80=A2 is a option-8 bullet character=
=2E

(why there's an = between the "s" and "t" in the word "just" is confusing).

Can anyone help?  

Thank you

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
I added the image via XCode's interface: right button on Resources folder, add 
external file...
Now it works without any problems, but not on my system: we created a new 
project in another system and we added the same source file and the image, then 
we built the project and it worked... Maybe the problem is my project on my 
system...
However, the project is not one of the XCode template, but we used a wizard in 
order to create a project for OsiriX plugin development, so the file xib does 
not exists...

Thanks a lot for your help!

Vincenzo

The Resources folder exists inside your built executable's package.  You don't 
add files to that after the build using the Finder.

I suspect you have dragged your image into your projects folder in the Finder.  
That is not the way to add files to your project.  Do it via Xcode's interface, 
either through the menus or drag into the Groups & Files pane of the Xcode 
window.  If you haven't done it the right way, I doubt you'll get it to work.

Ron






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an image to a project

2010-07-15 Thread Vincenzo Morgante
Since 
the plugin still does not work on my system, I'll try to create a new 
project following again the wizard for the development of 
plug-in for OsiriX. After 
all, it works on another system...

Thanks!

Vincenzo

--- Gio 15/7/10, Ron Fleckner  ha scritto:

Da: Ron Fleckner 
Oggetto: Re: Adding an image to a project
A: "Vincenzo Morgante" 
Cc: "Wim Lewis" , cocoa-dev@lists.apple.com
Data: Giovedì 15 luglio 2010, 12:48


On 15/07/2010, at 7:25 PM, Vincenzo Morgante wrote:

> The subfolder "Resources" does not exist...

The Resources folder exists inside your built executable's package.  You don't 
add files to that after the build using the Finder.

I suspect you have dragged your image into your projects folder in the Finder.  
That is not the way to add files to your project.  Do it via Xcode's interface, 
either through the menus or drag into the Groups & Files pane of the Xcode 
window.  If you haven't done it the right way, I doubt you'll get it to work.

Ron






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Reading in UTF-8 to Data

2010-07-15 Thread Nick Zitzmann

On Jul 15, 2010, at 4:03 PM, Brad Stone wrote:

> I'm having trouble getting text to appear properly in an NSTextView which is 
> binded to an NSData attribute in core data.  I've been all over the internet 
> but I'm still stumped.
> 
> The original text looks like this:
> There is a period at the end of this sentence.
> You should have also just seen a line return and here • is a option-8 bullet 
> character.
> 
> This text is saved in an XML file that starts with  encoding="UTF-8"?>
> 
> My goal is to write code to read this XML file and create an NSData object 
> for the text.  This is what I've written:
> NSString *s = [childNode stringValue];  //assume this child is the correct 
> text 
> NSData *noteData = [s dataUsingEncoding:NSUnicodeStringEncoding 
> allowLossyConversion:YES];  // I also tried NSUTF8StringEncoding
> 
> This results in the following appearing in my NSTextView
> There is a period at the end of this sentence=2E=0DYou should have also jus= 
> t seen a line return and here =E2=80=A2 is a option-8 bullet character= =2E
> 
> 
> I'd like to do the correct encoding but there's something wrong and I don't 
> want to resort to the find and replace method. (i.e. find =2E and replace 
> with ".") 
> 
> The actual text in the XML file is:
> There is a period at the end of this sentence=2E=0DYou should have also 
> jus=
> t seen a line return and here =E2=80=A2 is a option-8 bullet character=
> =2E
> 
> (why there's an = between the "s" and "t" in the word "just" is confusing).
> 
> Can anyone help?  

Looks like you need to translate the text in the XML file using a MIME 
quoted-printable decoder, and then run the results through a UTF-8 decoder. 
Quoted-printable sequences start with a = and the next two characters indicate 
the hex value of the character. For example, 0xe280a2 is the bullet character 
(U+2022) in UTF-8. See RFC 2045 for more details.

Nick Zitzmann


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTextView retain count and HICocoaView problems

2010-07-15 Thread Kyle Sluder
On Wed, Jul 14, 2010 at 9:39 AM, Ryan Joseph  wrote:
> 1) The retainCount from the newly created NSTextView returns 4 and goes up to 
> 7 after I call HICocoaViewCreate on the NSTextView instance. I tried calling 
> release on the NSTextView and DisposeControl on the HICocoaView but neither 
> actually dispose of the instance because dealloc is never invoked. I suspect 
> this is because of the retain count being what it is.

Do not look at -retainCount. It gives you no useful information. If
you want to make sure you're correctly balancing retains and releases,
use the static analyzer and Instruments.

> 2) I have a Carbon event handler for mouse moved events installed on the 
> application target which after the NSTextView is created stops working, 
> probably because the NSTextView was never really deallocated it's consuming 
> the mouse events.

That's not an accurate description of how the event dispatch works.

--Kyle Sluder
___

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

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

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

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


Re: Adding an image to a project

2010-07-15 Thread B.J. Buchalter

On Jul 15, 2010, at 6:17 PM, Vincenzo Morgante wrote:

> Since 
> the plugin still does not work on my system, I'll try to create a new 
> project following again the wizard for the development of 
> plug-in for OsiriX. After 
> all, it works on another system...

If you are creating a plugin (rather than an application), you need to be 
careful to use the right NSBundle calls to refer to your plug-in's bundle and 
not the bundle of the Application that loads your plugin. That may be the 
source of the problem for you.

In particular, if your resource is in your plug-in's bundle and your plugin is 
loaded by a hosting application, the [NSBundle mainBundle] call refers to the 
bundle of the hosting application, and not your plugin's bundle.

You want to use [NSBundle bundleForClass: ] or 
[NSBundle bundleWithIdentifier:@"your.plugins.bundle.id"]

Hope that helps.

Best regards,

B.J. Buchalter
Metric Halo 
http://www.mhlabs.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: NSTextView retain count and HICocoaView problems

2010-07-15 Thread Ryan Joseph

On Jul 15, 2010, at 4:25 PM, Kyle Sluder wrote:

> On Wed, Jul 14, 2010 at 9:39 AM, Ryan Joseph  
> wrote:
>> 1) The retainCount from the newly created NSTextView returns 4 and goes up 
>> to 7 after I call HICocoaViewCreate on the NSTextView instance. I tried 
>> calling release on the NSTextView and DisposeControl on the HICocoaView but 
>> neither actually dispose of the instance because dealloc is never invoked. I 
>> suspect this is because of the retain count being what it is.
> 
> Do not look at -retainCount. It gives you no useful information. If
> you want to make sure you're correctly balancing retains and releases,
> use the static analyzer and Instruments.

Ok, others said this also so the system must be retaining it elsewhere for 
various reasons. The fact dealloc is never called after DisposeControl is 
confusing though since other NSView's worked just fine...

> 
>> 2) I have a Carbon event handler for mouse moved events installed on the 
>> application target which after the NSTextView is created stops working, 
>> probably because the NSTextView was never really deallocated it's consuming 
>> the mouse events.
> 
> That's not an accurate description of how the event dispatch works.


The how does it work? My observation is simple: when the NSTextView is created 
and focused the mouse handler does not receive events. After I call 
DisposeControl on the HICocoaView the view is removed (no longer visible) but 
the mouse handler continues to not receive events. They must be connected some 
how.

Regards,
Ryan Joseph
thealchemistguild.org

___

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

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

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

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


Re: NSTextView retain count and HICocoaView problems

2010-07-15 Thread Tony Romano
The reason dealloc is not being called is because you still have a 
retain count > 0.  In cases like this, personally, I always assume my 
code is at fault.  Once I have exhausted all known techniques trying to 
resolve the discrepancy then I escalate it.


Your best bet is to use Instruments, force the leak, then examine how 
the retains/released paired up.  You'll find it.   Instruments is a very 
nice tool.


-Tony
On 7/15/10 3:30 PM, Ryan Joseph wrote:

On Jul 15, 2010, at 4:25 PM, Kyle Sluder wrote:

   

On Wed, Jul 14, 2010 at 9:39 AM, Ryan Joseph  wrote:
 

1) The retainCount from the newly created NSTextView returns 4 and goes up to 7 
after I call HICocoaViewCreate on the NSTextView instance. I tried calling 
release on the NSTextView and DisposeControl on the HICocoaView but neither 
actually dispose of the instance because dealloc is never invoked. I suspect 
this is because of the retain count being what it is.
   

Do not look at -retainCount. It gives you no useful information. If
you want to make sure you're correctly balancing retains and releases,
use the static analyzer and Instruments.
 

Ok, others said this also so the system must be retaining it elsewhere for 
various reasons. The fact dealloc is never called after DisposeControl is 
confusing though since other NSView's worked just fine...

   
 

2) I have a Carbon event handler for mouse moved events installed on the 
application target which after the NSTextView is created stops working, 
probably because the NSTextView was never really deallocated it's consuming the 
mouse events.
   

That's not an accurate description of how the event dispatch works.
 


The how does it work? My observation is simple: when the NSTextView is created 
and focused the mouse handler does not receive events. After I call 
DisposeControl on the HICocoaView the view is removed (no longer visible) but 
the mouse handler continues to not receive events. They must be connected some 
how.

Regards,
Ryan Joseph
thealchemistguild.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/tonyrom%40hotmail.com

This email sent to tony...@hotmail.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: Reading in UTF-8 to Data

2010-07-15 Thread Brad Stone
Yes, quoted-printable.  That's precisely it but in doing my research in the 
documentation and on the internet it doesn't seem like it's a simple process 
especially for someone like me with 9 months of Cocoa development experience.

Does anyone have a utility or sample code?

On Jul 15, 2010, at 6:19 PM, Nick Zitzmann wrote:

> 
> On Jul 15, 2010, at 4:03 PM, Brad Stone wrote:
> 
>> I'm having trouble getting text to appear properly in an NSTextView which is 
>> binded to an NSData attribute in core data.  I've been all over the internet 
>> but I'm still stumped.
>> 
>> The original text looks like this:
>> There is a period at the end of this sentence.
>> You should have also just seen a line return and here • is a option-8 bullet 
>> character.
>> 
>> This text is saved in an XML file that starts with > encoding="UTF-8"?>
>> 
>> My goal is to write code to read this XML file and create an NSData object 
>> for the text.  This is what I've written:
>> NSString *s = [childNode stringValue];  //assume this child is the correct 
>> text 
>> NSData *noteData = [s dataUsingEncoding:NSUnicodeStringEncoding 
>> allowLossyConversion:YES];  // I also tried NSUTF8StringEncoding
>> 
>> This results in the following appearing in my NSTextView
>> There is a period at the end of this sentence=2E=0DYou should have also jus= 
>> t seen a line return and here =E2=80=A2 is a option-8 bullet character= =2E
>> 
>> 
>> I'd like to do the correct encoding but there's something wrong and I don't 
>> want to resort to the find and replace method. (i.e. find =2E and replace 
>> with ".") 
>> 
>> The actual text in the XML file is:
>> There is a period at the end of this sentence=2E=0DYou should have 
>> also jus=
>> t seen a line return and here =E2=80=A2 is a option-8 bullet character=
>> =2E
>> 
>> (why there's an = between the "s" and "t" in the word "just" is confusing).
>> 
>> Can anyone help?  
> 
> Looks like you need to translate the text in the XML file using a MIME 
> quoted-printable decoder, and then run the results through a UTF-8 decoder. 
> Quoted-printable sequences start with a = and the next two characters 
> indicate the hex value of the character. For example, 0xe280a2 is the bullet 
> character (U+2022) in UTF-8. See RFC 2045 for more details.
> 
> Nick Zitzmann
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Where to find info about infrared port

2010-07-15 Thread Graham Cox

On 15/07/2010, at 12:44 PM, Travis Siegel wrote:

> Any and all information would be greatly appreciated.


I think you'll find that this is what we call in the trade a "hardware problem".

--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: Reading in UTF-8 to Data

2010-07-15 Thread Greg Guerin

Brad Stone wrote:

Yes, quoted-printable.  That's precisely it but in doing my  
research in the documentation and on the internet it doesn't seem  
like it's a simple process especially for someone like me with 9  
months of Cocoa development experience.



There is nothing apparent in your code that would cause quoted- 
printable to magically appear.  If it's not your code, the next most  
obvious candidate is your data.


Exactly where is your data coming from, and exactly how did it get  
there?  Maybe you have a glitch somewhere along your data-production  
pathway, that's unexpectedly producing quoted-printable.


That pathway includes all uploads, file-transfers, file copies, etc.   
It even includes any editor you used the last time you looked at the  
original XML file.  If the editor is "helping" you by interpreting  
quoted-printable, then you might want to try something simpler, like  
the 'cat' command in Terminal.app, or even the 'hexdump -C' command.   
If you're not a Terminal person, HexFiend is your friend (google it).


  -- GG
___

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

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

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

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


Re: Flipping coordinate system of a CALayer

2010-07-15 Thread Scott Anguish

On Jul 15, 2010, at 1:24 PM, Kyle Sluder wrote:

> On Thu, Jul 15, 2010 at 9:18 AM, Oleg Krupnov  wrote:
>> Is this a bug? And how to work around it?
> 
> There are lots of bugs with flipped layer-hosting views inside of
> layer-backed views.. See this thread:
> http://lists.apple.com/archives/cocoa-dev/2010/May/msg00988.html
> 
> The only workaround I was able to get working was to call a private
> AppKit method to fix up the layer geometry.
> 

Which is a no-no, and shouldn’t be done. Bad Kyle. No biscuit.

___

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

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

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

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


how to deploy the sqlite file in my Cocoa application installation

2010-07-15 Thread Wayne Shao
Hi,

I am using sqlite in my cocoa application (for regular mac desktop/laptop).

1. How do I initialize the sqlite (e.g, make sure empty tables with the
correct schema is put at the right path)
 as part of the application installation?
2. Any documentation on the install/packaging of my application in general?

Thanks,
-- 
W. Shao
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Data Protection on iOS 4 with Core Data

2010-07-15 Thread Andrew
Hi All,

So I have an OS 4 application that uses a core data store and I would like to 
use the new Data Protection stuff to make sure that when the user sets up their 
iPhone with a pass code, the core data store is correctly encrypted.

Do I have to do anything to do this, or is it taken care of for me?  There 
doesn't seem to be anything I can find relating to the core data API that 
'turns on' the file level encryption, and various apple documents seem to be 
implying that having set a pass code everything just works.

To be clear, I am attempting to ensure that if a third party obtains the iPhone 
and mounts its hard drive on their computer, the core data store will still be 
as inaccessible to them as possible.


Thanks for any help.


- Andrew Bush
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Flipping coordinate system of a CALayer

2010-07-15 Thread Dave Keck
>> The only workaround I was able to get working was to call a private
>> AppKit method to fix up the layer geometry.
>
> Which is a no-no, and shouldn’t be done. Bad Kyle. No biscuit.

Forgive me for raising such a taboo topic, but I've encountered
situations where I had to choose between A) using a private API, B)
shipping a product with a malfunction that would aggravate users to a
greater degree than the risk of using the private API, or C) not
shipping a product.

Certainly – placing yourself in the shoes of a third-party developer –
you would agree that situations exist where using a private API is
warranted? I'd be happy to provide specific examples as necessary.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Data Protection on iOS 4 with Core Data

2010-07-15 Thread Glenn Sequeira
On Fri, Jul 16, 2010 at 9:04 AM, Andrew  wrote:

> So I have an OS 4 application that uses a core data store and I would like to 
> use the new Data Protection stuff to make sure that when the user sets up 
> their iPhone with a pass code, the core data store is correctly encrypted.

Take a look the following blog post:

https://nickharris.wordpress.com/2010/07/14/core-data-and-enterprise-iphone-applications-protecting-your-data/

~gms
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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