Official or correct explanation of numbers on the 1st column for every method/function call in process sample?

2015-03-17 Thread JongAm Park
Hello,

I know that questions on tools are not relevant for this cocoa-dev, but I 
couldn’t find any relevant mailing list for tools like ‘sample’ or sampling 
using Activity Monitor GUI tool.
So, let me ask it here, because all Cocoa programmers use such tools whenever 
needed.

I have a process sample like this.

Call graph:
1379 Thread_839846: Main Thread   DispatchQueue_multiple
+ 1379 start  (in Wirecast) + 52  [0x100a31074]
+   1379 main  (in Wirecast) + 1070  [0x100b3e16a]
+ 1379 eApp::Run(bool, zRecord*)  (in libeva.dylib) + 779  [0x101033225]
+   1379 eWindowManager_cocoa::MessageLoop()  (in libeva.dylib) + 70  
[0x101037932]
+ 1379 -[NSApplication run]  (in AppKit) + 594  [0x7fff88cd2593]

I can guess the number on the 1st (2nd?) on every row after + sign. It should 
be number of samples or how long a method/function take.

According to MAN page for ‘sample’, it samples at every 1 msec.
And http://stackoverflow.com/questions/10709577/spindump-analysis-instructions 
http://stackoverflow.com/questions/10709577/spindump-analysis-instructions 
says, it’s the number of samples.

By looking at the numbers on children nodes, I guess so too.  But is it really 
so?

If there is a better mailing list for this kind of inquiry, please let me know.

Thanks,
JongAm Park 
___

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

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

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

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

Re: Official or correct explanation of numbers on the 1st column for every method/function call in process sample?

2015-03-17 Thread JongAm Park
Well, it’s not the one I’m asking for.


  + 1379 start  (in Wirecast) + 52  [0x100a31074]
   ^^
   | | This is not the number I 
asked for.
   |
   | This is the number I asked for

Thanks,


 On Mar 17, 2015, at 2:58 PM, Steve Mills sjmi...@mac.com wrote:
 
 On Mar 17, 2015, at 15:52, JongAm Park jongamp...@sbcglobal.net wrote:
 
 Call graph:
   1379 Thread_839846: Main Thread   DispatchQueue_multiple
   + 1379 start  (in Wirecast) + 52  [0x100a31074]
   +   1379 main  (in Wirecast) + 1070  [0x100b3e16a]
   + 1379 eApp::Run(bool, zRecord*)  (in libeva.dylib) + 779  
 [0x101033225]
   +   1379 eWindowManager_cocoa::MessageLoop()  (in libeva.dylib) + 70  
 [0x101037932]
   + 1379 -[NSApplication run]  (in AppKit) + 594  [0x7fff88cd2593]
 
 I can guess the number on the 1st (2nd?) on every row after + sign. It 
 should be number of samples or how long a method/function take.
 
 The number after the + is the distance after the function named before the +. 
 That's all I know. :)
 
 Steve via iPad
 


___

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

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

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

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

Re: Official or correct explanation of numbers on the 1st column for every method/function call in process sample?

2015-03-17 Thread JongAm Park
Yup!

Thank you, :)

 On Mar 17, 2015, at 3:41 PM, Scott Ribe scott_r...@elevated-dev.com wrote:
 
 On Mar 17, 2015, at 4:26 PM, JongAm Park jongamp...@sbcglobal.net wrote:
 
 Then can the number of samples be interpreted as how long it took there...
 
 It can be taken as a very rough approximation of that.
 
 -- 
 Scott Ribe
 scott_r...@elevated-dev.com
 http://www.elevated-dev.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Official or correct explanation of numbers on the 1st column for every method/function call in process sample?

2015-03-17 Thread JongAm Park
Hello,

Thank you very much for your explanation.

Then can the number of samples be interpreted as how long it took there, 
because sampling rate in  (num of samples /  sampling rate) is given?

This is from  the process sample.

Sampling process 6803 for 3 seconds with 1 millisecond of run time between 
samples = from this line sampling rate is 6803/3
Sampling completed, processing symbols…

I intentionally omitted information here…

Load Address:0x100a2f000

Version: 6.0.2 (23678)
Code Type:   X86-64
Parent Process:  ??? [1]

Date/Time:   2015-03-11 15:08:13.780 -0700
OS Version:  Mac OS X 10.10.2 (14C109)
Report Version:  7
Analysis Tool:   /usr/bin/sample


So, 1379 can mean 1379 / (6803/3) = (1379 * 3)/6803 sec.

Thanks,


 On Mar 17, 2015, at 3:11 PM, Greg Parker gpar...@apple.com wrote:
 
 
 On Mar 17, 2015, at 1:52 PM, JongAm Park jongamp...@sbcglobal.net wrote:
 
 Hello,
 
 I know that questions on tools are not relevant for this cocoa-dev, but I 
 couldn’t find any relevant mailing list for tools like ‘sample’ or sampling 
 using Activity Monitor GUI tool.
 So, let me ask it here, because all Cocoa programmers use such tools 
 whenever needed.
 
 I have a process sample like this.
 
 Call graph:
   1379 Thread_839846: Main Thread   DispatchQueue_multiple
   + 1379 start  (in Wirecast) + 52  [0x100a31074]
   +   1379 main  (in Wirecast) + 1070  [0x100b3e16a]
   + 1379 eApp::Run(bool, zRecord*)  (in libeva.dylib) + 779  
 [0x101033225]
   +   1379 eWindowManager_cocoa::MessageLoop()  (in libeva.dylib) + 70  
 [0x101037932]
   + 1379 -[NSApplication run]  (in AppKit) + 594  [0x7fff88cd2593]
 
 I can guess the number on the 1st (2nd?) on every row after + sign. It 
 should be number of samples or how long a method/function take.
 
 According to MAN page for ‘sample’, it samples at every 1 msec.
 And 
 http://stackoverflow.com/questions/10709577/spindump-analysis-instructions 
 http://stackoverflow.com/questions/10709577/spindump-analysis-instructions 
 says, it’s the number of samples.
 
 By looking at the numbers on children nodes, I guess so too.  But is it 
 really so?
 
 If there is a better mailing list for this kind of inquiry, please let me 
 know.
 
 In the trace above, 1379 is the number of samples at that location. The 
 total number of samples and the sampling rate should be listed at the top of 
 the report:
Duration:10.01s
Steps:   1001 (10ms sampling interval)
 
 Everything else is a description of the instruction's location. Symbol name 
 (in library name) +  byte offset [absolute address]. A symbolicated 
 trace may add source file and line numbers. If multiple samples hit the same 
 symbol at different offsets (i.e. they were at different places in the same 
 function) then they may be aggregated into a single line with multiple 
 offsets listed.
 
 
 -- 
 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Official or correct explanation of numbers on the 1st column for every method/function call in process sample?

2015-03-17 Thread JongAm Park
Ah.. I’m sorry.

The sample rate should not be 6803/3, because the 6803 is just process number.
The 1st line says just :

Sampling process 6803 for 3 seconds with 1 millisecond of run time between 
samples

So, sampling frequency is every 1 millisecond, and the whole sampling duration 
was 3 sec.

Anyway.. Thank you very much for you explanation.

JongAm Park

 On Mar 17, 2015, at 3:11 PM, Greg Parker gpar...@apple.com wrote:
 
 
 On Mar 17, 2015, at 1:52 PM, JongAm Park jongamp...@sbcglobal.net wrote:
 
 Hello,
 
 I know that questions on tools are not relevant for this cocoa-dev, but I 
 couldn’t find any relevant mailing list for tools like ‘sample’ or sampling 
 using Activity Monitor GUI tool.
 So, let me ask it here, because all Cocoa programmers use such tools 
 whenever needed.
 
 I have a process sample like this.
 
 Call graph:
   1379 Thread_839846: Main Thread   DispatchQueue_multiple
   + 1379 start  (in Wirecast) + 52  [0x100a31074]
   +   1379 main  (in Wirecast) + 1070  [0x100b3e16a]
   + 1379 eApp::Run(bool, zRecord*)  (in libeva.dylib) + 779  
 [0x101033225]
   +   1379 eWindowManager_cocoa::MessageLoop()  (in libeva.dylib) + 70  
 [0x101037932]
   + 1379 -[NSApplication run]  (in AppKit) + 594  [0x7fff88cd2593]
 
 I can guess the number on the 1st (2nd?) on every row after + sign. It 
 should be number of samples or how long a method/function take.
 
 According to MAN page for ‘sample’, it samples at every 1 msec.
 And 
 http://stackoverflow.com/questions/10709577/spindump-analysis-instructions 
 http://stackoverflow.com/questions/10709577/spindump-analysis-instructions 
 says, it’s the number of samples.
 
 By looking at the numbers on children nodes, I guess so too.  But is it 
 really so?
 
 If there is a better mailing list for this kind of inquiry, please let me 
 know.
 
 In the trace above, 1379 is the number of samples at that location. The 
 total number of samples and the sampling rate should be listed at the top of 
 the report:
Duration:10.01s
Steps:   1001 (10ms sampling interval)
 
 Everything else is a description of the instruction's location. Symbol name 
 (in library name) +  byte offset [absolute address]. A symbolicated 
 trace may add source file and line numbers. If multiple samples hit the same 
 symbol at different offsets (i.e. they were at different places in the same 
 function) then they may be aggregated into a single line with multiple 
 offsets listed.
 
 
 -- 
 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

How to add a window to a window list(or open document list) on a dock tile menu?

2015-01-27 Thread JongAm Park
Hello, all. It has been long time for me to write anything in this mailing 
list, but I prefer this than web based one Apple now pushes.

Anyway.. I have some issue with “Window list”

If a window is created, it’s added to a window list under the “Window” menu and 
its equivalent counter part on the Dock menu.
However, in a project I work on nowadays, ( which is heavily customized on top 
of Cocoa and old Carbon ), it has a window list menu items under “Window” menu, 
but somehow there is no such thing on the Dock menu.

It’s not document based app. (Well.. I mean it’s not based on NSDocument. We 
have our own mechanism for managing our in-house document type. ) 
I tried setExcludedFroWindowsMenu: of NSWindow to see if it has any effect on 
the Dock menu, but it didn’t.

Is there anyway to have Dock menu contain the window list menu items?

I searched Apple’s documents, but there looks to be no explicit way to 
remove/add window list.

Thank you.
JongAm Park
___

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

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

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

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

Re: How to add a window to a window list(or open document list) on a dock tile menu?

2015-01-27 Thread JongAm Park
:) Thank you very much for your reply.

I need the recent documents list. So, I will not remove it.
I am still curious how the window list doesn’t appear on the dock menu of the 
interested app.
Probably they removed Window menu from “menu bar”?
I checked if a window is excluded from window list with 
isExcludedFromWindowsMenu:, but it returned false. So, windows I queried are in 
a window list.

Anyway, yup! I’ll try with the delegation message you told me. 

Thank you. ;)


 On Jan 27, 2015, at 12:55 PM, Lee Ann Rucker lruc...@vmware.com wrote:
 
 -[NSApplicationDelegate applicationDockMenu:]
 
 You can customize everything except the recent documents; you get that for 
 free and can't get rid of it - no, not even if the user clears recent 
 documents from the main menu.
 
 On Jan 27, 2015, at 10:38 AM, JongAm Park jongamp...@sbcglobal.net wrote:
 
 Hello, all. It has been long time for me to write anything in this mailing 
 list, but I prefer this than web based one Apple now pushes.
 
 Anyway.. I have some issue with “Window list”
 
 If a window is created, it’s added to a window list under the “Window” menu 
 and its equivalent counter part on the Dock menu.
 However, in a project I work on nowadays, ( which is heavily customized on 
 top of Cocoa and old Carbon ), it has a window list menu items under 
 “Window” menu, but somehow there is no such thing on the Dock menu.
 
 It’s not document based app. (Well.. I mean it’s not based on NSDocument. We 
 have our own mechanism for managing our in-house document type. ) 
 I tried setExcludedFroWindowsMenu: of NSWindow to see if it has any effect 
 on the Dock menu, but it didn’t.
 
 Is there anyway to have Dock menu contain the window list menu items?
 
 I searched Apple’s documents, but there looks to be no explicit way to 
 remove/add window list.
 
 Thank you.
 JongAm Park
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.apple.com_mailman_options_cocoa-2Ddev_lrucker-2540vmware.comd=AwIGaQc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=ie7S-J__EKnfyVOBV7-jV2rZ--p47O6vkyTklpDM3h4m=hjEqDZ8jEpHgyNJtfaA4FaxGdsZAsosDKscQglYgNj8s=8RSNVk4UJgxTxrQv7wfY3bFC1h_KbfGPw4gqQBO3jfce=
  
 
 This email sent to lruc...@vmware.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: How to add a window to a window list(or open document list) on a dock tile menu?

2015-01-27 Thread JongAm Park
I solved my problem and would like to share how I did it.

I’m working on a heavily customized app on top of Cocoa/Carbon.
So, general paradigm of Cocoa and Carbon is partially applied : how to enable 
menu items, how to make windows, and so on.
However, there is a link to Cooca at the bottom of our S/W architecture. It 
means that there was some missing stuff in terms of the Window list on a Dock 
menu.

I found out that the Window list ( may called open document list ) is the same 
to those under Window menu bar item on a genuine Cocoa app (why not)

It turned out that if NSApp.windowsMenu returns nil ( means there is no Windows 
menu associated with it ), when a new Window is created, it can’t be added to 
the “Windows list”. I played with a skeletal Cocoa app and tried to remove menu 
items from default Windows menu, deleted the Windows menu, replaced with other 
menu, etc.

With Interface builder module, the title “Windows” plays significant role. 
Based on the name, Interface Builder looks to treat it as “Windows” menu and 
associate with NSApplication as such. Anyway, even without any menu items under 
the menu, it populated with new window names whenever a new window is created 
and displayed.

So, in our own very customized code to generate our own menu bar and its sub 
items, I found out that we didn’t set “Window” menu as Windows menu of NSApp. 
Once I set it, it started to display on the Dock tile menu.
Because we added window names manually to the menu, I worried if same window 
names may appear twice : one by our manual insertion/addition and the other by 
automatic addition of Cocoa when displaying an instance of NSWindow. However, 
it didn’t. Luckily our “Window” menu also had the window list at the end, not 
anymore in its middle. So, there was no further work required.

Anyway, thank you for your hint. Although I asked about dock menu and I was so 
soaked with dock menu, but your mentioning of applicationDockMenu: gave me some 
idea, and started to think differently. :)

(BTW, It can be better if Apple name the portion of Dock menu as Windows name 
list and mention that it’s linked to Windows menu’s window name list. Without 
it, yes.. we can guess. However, I first thought it as “Opened Document List” 
and looked up NSDocumentController. There I found addDocument:. It mentioned 
about “open document list”. So, I lost my direction there at first. But a small 
icon in front of Window list items gave me a clue. The icon was for “window” 
not “document”. So, I guessed that it may be called “current window list” 
instead of “open document list”. With your hint and such guess made me to look 
at “Windows” menu. :)

Well.. it’s how I solved. If someone work on their own framework written on top 
of Cocoa and run into similar problem like mine, I hope he would be able to 
find a clue from this post. :)

Happy coding~
JongAm Park

 On Jan 27, 2015, at 12:55 PM, Lee Ann Rucker lruc...@vmware.com wrote:
 
 -[NSApplicationDelegate applicationDockMenu:]
 
 You can customize everything except the recent documents; you get that for 
 free and can't get rid of it - no, not even if the user clears recent 
 documents from the main menu.
 
 On Jan 27, 2015, at 10:38 AM, JongAm Park jongamp...@sbcglobal.net wrote:
 
 Hello, all. It has been long time for me to write anything in this mailing 
 list, but I prefer this than web based one Apple now pushes.
 
 Anyway.. I have some issue with “Window list”
 
 If a window is created, it’s added to a window list under the “Window” menu 
 and its equivalent counter part on the Dock menu.
 However, in a project I work on nowadays, ( which is heavily customized on 
 top of Cocoa and old Carbon ), it has a window list menu items under 
 “Window” menu, but somehow there is no such thing on the Dock menu.
 
 It’s not document based app. (Well.. I mean it’s not based on NSDocument. We 
 have our own mechanism for managing our in-house document type. ) 
 I tried setExcludedFroWindowsMenu: of NSWindow to see if it has any effect 
 on the Dock menu, but it didn’t.
 
 Is there anyway to have Dock menu contain the window list menu items?
 
 I searched Apple’s documents, but there looks to be no explicit way to 
 remove/add window list.
 
 Thank you.
 JongAm Park
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.apple.com_mailman_options_cocoa-2Ddev_lrucker-2540vmware.comd=AwIGaQc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=ie7S-J__EKnfyVOBV7-jV2rZ--p47O6vkyTklpDM3h4m=hjEqDZ8jEpHgyNJtfaA4FaxGdsZAsosDKscQglYgNj8s=8RSNVk4UJgxTxrQv7wfY3bFC1h_KbfGPw4gqQBO3jfce=
  
 
 This email sent to lruc...@vmware.com
 


___

Cocoa-dev mailing list (Cocoa-dev

[Q] Difference in terms of when it sense that it's rotated?

2012-11-12 Thread JongAm Park
Hello,

I noticed that iOS 5.x. has very strange problems in rotation especially in 
launching time.
While an app is being launched, it presents a logo image inside of a 
UIImageView and presents a main GUI screen.
It's always on landscape mode.
What is weird with iOS 5 is that it works as intended on iOS 5 simulator, but 
on a real iOS 5 device ( with iOS 5.1.1 ), the rotation for displaying the main 
GUI is not applied at all. However, once it is out ouf the chain of code 
processed for launching, it works as expected.
What I mean is that once the GUI is laid out ( wrongly at first ) and finished 
launching and if you click buttons on it and add a subview ( to a view of a 
root view) which has UI for the new screen and eventually go back to the 
wrongly rotated view by re-adding it to the root view, now the rotation is 
applied correctly.
So, on a simulator, even the initial presentaiton of the main UI is done 
correctly. But on a real iOS 5.1.1 device, it doesn't.
 
After googling, I found out that iOS 5 has many problems especially with its 
simulators. However, in this case the simulator looks to work more well than 
real one.
On iOS 6, whether it's simulator or a real one, it works well.
 
The project is bulit with iOS 6.0.1 and targeted for iOS 5.0.x to support that 
as minimal requirement.
 
Any thought on this?
 
Thank you.

BTW, I have seen that many people asked question on iOS to this mailing list 
and Apple doesn't provide any mailing link for iOS specifically. Well, kind of 
understanding that, because whether it's Mac or iOS, they are basically Cocoa. 
Actually I noticed more iOS questions or discussion is going on here than ever. 
So, is it Ok to ask question on iOS even though this mailing list description 
still says The Cocoa Development list is for discussions regarding native Mac 
OS X application development using the Cocoa Frameworks:?


___

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

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

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

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


[Q] a view is associated with more than one view controller?

2012-10-25 Thread JongAm Park
Hello,

I'm having a problem while rebuilding old project which was made with iOS 3.x 
SDK at first.
Currently I'm building it with iOS 6.0 SDK and can be targeted for 4.3.

There is a central controller, RootViewController.
And when the app is loaded, it creates an instance of UIImagePickerController.
And finally, it tries to assign the view of UIImagePickerController, i.e. 
imagePickerController.view, to the RootViewController's view.

Brief code lines are like this.

if([UIImagePickerController 
isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) 
{
self.camera = [[UIImagePickerController alloc] init];
[self.camera setSourceType:UIImagePickerControllerSourceTypeCamera];
self.camera.allowsEditing = NO;
self.camera.navigationBarHidden = YES;
self.camera.toolbarHidden = YES;
self.camera.wantsFullScreenLayout = YES;

...

self.view == self.camera.view; // This is where it throws the exception.
// self is RootViewController

The error message is this :

A view can only be associated with at most one view controller at a time! View 
UILayoutContainerView: 0x1ddbee60; frame = (0 0; 320 480); autoresize = W+H; 
layer = CALayer: 0x1ddbeed0 is associated with UIImagePickerController: 
0x1dd510b0. Clear this association before associating this view with 
RootViewController: 0x1dd32f20. : A view can only be associated with at most 
one view controller at a time! View UILayoutContainerView: 0x1ddbee60; frame = 
(0 0; 320 480); autoresize = W+H; layer = CALayer: 0x1ddbeed0 is associated 
with UIImagePickerController: 0x1dd510b0. Clear this association before 
associating this view with RootViewController: 0x1dd32f20.

The UILayoutContainerView: 0x1ddbee60 is self.camera.view.

According to this StackOverFlow page, its sounds like that it was possible to 
assign a view controller's view to other controller's view with previous iOS 
SDK, but looks to be changed recently.

Does Apple recommend other approach to achieve the same goal?
If anyone knows how to solve this problem, please show me your guidance.

Thank you.
JongAm Park


___

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

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

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

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


Re: [Q] a view is associated with more than one view controller?

2012-10-25 Thread JongAm Park

On 10/25/2012 7:05 AM, Julius Oklamcak wrote:

If anyone knows how to solve this problem, please show me your guidance.

From some work I did earlier this year for a client, UIImagePickerController
needs to be presented modally or in a UIPopoverController. It also doesn't
handle being a root view controller very well (window.rootViewController =
imagePickerController
Thanks for the information. I was off from iOS dev. for a while to focus 
more on Mac and Windows.

However, I kept monitoring what were being added and changed in iOS SDK.
What is embarrassing is that Apple started to push some guide line ( 
if we think of them positively ) or restriction ( if we think of them 
negatively ) and it broke things. For the specific line of code, I put 
in my original message, I think it was wrong to assign 
UIImagePickerController's view to other (Root) controller view at first. 
I think so, not because it was not possible to do, but because it is 
kind of against of idea that Apple introduced view controllers with and 
the gut feeling how Apple people wanted us to use it.


Anyway, because presentModalViewController:animated is deprecated in iOS 
6, i may need to use presetnViewControlle:animated:completion.
However, I also think the target iOS device can have iOS 4.x still. So, 
I need to decide which one to sacrifice, the use of latest message or 
target audience who doesn't upgrade their iOS to iOS 5.0+ yet. or 
probably I can use some gestalt/introspection method to figure out 
branch into to identical code utilizing different messages.



Without going the route of using the various AV Foundation APIs to implement
your own camera controller class, the solution I used was to present the
UIImagePickerController modally in the root view controller's
-viewDidAppear: method (you could try in -viewWillAppear:).


One thing I'm worry is that they customized the view so much that I have 
to rearchitect overall programming structure.
The current code is in -videDidLoad. But it heavily depends on 
rootController.view = UIImagePickerController.view assignment.
However, people just brought me this outsourced project because the 
company which was contracted for this project was departed from us a 
while ago. And they are saying it's urgent...  I saw lots of s***dity in 
the source code, where they even didn't release object properly; they 
implemented -(id)init messages without calling its init of its super 
class;  I would like to zip my mouth


Probably I need to consider addChildViewController also, because of this 
line of explanation for view property in UIViewController.
Each view controller object is the sole owner of its view. You must not 
associate the same view object with multiple view controller objects. 
The only exception to this rule is that a container view controller 
implementation may add this view as a subview in its own view hierarchy. 
Before adding the subview, the container must first call its 
|addChildViewController: 
http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/addChildViewController:| 
method to create a parent-child relationship between the two view 
controller objects.


Actually I tried it yesterday night, but it complaint that the view ( 
probably mean the view of UIImagePickerController ) doesn't support the 
orientation the app is running.  I would like to read View controller 
guide line more calmly tonight...


Thank you.


Thank you for your help.
JongAm Park
___

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

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

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

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


Re: [Q] a view is associated with more than one view controller?

2012-10-25 Thread JongAm Park

Thank you, Baoming. I tried but it didn't work.

Probably I need to chores around it more. I have a few things to do in 
mind. So, I will retry that.

However, UIImagePickerController's view looks to be special as others said.

Best,

On 10/25/2012 12:53 AM, Baoming Tian wrote:

Why not just add the camera view as sub view of the root ?

from my  iPhone




___

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

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

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

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


Re: [Q] a view is associated with more than one view controller?

2012-10-25 Thread JongAm Park

On 10/25/2012 7:18 AM, Roland King wrote:


On 25 Oct, 2012, at 10:05 PM, Julius Oklamcak juli...@icodemonks.com 
mailto:juli...@icodemonks.com wrote:



If anyone knows how to solve this problem, please show me your guidance.


From some work I did earlier this year for a client, 
UIImagePickerController
needs to be presented modally or in a UIPopoverController. It also 
doesn't
handle being a root view controller very well 
(window.rootViewController =

imagePickerController).

Without going the route of using the various AV Foundation APIs to 
implement

your own camera controller class, the solution I used was to present the
UIImagePickerController modally in the root view controller's
-viewDidAppear: method (you could try in -viewWillAppear:).




That is all true - on top of that, after introducing view controller 
containment in iOS5 to give people a proper way of doing what was 
always not recommended, taking a view from ViewController B and 
slapping it into ViewController A, iOS 6 is finally strict about it. 
You just can't do this any more.




That's good. :)
I don't like people who just write code which just looks to work because 
their managers or people at asked-company-if-contracted don't know about 
programming.
I have seen so many people in Windows and Mac, and now even in iPhone 
world who didn't understand paradigm of a framework and just write code 
without knowing that it violated the paradigm. When something doesn't 
abide by the paradigm, it may work now, but can break seriously soon.

Also, it's highly possible that it is not even properly implemented.
What I'm saying is just like this : a guy just implemnted 1+1 = 2 like : 
1 + (uh... i don't know what to do ) + 2 + 3 - 3 - 1 (hmm.. it looks 
working.. ) = 1

However, welll... cruel world. I got such source code on my hand.

If you want to mix views from different VCs on the screen, you now 
*must* use View Controller Containment (and that's the right thing to 
look for in the documentation).


The advice above about UIImagePickerController is I believe also true, 
that thing really wants to be modal (I hope they change that one day).

by using.. like.. addChildViewController: right?

I found this explanation in Apple's document. ( view property in 
UIViewController class reference. )


Each view controller object is the sole owner of its view. You must not 
associate the same view object with multiple view controller objects. 
The only exception to this rule is that a container view controller 
implementation may add this view as a subview in its own view hierarchy. 
Before adding the subview, the container must first call its 
|addChildViewController: 
http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/addChildViewController:| 
method to create a parent-child relationship between the two view 
controller objects.


It sounds like that if I add UIImagePicker controller using 
addChildViewController:, it's possible to set the view of a root view 
controller to the view of UIImagePicker. but it didn't work last night. 
Probably I missed something. I would like to read their document more.


There are a few things I would like to try (again) :

1. |presentViewController:animated:completion: 
http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/presentViewController:animated:completion:

2. addChildViewController:

What do you think about it?

I'm switching to Windows mode by launching Visual Studio... :(

Thank you.
JongAm Park
|
___

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

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

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

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


[Q] Cocoa Binding for filters applied to CALayer

2012-08-29 Thread JongAm Park
Hello, 
I'm trying to refresh my knowledge on Core Animation, and reading Addison 
Wesley's Simplified Animation.

I created a new project from the scratch to mimic what is explained in Chapter 
6, which has a NSView on a main window.
On that instance of NSView, a CALayer is added and it is the layer where an 
image is displayed. Also a CIFilter is applied to that layer.
On the right of the NSView instance, there are a few slider controls to change 
parameters of CIFilters.

Here is a method/message for creating filters.

@synthesize imageLayer;

- (NSArray *)filters
{
CIFilter *blurFilter = [CIFilter filterWithName:@CIGaussianBlur];
[blurFilter setDefaults];
[blurFilter setValue:[NSNumber numberWithFloat:1.0] 
forKey:@inputRadius];
[blurFilter setName:@blur];

//  CIFilter *hueFilter = [CIFilter filterWithName:@CIHueAdjust];
//  [hueFilter setDefaults];
//  [hueFilter setValue:[NSNumber numberWithFloat:0.0f] 
forKey:@inputAngle];
//  [hueFilter setName:@hue];
//  
//  CIFilter *colorFilter = [CIFilter filterWithName:@CIColorControls];
//  [colorFilter setDefaults];
//  [colorFilter setName:@color];


//  return [NSArray arrayWithObjects:blurFilter, hueFilter, colorFilter, 
nil];

//  return [NSArray arrayWithObjects:blurFilter, hueFilter, nil];

return [NSArray arrayWithObject:blurFilter];

}

The filters are added to the instance of CALayer using setFilters:.
And a slider control, for example, is bound to 
imageLayer.filters.blur.inputRadius using the binding property in IB resource 
editing mode.
Once it is bound, it complaints this error.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '[__NSArrayI 0x10340 addObserver:forKeyPath:options:context:] is 
not supported. Key path: blur.inputRadius'


What is really funny is that AW's sample project for that are the same, and it 
doesn't complain that. I checked settings for target, project, xib version 
number, whether to use ARC or not just in case, and so on.

Somehow, it doesn't seem to recognize the added filter, blur. The IB module 
suggests imageLayer.filters. However it doesn't do so after that. However, in 
the AW's sample project, it's the same. So, I don't think it is the problem.
The AW's project was created when there was no ARC. So, I even changed the 
project setting to use ARC and others.
So, I don't think that the filter is released somehow in my own project.

So, can I ask what can be wrong with my project?

Thank you.

P.S. Personally I don't use Cocoa Binding much. I did use when it was 
introduced. But it turned out that it's very hard to debug if there is 
something wrong. I turned on NSBindingDebugLogLevel to 1 also. But it doesn't 
tell much about this problem.


___

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

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

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

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


Re: [Q] Cocoa Binding for filters applied to CALayer

2012-08-29 Thread JongAm Park
Hmm.. I found an interesting case here.

I tried to add this message for a newly created button to set the inputRadius 
in code.

- (IBAction)blurIt:(id)sender
{
[self setValue:@10.0f 
forKeyPath:@imageLayer.filters.blur.inputRadius];
}

Then it works. It's very interesting that the binding property using IB 
resource editing doesn't work...


___

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

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

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

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


Re: [Q] Cocoa Binding for filters applied to CALayer (JongAm Park)

2012-08-29 Thread JongAm Park
I found somewhat interesting behavior.

When it doesn't use property to set an instance of CALayer like this :

 m_imageLayer = [CALayer layer];

instead of

self.imageLayer = [CALayer layer];

it doesn't cause the problem anymore.

Instead of using property, I tried to use a setter and a getter methods for 
being sure like :

- (void)setImageLayer:(CALayer *)layer;
- (CALayer *)imageLayer;

 [self setImageLayer:[CALayer layer]];

Then it presented the same problem.

So, somehow CALayer looks to be assigned directly instead of using properties.
Once assigned directly, it doesn't matter whether to set filter by 
[self.imageLayer setFilter:...] or
[m_imageLayer setFilter...]

Is there any reason why it works like that?

Thank you.
JongAm Park
___

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

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

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

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


Re: Cocoa-dev Digest, Vol 9, Issue 176

2012-03-15 Thread JongAm Park
Yes. That is exactly the case why I tried to find a better and elegant 
solution.

I'm sorry that I didn't read digest version of Cocoa-dev email yesterday.
To me it was a busy day yesterday and when I went back home, I literally 
went to bed ( after writing one email. )

So, I missed your great post.

Some people would say we don't need to clean up at that moment, but 
generally speaking there can be a necessity of cleaning up, which is not 
only about releasing memory ( well, garbage collector helps here a lot. 
) but also closing network ports, or serial ports.
( Mac and iOS devices don't have serial ports, but I put it here as an 
example. )
Back in 1990's I noticed that if a terminal program on one computer, 
i.e. my PowerBook 140, Mac LC, IBM-compatible PC 386 processor machine I 
assembled, quits without closing a port, it or the program on the other 
sides could hang. Modern OS or language RunTimes seem to handle those 
well compared how things were in late 80's and early 90s.

But still we want to make sure things are to be cleaned up properly, right?

But as with Cocoa and .NET, I noticed that threading model evolved to 
have one main thread ( which is responsible for UI ) take the whole role 
in managing UI, while other threads generally take care of more 
dedicated chores which don't need to handle UI widgets. But because 
sometimes it will be required, Apple provides 
performSelectorOnMainThread() and MS provides Invoke() mechanism.

However, this left the problem I noticed and you described here.

MS seems to have its RunTime handles things sufficiently well. If I 
don't assign a thread variable to null ( to prevent calling a method of 
a null object like myThread.Join() or myTread.DoCleanUp() or whatever, 
the C# .NET runtime doesn't raise an exception for accessing a member 
function of a non-existing object.

Also, it seems to close a serial port.
However, this may not ensure something, like proper hand-off for the 
opponent on the other side of communication channel.  Or the opponent 
codes can be written to handle a case when its opponent doesn't respond 
anything.
But.. anyway point here is.. yes.. as we can see it, it can be a problem 
under some situation.


 Anyway, I will go through this mailing list digest email when I go 
back home.

I don't want to miss others' great insight posted here. :)

Have a nice day, and I'm sorry for people I didn't reply to yet..

JongAm Park

On 3/13/2012 5:00 PM, cocoa-dev-requ...@lists.apple.com wrote:

Message: 11
Date: Tue, 13 Mar 2012 16:49:33 -0700
From: Jay Reynolds Freemanjay_reynolds_free...@mac.com
To: Cocoa-Dev (Apple)cocoa-dev@lists.apple.com
Subject: Re: [Q] Why is the threading and UI updating designed to be
done only   on a main thread?
Message-ID:7de60fad-f19f-4b03-aff9-88a781420...@mac.com
Content-Type: text/plain; CHARSET=US-ASCII

Notwithstanding the good advice about parallel programming given earlier in 
this thread, there are still possible problems.  By way of illustration, a year 
or two ago I submitted a bug report (#8338166) about a problem of this sort in 
iOS.  I will describe the problem here.  (I am not looking for a workaround, I 
have one -- here I am just providing a real example from the past that may be 
of interest.)

Consider UIApplicationDelegate method applicationWillTerminate::  
Multithreaded applications may not be able to use it to shut down, because of the 
possibility of deadlock in communications between the main thread and other application 
threads.

Suppose we have a multithreaded iOS application whose non-main threads occasionally use 
performSelectorOnMainThread:withObject:waitUntilDone: to interact with the 
main thread.  Now suppose the following things happen, in this order:

1) applicationWillTerminate: is called (by the OS, on the main thread).

2) Immediately thereafter, before applicationWillTerminate has completed, some other thread calls 
performSelectorOnMainThread:withObject:waitUntilDone:, with waitUntilDone:'s value 
set to YES.

3) Suppose the application needs to get the other thread to do some shut-down work -- the 
kind of thing that is supposed to happen in applicationWillTerminate:

4) We now have a problem with deadlock.  The application*cannot*  communicate with the other thread from inside 
applicationWillTerminate:, because the other thread is waiting for performSelector ... to run, 
and that won't happen until applicationWillTerminate: has itself returned.  And if the application posts an 
event to the other thread and then returns from applicationWillTerminate:, it is highly likely that the OS 
will terminate the application before the other thread has had a chance to act.  So there is no reliable way to get the 
other thread to do its cleanup.

The point here is that since applicationWillTerminate: is called 
asynchronously from the point of view of the app, the app can*NEVER*  communicate with 
any thread that may have to do clean-up work, by any communication

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

Umm.. Mr Lambert..

It's OK. I'm not offended.
If I confess, I felt a little uncomfortable, because I understand pretty 
well this kind of stuff but he put an emphasis by saying mess. But we 
are talking in a text based media which doesn't convey facial expression 
or tone of voice.
So, based on my experience with chatting programs, the speaker may not 
have any intention to offend.
So, I'm a kind of neutral. Probably it was his style of talking but.. 
you know.. it didn't sound harsh in a jungle with full of male creatures. :)


I appreciate your concern though. :)

JongAm Park


On 3/14/2012 9:07 AM, Brian Lambert wrote:
Scott, it's not that any one thing is hard to get correct.  Arrogantly 
calling someone stupid, as you've done here, doesn't help.  It's 
the subtlety of getting *everything* correct.  A GUI system, and the 
programs that are layered on top of it, embody a great deal of 
complexity.  Allowing multiple threads to operate on the GUI causes 
this complexity to permute.


On Wed, Mar 14, 2012 at 6:43 AM, Scott Ribe 
scott_r...@elevated-dev.com mailto:scott_r...@elevated-dev.com wrote:


On Mar 13, 2012, at 3:09 PM, JongAm Park wrote:

 In other words, the thread function may want to update UI like
inserting a log message to a text field on a window and thus
asking main thread to do so, and main thread is waiting to acquire
a lock or waiting using Join, then either the main thread and
the other thread can't progress.

Ouch. If you think that's a problem, then trust me, you would
really make a mess with multiple UI threads.


___

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

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

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

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

Umm.. Mr Lambert..

It's OK. I'm not offended.
If I confess, I felt a little uncomfortable, because I understand pretty 
well this kind of stuff but he put an emphasis by saying mess. But we 
are talking in a text based media which doesn't convey facial expression 
or tone of voice.
So, based on my experience with chatting programs, the speaker may not 
have any intention to offend.
So, I'm a kind of neutral. Probably it was his style of talking but.. 
you know.. it didn't sound harsh in a jungle with full of male creatures. :)


I appreciate your concern though. :)

JongAm Park

P.S. I hit a reply button instead of reply all habitually.
So, to provide continuity to the mailing list, I reply here again. :)

On 3/14/2012 9:17 AM, Brian Lambert wrote:
Ouch. If you think that's a problem, then trust me, you would really 
make a mess with multiple UI threads.


That isn't calling someone stupid?  Really?

Ah, OK. My inference processor must be in error.


On Wed, Mar 14, 2012 at 9:14 AM, Scott Ribe 
scott_r...@elevated-dev.com mailto:scott_r...@elevated-dev.com wrote:


On Mar 14, 2012, at 10:07 AM, Brian Lambert wrote:

 Scott, it's not that any one thing is hard to get correct.
 Arrogantly calling someone stupid, as you've done here, doesn't help.

I didn't call anyone stupid--that's your inference, not mine.

I did point out that someone who thinks he can solve a thread
deadlock problem by throwing more threads at it is really headed
in the wrong direction.

--
Scott Ribe
scott_r...@elevated-dev.com mailto:scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 tel:%28303%29%20722-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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

On 3/14/2012 9:14 AM, Scott Ribe wrote:

On Mar 14, 2012, at 10:07 AM, Brian Lambert wrote:


Scott, it's not that any one thing is hard to get correct.  Arrogantly calling 
someone stupid, as you've done here, doesn't help.

I didn't call anyone stupid--that's your inference, not mine.

I did point out that someone who thinks he can solve a thread deadlock problem 
by throwing more threads at it is really headed in the wrong direction.



No, that is not my idea.
My idea is always to reduce dependency on threads and best if it can be 
removed altogether.
I think you didn't understand my initial question and the extra stuff I 
put there.


It's Ok though.

JongAm Park
___

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

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

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

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

On 3/14/2012 9:19 AM, Wade Tregaskis wrote:

Threads themselves are very useful; multiple threads taking user input and 
updating the display to the user are not really useful, and the request for 
them more often than not betrays a lack of understanding of threading.

So you think it'd be great it every GUI app shared the same serial queue for 
all interactivity and drawing?  Boy do I have a Mac Classic to sell you...

The reality is of course more of a compromise.  It's quite common to do drawing across 
multiple threads, though you still synchronise the final blits around a 
single thread (i.e. the main thread).  Likewise even event handling is often effectively 
multi-threaded, because you dispatch from the main thread to a variety of tasks, queues 
or worker threads.

Having a UI framework that either offloads some of this for you can actually be 
very useful.  It would also be closer to the user experience we're trying to 
portray - for example, that each document on an app is totally independent.  
Having all documents hang because one is having issues (Safari I'm looking at 
you, you evil bastard) completely breaks that illusion.


That's good point.
One of the reason in the 90's those were allowed was to achieve the goal 
you are concerned about, I think.


From sometime in 2000's, it seems to me that philosophy behind language 
design and framework design were changed to be like current model.


Because, as you said, there can be some situation where it is a lot 
easier and better to allow accessing GUI widgets from any threads, we 
can feel sorry about it, but if language and framework designers changed 
their mind to design like how they are now, there should be a workaround 
for this kind of case.
I guess that allowing it will make distributing work unit, i.e. in the 
form of blocks or lamda functions, difficult because there will be many 
issues. So, I understand that and as Mr. Alfke said, there did exist 
some difficulties in multithreaded programming.


So, it is trade-off between two conflicting idea. Currently reducing 
complexity of maintaining and architecting thread-based S/W architecture 
looks to be the main virtue.


In the case of the Safari thing, if WebKit or Apple developers create 
each window as processes rather than threads, they can reduce dependency 
between documents or windows more than using threading, although 
data sharing is still needed between processes.
I remember sometime during 1990's there were debate between process 
model vs. thread model.
Usually Unix society preferred process model, because it is safer and 
death of one software processing unit doesn't make the whole program 
dies. However, somehow thread model which were more popular in PC world 
got the popularity more. ( thanks to its light-weight?  and.. for me, it 
was due to less confusing model for threading. )


Whatever the history is, we need to find some workaround when we reach a 
point where one model is not as great as others. :)


JongAm Park

___

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

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

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

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

Well, Mr. Ribe.

I'm sorry but I'm not inexperience with this domain.
I'm not trying to solve this problem with more complicated model.

I was to find out any rationale, I may not think of, behind the new 
model, and a well-established code pattern to solve it.


JongAm Park

On 3/14/2012 9:23 AM, Scott Ribe wrote:

On Mar 14, 2012, at 10:17 AM, Brian Lambert wrote:


Ouch. If you think that's a problem, then trust me, you would really make a mess 
with multiple UI threads.

That isn't calling someone stupid?  Really?

No, it's calling someone inexperienced with the domain and unprepared to deal 
with a problem by pursuing a more complex solution.



___

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

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

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

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
Yes. I agree. That is one of the approach I'm thinking of when I handled 
similar issue with QuickTime.

Thanks,

On 3/14/2012 10:05 AM, Gary L. Wade wrote:

On Mar 13, 2012, at 2:09 PM, JongAm Parkjongamp...@sbcglobal.net  wrote:


In other words, the thread function may want to update UI like inserting a log message to 
a text field on a window and thus asking main thread to do so, and main thread is waiting 
to acquire a lock or waiting using Join, then either the main thread and the 
other thread can't progress.

To solve your thinking on this matter, conceptualize the background thread as a 
(M)odel object, the main thread a (V)iew object, and possibly an NSMutableArray 
of NSStrings each having an individual log message being a (C)ontroller object. 
By breaking your logic up accordingly, it should be more obvious why things are 
the way they are. A simple way to update the UI is to add a timer to your main 
thread that checks to see if the controller object has been changed; if so, it 
can update the UI. To accommodate a full UI thread and fit within a user's 
visual update time, a time interval of 1/120 second should be fine. Naturally, 
you'll want to lock the controller object while being updated by the model or 
being (quickly) read by the view.

You don't want your background thread wasting time waiting on the user to see 
its data; let it keep working and let the main thread check for updates when it 
can.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

Well, I'm sorry if I confused you.

BTW, common advice to avoid threading doesn't mean that threading 
should not be used.

Just like salt, if it is used for right occasion, it is very good.
However, when there are another way not to use thread but just to use 
threading because it can be used is not right.

I think that is the meaning of common advice to avoid threading.

So is Necessary Evil. I saw this expression in one of Microsoft's 
Windows Programming book in early 90's.

:)

On 3/14/2012 10:25 AM, Scott Ribe wrote:

When you said just like threading itself it seemed to me that you were 
echoing common advice to avoid threading, and I don't necessarily agree with that because 
threading can be very useful and I use it extensively. I guess I would agree with advice 
to always consider carefully before going to multi (or more) threads.

On Mar 14, 2012, at 11:09 AM, JongAm Park wrote:


Well.. Yes. I understand what you mean. I just added the threading stuff in the 
discussion.
Probably it is due to my English? I thought just like... could serve to express my 
understanding of your concern for UI main thread and other threads and just provided 
analogous thing. ( Arr.. my English.. )




___

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

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

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

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


Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park

On 3/14/2012 10:27 AM, Scott Ribe wrote:

On Mar 14, 2012, at 11:23 AM, JongAm Park wrote:


it didn't sound harsh in a jungle with full of male creatures.

LOL! And you said your English was not so good. That was great!

Well, I was not born in English-speaking country. So, sometimes my 
English can sound (very) abnormal and sometimes doesn't follow your 
culture, etc. So, it's possible that I don't catch your idea or doesn't 
express my idea culturally correctly.

I apologize if I made you feel bad.

JongAm Park
___

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

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

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

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


[Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-13 Thread JongAm Park

Hello,

While doing projects with Cocoa and Objective-C, I have always thought 
that allowing UI update only on main thread was a weak point of 
Cocoa/Objective-C.
Especially, when gracefully terminating threads which would be better 
update some UI stuff and if main thread is required to wait until those 
threads finishes for clean exit, it can cause dead lock condition.
In other words, the thread function may want to update UI like inserting 
a log message to a text field on a window and thus asking main thread to 
do so, and main thread is waiting to acquire a lock or waiting using 
Join, then either the main thread and the other thread can't progress.


But, I also noticed the same pattern with C# .NET. Unlike Win32/MFC and 
like Objective-C/Cocoa, it also asks a main thread to update UI widgets.


Is there any reason to design threading and UI update model like this?
At first I thought it was due to somehow Obj-C/Cocoa sticks to some old 
model, but C# .NET is fairly new architecture. They could have avoided 
it if doing so was better. So, I guess there must be some reason behind it.


Can anyone explain the rationale behind it?
Also, is there a way to gracefully terminate an app by quitting threads 
and main thread?


Thanks,
JongAm Park
___

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

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

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

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


[Q] loadView doesn't return?

2011-11-04 Thread JongAm Park

Hello,

I tried to use AV Foundation's playback capability.
So, by following AV Foundation Programming Guideline, it wrote codes for Mac. ( 
The document is written for iOS. )
Also, I looked up View Controller sample codes and AnimatedTableView.

What is strange is that it doesn't return after loadView was called in my 
testing project, although it does in those sample codes.
I didn't find any semantic difference yet.

This is from my sample codes :

An app delegate class :

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application

NSLog( @AppDelegate  applicationDidFinishLaunching );   

[_placeholderView addSubview:_viewController.view]; = calls loadView 
of a child class of NSViewController
[_viewController.view setFrame:_placeholderView.frame];
[_viewController setRepresentedObject:[NSNumber 
numberWithUnsignedLong:[[_viewController.view subviews] count]]];
}


The child class of NSViewController

- (void)loadView
{
[self viewWillLoad];
[super loadView]; = doesn't return
[self viewDidLoad];
}

Does anyone know why the loadView doesn't return?
Can you spare me your idea?

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: [Q] loadView doesn't return?

2011-11-04 Thread JongAm Park
It turned out that it didn't like to instantiate an NSViewControl class in its 
xib.
So, instead, I created it in the code and it made loadView returns.

However, I still have some problems.

Although audio is played, video is not played.

So, I changed its view class for setting player like this ( by refering 
ViewController sample codes )

- (void) setPlayer:(AVPlayer *)player
{

//  [(AVPlayerLayer *)[self layer] setPlayer:player];

AVPlayerLayer *playerLayer = [AVPlayerLayer 
playerLayerWithPlayer:player];
[playerLayer setFrame:[self.layer bounds]];
[playerLayer setAutoresizingMask:(kCALayerWidthSizable | 
kCALayerHeightSizable)];
[self setLayer:playerLayer];
}

However, it still doesn't display any video frame.

Any ideas?

FYI, This is how it looks in ViewController sample codes :
Thank you.

- (void)awakeFromNib
{
NSString* moviePathStr = [[NSBundle mainBundle] pathForResource:@adam 
ofType:@mov];

player = [[AVPlayer alloc] init];
AVURLAsset *file = [AVURLAsset assetWithURL:[NSURL 
fileURLWithPath:moviePathStr isDirectory:NO]];

[file loadValuesAsynchronouslyForKeys:nil completionHandler:^(void) {

// The asset invokes its completion handler on an arbitrary 
queue when loading is complete.
// Because we want to access our AVPlayer in our ensuing 
set-up, we must dispatch our handler to the main queue.
dispatch_async(dispatch_get_main_queue(), ^(void) {

// Create an AVPlayerLayer and add it to the player 
view if there is video, but hide it until it's ready for display
AVPlayerLayer *newPlayerLayer = [AVPlayerLayer 
playerLayerWithPlayer:player];
[newPlayerLayer setFrame:[[self.view layer] bounds]];
[newPlayerLayer setAutoresizingMask:kCALayerWidthSizable | 
kCALayerHeightSizable];
[[self.view layer] addSublayer:newPlayerLayer];

// Create a new AVPlayerItem and make it our player's current item.
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:file];
[player replaceCurrentItemWithPlayerItem:playerItem];

playingForward = YES;
[[NSNotificationCenter defaultCenter] 
addObserverForName:AVPlayerItemDidPlayToEndTimeNotification object:playerItem 
queue:nil usingBlock:^(NSNotification *note) {
if(playingForward) {
[player 
seekToTime:CMTimeMultiplyByFloat64(playerItem.duration, 0.99f)];
[player play];
player.rate = -1;
playingForward = NO;
} else {
[player seekToTime:kCMTimeZero];
[player play];
player.rate = 1;
playingForward = YES;
}
}];

[player play];
[player release];
});

}];
}



On Nov 4, 2011, at 9:46 AM, JongAm Park wrote:

 
 Hello,
 
 I tried to use AV Foundation's playback capability.
 So, by following AV Foundation Programming Guideline, it wrote codes for Mac. 
 ( The document is written for iOS. )
 Also, I looked up View Controller sample codes and AnimatedTableView.
 
 What is strange is that it doesn't return after loadView was called in my 
 testing project, although it does in those sample codes.
 I didn't find any semantic difference yet.
 
 This is from my sample codes :
 
 An app delegate class :
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
 {
   // Insert code here to initialize your application
   
   NSLog( @AppDelegate  applicationDidFinishLaunching );   
   
   [_placeholderView addSubview:_viewController.view]; = calls loadView 
 of a child class of NSViewController
   [_viewController.view setFrame:_placeholderView.frame];
   [_viewController setRepresentedObject:[NSNumber 
 numberWithUnsignedLong:[[_viewController.view subviews] count]]];
 }
 
 
 The child class of NSViewController
 
 - (void)loadView
 {
   [self viewWillLoad];
   [super loadView]; = doesn't return
   [self viewDidLoad];
 }
 
 Does anyone know why the loadView doesn't return?
 Can you spare me your idea?
 
 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


[Q] how to tell NSNotificationCenter to send posted noti?

2011-10-07 Thread JongAm Park
Hello,

I have this kind of code.

For NSComboBox, I defined to messages :

1. selectionDidChange
2. selectionIsChanging

When a user selects other item in a combo box ( for containing list of tasks ) 
after changing the current one, I would like to have selectionIsChanging 
saves the new task info, and switch to the new task in selectionDidChange.

However, when a modal dialog box is displayed in a message called in 
selectionIsChanging, the selectionDidChange is not called after things are done 
in selectionIsChanging.
However, strangely if I click on other widgets like NSTableView, it suddenly 
sends the notification to selectionDidChange at that moment.

Is there a way to enforce sent NSComboBoxSelectionDidChangeNotification 
notification delivered to selectionDidChagne notification message I defined? 

Thanks,
JongAm Park___

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

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


[Q] Handling cancel or stop button for NSProgressIndicator and on-going task

2011-09-01 Thread JongAm Park
Hello,

I wrote codes to processing images on a second thread and the main thread 
displays and handles progress dialog box.
Because it is not possible to create a UI thread according to Cocoa 
framework, I had the main thread process the progress dialog box, while a 
second thread process images.

However, a problem occurred when I decided to create QuickTime movie files with 
the processed images on the second thread.

It turned out that QuickTime movie can't be created on a second thread, which 
is not a main thread.

An uncaught exception was raised
QTMovie_QuickTime class must be initialized on the main thread.
*** Terminating app due to uncaught exception 
'QTMovieInitializedOnWrongThread', reason: 'QTMovie_QuickTime class must be 
initialized on the main thread.'

Then, is there any code pattern or example to handle progress dialog  and time 
consuming tasks in a main thread without blocking user interaction?
Or a solution doesn't need to be confined in that model. If it can utilize a 
second thread, it is better.

Can anyone share his/her idea with me?

Thank you.
JongAm Park___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] Handling cancel or stop button for NSProgressIndicator and on-going task

2011-09-01 Thread JongAm Park
Oh. Thank you for the information. 

I would like to make this message short because this is Cocoa mailing list not 
QuicTime mailing list. ( The topic was changed from Cocoa related question to 
QT one. )
BTW, I think I can create QTMovie in my case :

This is from Tech Note TN2138

/
Using QTMovie objects on background threads?
(1) allocate all QTMovie objects on the main thread.

The reason for this is quite simple: a QTMovie is always associated with a 
movie controller component instance, and currently no movie controller 
components are thread-safe. While a non-nil QTMovie can indeed be created on a 
background thread, the associated movie controller will always be NULL. This by 
itself is not fatal; many operations can be performed on a QTMovie object that 
has been initialized on a background thread. But certain operations will not 
work correctly, including most all of the notifications and even asynchronous 
movie-loading. That's why allocating a QTMovie on a background thread is not 
advised.

/

Thank you.
JongAm Park

On Sep 1, 2011, at 11:15 AM, Robert Martin wrote:

 No - creating the QT Movie must happen on the main thread - but after it's 
 created, you can pass it off to secondary threads for processing…
 
 Rob
 
 
 
 On Sep 1, 2011, at 1:13 PM, JongAm Park wrote:
 
 Hmmm.. probably..  enterQTKitOnThread allows to create and initialize 
 QTMovie objects on threads?
 
 On Sep 1, 2011, at 9:33 AM, JongAm Park wrote:
 
 Hello,
 
 I wrote codes to processing images on a second thread and the main thread 
 displays and handles progress dialog box.
 Because it is not possible to create a UI thread according to Cocoa 
 framework, I had the main thread process the progress dialog box, while a 
 second thread process images.
 
 However, a problem occurred when I decided to create QuickTime movie files 
 with the processed images on the second thread.
 
 It turned out that QuickTime movie can't be created on a second thread, 
 which is not a main thread.
 
 An uncaught exception was raised
 QTMovie_QuickTime class must be initialized on the main thread.
 *** Terminating app due to uncaught exception 
 'QTMovieInitializedOnWrongThread', reason: 'QTMovie_QuickTime class must be 
 initialized on the main thread.'
 
 Then, is there any code pattern or example to handle progress dialog  and 
 time consuming tasks in a main thread without blocking user interaction?
 Or a solution doesn't need to be confined in that model. If it can utilize 
 a second thread, it is better.
 
 Can anyone share his/her idea with me?
 
 Thank you.
 JongAm Park
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/robmartin%40frontiernet.net
 
 This email sent to robmar...@frontiernet.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: [Q] including omp.h?

2011-08-06 Thread JongAm Park

It didn't. That is why I asked.

Thank you.

On Aug 6, 2011, at 1:31 AM, Marcus Karlsson wrote:



--On July 31, 2011 4:49:34 PM -0700 JongAm Park jongamp...@sbcglobal.net 
 wrote:



Hello,

Because gcc now supports OpenMP, we can use pragmas for OpenMP  
without
doing any special steps except for setting Enable OpenMP and - 
fopenmp.


However, when I tried to use OpenMP functions like :
int omp_get_max_threads(void)
omp.h should be included.
However the location of omp.h is not /usr/inlcude, /usr/local/ 
include (

if any ) etc. It was under

/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/omp.h
/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/include/omp.h
/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/omp.h

However, as you can see, they are under /usr/lib.
It means that Apple or GCC people wanted to hide the include  
directory ,

i.e. lib/gcc/i686-apple-darwin10/4.2.1/include for example, under a
specific compiler's folder under /usr/lib.

So, although it would be possible to set a header path, but to make  
the

compiler choose appropriate one ( as you can see, those three are for
different gcc versions, intel, powerpc and llvm-gcc ), I believe  
there
should be some mechanism to include them in directory-path-free  
way.


Is there any such way to include the omp.h?
Or should their include path set just like other header path?


The reason why the header file is located in a per-compiler  
directory is that OpenMP has to be implemented by the compiler  
itself. That way, omp.h may change from compiler to compiler. It  
will also assure that an error is generated if OpenMP is not  
supported.


In general you shouldn't have to deal with where exactly the file is  
located. Just include omp.h and give the compiler the -fopenmp  
option. In Xcode setting Enable OpenMP Support should be  
sufficient. The compiler will find the correct header file.


Marcus



___

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

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


[Q] including omp.h?

2011-07-31 Thread JongAm Park
Hello,

Because gcc now supports OpenMP, we can use pragmas for OpenMP without doing 
any special steps except for setting Enable OpenMP and -fopenmp.

However, when I tried to use OpenMP functions like :
int omp_get_max_threads(void)
omp.h should be included.
However the location of omp.h is not /usr/inlcude, /usr/local/include ( if any 
) etc.
It was under

/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/omp.h
/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/include/omp.h
/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/omp.h

However, as you can see, they are under /usr/lib.
It means that Apple or GCC people wanted to hide the include directory , i.e. 
lib/gcc/i686-apple-darwin10/4.2.1/include for example, under a specific 
compiler's folder under /usr/lib.

So, although it would be possible to set a header path, but to make the 
compiler choose appropriate one ( as you can see, those three are for different 
gcc versions, intel, powerpc and llvm-gcc ), I believe there should be some 
mechanism to include them in directory-path-free way.

Is there any such way to include the omp.h?
Or should their include path set just like other header path?

Thank you.
JongAm Park___

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

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


[Q] calling OpenMP functions in a thread function for NSThread?

2011-07-29 Thread JongAm Park
Hello,
 
I'm using a GraphicsMagick library in my project.
 
However, there I found a very interesting behavior.
If I create an instance of Magick::Image in a normal method, 
it works OK.
However, if it is implemented in a thread function, it crashes 
when it calls omp_get_max_threads().

I tried these :
 
   1. Declare a pointer to Magick::Image in a class definition 
  and created it dynamically using new when I needed it in a thread 
method.
  = When it is being created, it reaches 
 where omp_get_max_threads() is called, 
 and it crashes saying EXC_BAD_ACCESS.

   2. Declare an instance of Magick::Image in a thread function/method
  = Same crash

   3. Declare the instance of Magick::Image as a global variable 
  and try to use it in a thread function.
  = It crashes when reading a file like image.read( file_name ). 
 Where it crashes is the same to the case 1.
 
So, I thought it could be due to stack size. So, I increased the stack size 
for the thread, but it did'nt solve the problem.
 
is there a problem in calling OpenMP functions in a thread function?
 
Thank you.
JongAm Park___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [GM-help] [Q] calling OpenMP functions in a thread function for NSThread?

2011-07-29 Thread JongAm Park

On Jul 29, 2011, at 2:03 PM, Bob Friesenhahn wrote:

 On Fri, 29 Jul 2011, JongAm Park wrote:
 
 is there a problem in calling OpenMP functions in a thread function?
 
 Possibly there is, however, I recall that your main program uses Objective C. 
  Perhaps the Objective C runtime does not properly initialize with OpenMP?
 
 OpenMP does not provide any way to explicitly initialize it.
 
 Bob


Thanks for your reply.

Right,there is no function like InitializeOpenMP(), which should be called at 
the beginning.
I set the project to use OpenMP, and if it is just declared statically like :

Magick::Image myImage;

in a normal method, there is no problem.
Only when they are either created or accessed in a thread function, it causes 
the problem.

Apple's GCC has support for OpenMP and it can be turned on/off from a project 
setting, and I turned it on.
The last time I worked with OpenMP was about 3~5 years ago, and at that moment, 
there was no problem.

Let me do some more experiment.
Maybe current version of GCC/LLVM is broken.
( I tested with GCC, LLVM-GCC, LLVM already. )

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


Re: Does anyone else dislike Xcode 4?

2011-07-25 Thread JongAm Park
I don't know how this thread was started but, yeah, I don't like the Xcode 4.

The reason is :

- Requires too much scree real-estate
Also, waste of screen real-estate

- Different shortcut from those of Xcode 3

- Useless tool bar

- Not flexible assistant editor
Simple split view is better

- Still lots of bugs

  Annoying bugs :

[Bug 1]
I reported this yesterday, but try to put an NSPathControl on an 
instance of NSWindow ( resource editor )
Make sure if your project is to be built for 10.6, for example.
It will throw an error message saying that NSPathControl and 
NSPathControl cell are not available in Mac OS X prior to 10.5

[Bug 2]
Prints out many Warning message saying that this and that property of 
widgets are not supported in Mac OS X prior to 10.5.
Again, just like the Bug 1 case, the project is not built for pre-10.5

[Bug 3]
Lots of memory usage
- Just open Xcode 4.2, for example. Don't use Xcode 4 and just 
leave it as it is.
- It will start to use lots of memory ( thus eats more HDD 
space due to increase of VM size or swap files. )
( Is this because Xcode provide more features? I don't 
think so. )

[Bug 4]
Error/Warning of previous built remains there sometimes. So, although 
it says Successfully built, it also shows red/yellow error/warning message.
= this confuses a lot.

[Enhancement Required]
Use of contextual menu more wisely : to reveal the actual name of each 
project settings, contextual menu works better. I didn't understand where the 
feature was gone, and found under Editor menu. ( Why is it under Editor 
menu? )
Instead of using keyboard combination, it is better to use contextual 
menu to open a file into a new window/tab etc.
Providing keyboard combination will work for some people, but 
also providing contextual menu for them will make things a lot easier

How the search result is laid out
Search result are source lines. To put those on the left most 
pane is not good idea. It is better to be laid out horizontally rather than 
vertically.

Confined panes of debuggers

Even Visual Studio 2010 allows users to detach panes to utilize 
multiple window or bigger window more well. I pointed the weak point of 
previous Visual Studio was MainFrame confined panes and children windows. 
Compared to that Xcode 3 was much better. I know how the initial and Xcode 2 
was bad about user configuration. Even Project Builder was very confusing. 
However, Xcode 3 was very nice. Probably MS people acknowledged  their 
shortcomings. But Xcode 4 went to the past instead of the future. Even though 
you can make one window filled with debug panes only, it is inconvenient to 
make existing window that way and open another window for source code, for 
example. It is much better to detach panes from existing one, if they really 
want to push one window approach.
However, my point is why they give up already working, better approach 
delivered by Xcode 3? To people who uses All-in-one configuration only, they 
would think that Xcode 4 is same to Xcode 3!. But.. no. I have used its 
compact layout more, because it was more flexible especially when I needed to 
work with multiple projects.

To name a few

I have liked Xcode ( pre Xcode 4 ). I'm a long time Windows programmer while at 
the same time a Mac programmer. So, I have enough knowledge to compare the 
both. I really want Apple to make Xcode 4 make better. However, I also notice 
that there are many people who just like Xcode 4 because Apple made it.
I don't like that kind of attitude.

My 2 cents...
JongAm Park


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Does anyone else dislike Xcode 4?

2011-07-25 Thread JongAm Park
Oh... BTW who started this thread in cocoa-dev mailing list?
It should be go to xcode-users!
___

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

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


[Q] Directory File enumeration order?

2011-07-20 Thread JongAm Park
Hello, I wrote lines of code to enumerate files  folders under a given folder.

NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];

NSDirectoryEnumerator *directoryEnumerator;

NSURL *candidateURL = nil;

for( theURL in m_URLs_folders )
{
   directoryEnumerator = [fileManager enumeratorAtURL:theURL
includingPropertiesForKeys:enumerationKey
   options:enumerationMask
  errorHandler:nil];

   while( candidateURL = [directoryEnumerator nextObject] )
   {

The order [directoryEnumerator nextObject] gives is :

file://localhost/Users/jongampark/Sample%20Video/Upper/Reel/Clip_0016/Media/Clip_0016_01.dpx,
file://localhost/Users/jongampark/Sample%20Video/Upper/Reel/Clip_0016/Media/Clip_0016_02.dpx,
file://localhost/Users/jongampark/Sample%20Video/Upper/Reel/Clip_0016/Media/Clip_0016_00.dpx

How can I make it retrieve in this order?

 Clip_0016_00.dpx,
 Clip_0016_01.dpx,
 Clip_0016_02.dpx,

Thank you.
JongAm Park

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] Directory File enumeration order?

2011-07-20 Thread JongAm Park
Yeah.. that was what I thought, but I thought nextObject is too vague and 
doing that additional step is too time-consuming, because I need to work on 
contents in directories in my current project very frequently.

If the NSDirectoryEnumerator supports how the next object is to be chosen, it 
can be great.

Thank you.

On Jul 20, 2011, at 2:12 PM, Evadne Wu wrote:

 Maybe instead of using the directory enumerator, fetch all the contents as an 
 NSArray and sort that?
 
 -ev
 
 On Jul 21, 2011, at 05:09, JongAm Park wrote:
 
 Hello, I wrote lines of code to enumerate files  folders under a given 
 folder.
 
 NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
 
 NSDirectoryEnumerator *directoryEnumerator;
 
 NSURL *candidateURL = nil;
 
 for( theURL in m_URLs_folders )
 {
  directoryEnumerator = [fileManager enumeratorAtURL:theURL
  includingPropertiesForKeys:enumerationKey
 options:enumerationMask
errorHandler:nil];
  
  while( candidateURL = [directoryEnumerator nextObject] )
  {
 
 The order [directoryEnumerator nextObject] gives is :
 
 file://localhost/Users/jongampark/Sample%20Video/Upper/Reel/Clip_0016/Media/Clip_0016_01.dpx,
 file://localhost/Users/jongampark/Sample%20Video/Upper/Reel/Clip_0016/Media/Clip_0016_02.dpx,
 file://localhost/Users/jongampark/Sample%20Video/Upper/Reel/Clip_0016/Media/Clip_0016_00.dpx
 
 How can I make it retrieve in this order?
 
 Clip_0016_00.dpx,
 Clip_0016_01.dpx,
 Clip_0016_02.dpx,
 
 Thank you.
 JongAm Park
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/ev%40monoceroi.com
 
 This email sent to e...@monoceroi.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: [Q] Directory File enumeration order?

2011-07-20 Thread JongAm Park
I understood what you said.

For the performance, well.. it depends on what kind of S/W it is and how often 
it needs to sort internally.
In my case, I don't think it will be too slow, but I always consider fast 
performance.
Without testing, I can think that it is slow. But whether it is practically 
fast or not is.. yeah.. it will be OK for the project I work on now.

Thank you.
JongAm Park

On Jul 20, 2011, at 3:28 PM, Jens Alfke wrote:

 
 On Jul 20, 2011, at 2:09 PM, JongAm Park wrote:
 
 How can I make it retrieve in this order?
 
 Clip_0016_00.dpx,
 Clip_0016_01.dpx,
 Clip_0016_02.dpx,
 
 I don’t think you can. In general, file systems do not have to store 
 directory contents sorted by name. It happens that HFS+ does, but other 
 common filesystems like FAT and SMB don’t. And the API isn’t going to do 
 extra work to sort the filenames for you, because these enumeration APIs are 
 often performance bottlenecks (when run over entire filesystems) and need to 
 be fast.
 
 Yeah.. that was what I thought, but I thought nextObject is too vague and 
 doing that additional step is too time-consuming, because I need to work on 
 contents in directories in my current project very frequently.
 
 Have you actually benchmarked and determined that doing the sorting is too 
 slow, or are you just guessing? Guesses about performance are very often 
 wrong. The evidence from many UIs that show directory contents in sorted 
 order (Finder, NSOpenPanel, etc.) is that this isn’t noticeably slow.
 
 —Jens

___

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

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

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

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


[Q] Using GraphicsMagic++ in a thread method?

2011-07-13 Thread JongAm Park
Hello, all.

I decided to use GraphicsMagic++ in my Objective-C++/Cocoa project.

When I created Magick::Image variable statically in a method which is to be 
called by NSInvocationOperation, it receives EXC_BAD_ACCESS error.

However, if it is declared outside of the thread method, there is no such 
problem.

If there are anyone who uses GraphicsMagic++ in their Cocoa/Objective-C(++) 
project and are aware of this problem, can you share your idea with me?

Thank you.
JongAm Park___

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

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


[Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread JongAm Park
Hello, 

I wrote a method for NSArray.

- (NSArray *)objectsForKey:(id)key
{
NSMutableArray *objectsArray = [NSMutableArray arrayWithCapacity:10];

for( id item in self )
{
[objectsArray addObject:[item objectForKey:key]];
}

return [[objectsArray copy] autorelease];
}

What I'm curious is if it is OK to use fast enumeration to implement an NSArray 
method itself.
Because the mechanism for fast enumeration is already there, I basically think 
it will be OK.
However, wouldn't it better to rely on the most fundamental mechanism like 
objectAtIndex:?
I found someone's implementation here at 
http://svn.opengroupware.org/SOGo/inverse/trunk/SoObjects/SOGo/NSArray+Utilities.m
Approaching such a way looks reasonable to me, because it should work whatever 
underlying mechanism is supported by Objective-C.

Will there be any good/bad aspect in using fast enumeration in this case?

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: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread JongAm Park
Um... Thanks for your reply.

The last time I used that was about 5 or 6 years ago, and I wondered yesterday 
where it went away. :)
Thanks for pointing out that method.

BTW, my actual question was if it is meant to use fast enumeration in a 
collection class implementation.
Although I tried to add objectsForKey: to existing NSArray, it should be OK, 
because it is to rely on existing, fully functional one.
However, let's say we write a class like NSArray that supports fast 
enumeration, block based enumeration, numerator based enumeration and finally 
index based iteration.
The rationale behind enumerator pattern is to unify the way to access 
collection classes no matter what they actually look like.
So, enumerator pattern is actually written in index based iteration wrapped 
with enumerator pattern.
Similarly, I guessed fast enumeration was based on either index iteration or 
enumerator pattern.
Also, fast enumeration is a language feature. So, if Objective-C without fast 
enumerator is used, methods written with fast enumerator would not work.

So, my question was originally for that. :)
Anyway, it's not big deal now.

Thank you :)
JongAm Park

On Jun 30, 2011, at 12:02 PM, Dave DeLong wrote:

 Yeah, that should be fine, but it's unnecessary.
 
 You can just do:
 
 NSArray *objectsArray = [theArray valueForKey:key];
 
 And it'll do pretty much the same thing (except that it'll call -valueForKey: 
 on each item in the array, and not objectForKey:.  However, if the objects 
 are NSDictionaries, that's pretty much the same thing).
 
 Dave

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread JongAm Park
Wow.. great information!

Thank you very much for sharing your idea!
It definitely helped me!

JongAm Park

On Jun 30, 2011, at 2:41 PM, Quincey Morris wrote:

 
 On Jun 30, 2011, at 13:51, JongAm Park wrote:
 
 The rationale behind enumerator pattern is to unify the way to access 
 collection classes no matter what they actually look like.
 So, enumerator pattern is actually written in index based iteration wrapped 
 with enumerator pattern.
 Similarly, I guessed fast enumeration was based on either index iteration or 
 enumerator pattern.
 
 No, not necessarily, if by index iteration you mean 'objectAtIndex:'.
 
 NSArray has 2 primitive methods (count and objectAtIndex:) that a concrete 
 subclass must implement. It also conforms to NSFastEnumeration, so a concrete 
 subclass must also implement 'countByEnumeratingWithState:objects:count:'. 
 That's three primitive methods you know for sure are implemented in any 
 concrete subclass.
 
 There's no way of knowing (in general) whether these primitive 
 implementations make use of each other. I'm virtually certain, for example, 
 that in NSCFArray (the standard but private concrete subclass of NSArray), 
 countByEnumeratingWithState:objects:count: doesn't use objectAtIndex:, 
 because part of the point of fast enumeration is to eliminate per-object 
 method calls if possible. I'm also virtually certain that NSCFArray's 
 enumerator uses the fast enumeration method 
 countByEnumeratingWithState:objects:count: directly, rather than using 
 objectAtIndex:.
 
 The method you wrote is non-primitive. However, you know that all of the 
 primitive methods and protocols are implemented, so it's safe to use those 
 directly (as others already replied). It's also safe to use all of the 
 standard non-primitive methods, because the abstract NSArray class provides 
 default implementations of all of them, regardless of whether a subclass 
 overrides them for performance reasons.
 
 Also, fast enumeration is a language feature. So, if Objective-C without 
 fast enumerator is used, methods written with fast enumerator would not work.
 
 If an older Objective-C runtime is used, you'll get an invalid selector 
 exception for 'countByEnumeratingWithState:objects:count:', so yes it would 
 not work in that sense.
 
 

___

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

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


[Q] What options to use to display menu bar in a full screen mode

2010-10-24 Thread JongAm Park
Hello, 

For PDFView, I used enterFullScreenMode:WithOptions:
After looking up some sample codes, I found out that what they used in 
examples, 
• From A View to A Movie
• From A View to A Picture
are different from what is explained in the document.

Anyway, I tried many options include no option. 
Passing nil to the options parameter displays PDF document, while passing 
NSFullScreenModeWindowLevel
 option doesn't display anything. Passing NSFullScreenModeSetting with YES as a 
value displays the PDF document.
( This is the way From A View to ... sample is written. )

However, I would like to display the menu bar when a mouse is near the menu bar 
area or the top of the screen. Can anyone tell me how to do so? Are there some 
sample codes?

Thanks,

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-18 Thread JongAm Park

 On 10/17/2010 4:11 PM, Joar Wingfors wrote:

On 17 okt 2010, at 15.51, JongAm Park wrote:


Although I know that NSInvocation was added (from Leopard?), I didn't use it 
much.


NSInvocation predates Mac OS X...



Oh. right. I forgot that.


Is there any benefit in using it? My guess is that an NSInvocation instance is used 
repeatedly, but using the selector based method is not inconvenient for the 
most of cases.
Is there any other benefit in using the NSInvocation?


NSInvocation is a very flexible class, and can be used for a wide variety of 
tasks, but it is also (therefore) more cumbersome to setup and use for the 
simpler things that you mention. It is not often used, so if you don't know 
that you need it, you probably don't.


j o a r



Well, what I asked actually is about the design philosophy and what the 
intention of creating of that was. Your last statement can't fulfill my 
curiosity. :)


Thanks anyway to spare your time to answer my question.

--
--
子曰 不而不改 是謂過矣니라
공자께서 말씀하시길, 잘못을 하고도 고치지 않는 것, 그것을 잘못이라 한다.
  - 論語  衛 靈 公편

JongAm Park
jongamp...@sbcglobal.net
Visit my personal blog at http://jongampark.blogspot.com
Visit my technical blog at http://jongampark.wordpress.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: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-18 Thread JongAm Park

 On 10/18/2010 9:45 AM, Keary Suska wrote:

On Oct 18, 2010, at 9:00 AM, JongAm Park wrote:


Is there any benefit in using it? My guess is that an NSInvocation instance is used 
repeatedly, but using the selector based method is not inconvenient for the 
most of cases.
Is there any other benefit in using the NSInvocation?

NSInvocation is a very flexible class, and can be used for a wide variety of 
tasks, but it is also (therefore) more cumbersome to setup and use for the 
simpler things that you mention. It is not often used, so if you don't know 
that you need it, you probably don't.

Well, what I asked actually is about the design philosophy and what the 
intention of creating of that was. Your last statement can't fulfill my 
curiosity. :)

The common design use would be situations where the method you wish the timer 
to call requires additional data that would be passed as arguments. Essentially 
the point of using invocations is to permit the timer to call any method 
whatsoever, regardless of the method signature.

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



Thank you. So, it is about decoupling..


--
--
子曰 不而不改 是謂過矣니라
공자께서 말씀하시길, 잘못을 하고도 고치지 않는 것, 그것을 잘못이라 한다.
  - 論語  衛 靈 公편

JongAm Park
jongamp...@sbcglobal.net
Visit my personal blog at http://jongampark.blogspot.com
Visit my technical blog at http://jongampark.wordpress.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


[Q] How to handle mouseDown when PDFView is in full screen mode?

2010-10-10 Thread JongAm Park
Hello,

I would like to implement on-screen buttons like the ones Preview presents in 
its full screen mode.

I used this to enter full screen mode.

enterFullScreenMode: withOptions:

When it becomes full screen mode, I pressed mouse button, but it is not 
processed.

@implementation PDFView ( FullScreenExt )

- (void)mouseDown:(NSEvent *)theEvent
{

NSLog( @mouseDown handling...);
if( [self isInFullScreenMode] ) 
{

NSLog( @Is in full screen mode...);
[self exitFullScreenModeWithOptions:[NSDictionary 
dictionaryWithObject:[NSNumber numberWithInt:NSNormalWindowLevel] 
forKey:NSFullScreenModeWindowLevel]];
}
else
NSLog( @Is not in full screen mode...);

[super mouseDown:theEvent];
}
@end

Is there a way to handle mouseDown in fullscreen mode?

are there also some sample codes for on-screen buttons of Preview?

Thanks,

___

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

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


[Q] Is this a bug in MPMoviePlayerController? Then how to work around?

2010-07-13 Thread JongAm Park

 Hello, all.

My acquaintance told me that he found a strange problem while using 
MPMoviePlayerController.
According to him, from second play of a movie file located on a server, 
a server said that there was a cached movie clip on a client and guided 
to use the locally cached one, but on the client side, i.e. 
MPMoviePlayerController, it said that the server information was wrong 
and rejected it.


Is this a bug? How to work around it, then?

Thank you.

--

JongAm Park
Visit my technical blog at http://jongampark.wordpress.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


Proposal for category in plugin environment

2010-04-04 Thread JongAm Park
Hello,

I'm not not sure if it should be only implemented on language side in gcc or 
cocoa also need to handle it, but I posted a proposal to my blog about category 
under plugin environment. ( 
http://jongampark.wordpress.com/2010/04/04/proposal-for-category-in-plugin-environment/
 )

Are Apple people thinking about the same or similar mechanism?
If not, what do you think about my proposal. ( I don't mean that I will 
implement it, but... just suggesting.. )

Thank you.
JongAm Park


___

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

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


[Q] copy operation and authorization

2009-11-12 Thread JongAm Park

Hello,

I'm trying to copy a file from a desktop to a /Library/Application 
Supports/../Plugins directory.
Because the directory requires to obtain system administrator's 
privilege I should be authorized.


so, I wrote codes like this.

- (void)awakeFromNib
{
   [self authorize];
}

- (void) applicationWillTerminate:(NSNotification *)aNotification
{
   OSStatus myStatus;
   NSLog( @applicationWillTerminate);
  
   myStatus = AuthorizationFree( mAuthorizationRef, 
kAuthorizationFlagDestroyRights );
  
}


-(IBAction)copyWithNSFileManager:(id)sender
{
   NSString *PlugInPath = [NSString 
stringWithString:@/Library/Application Support/Final Cut Pro System 
Support/Plugins/test3.valm];
  
   NSString *sourceFile = [NSString 
stringWithFormat:@%@/Desktop/test3.valm, NSHomeDirectory()];
  
   BOOL isSuccessful;
   isSuccessful = [[NSFileManager defaultManager] copyPath:sourceFile 
toPath:PlugInPath handler:nil];

}

-(IBAction)copyWithNSWorkspace:(id)sender
{
   NSString *PluginPath = [NSString 
stringWithString:@/Library/Application Support/Final Cut Pro System 
Support/Plugins];
   NSString *sourceDirectory = [NSString 
stringWithFormat:@%@/Desktop, NSHomeDirectory()];

   NSArray *files = [NSArray arrayWithObject:@test3.valm];
  
   NSInteger tag;
   BOOL isSuccessful = [[NSWorkspace sharedWorkspace] 
performFileOperation:NSWorkspaceCopyOperation

source:sourceDirectory
   destination:PluginPath
 files:files
   tag:tag];
  
   NSLog(@isSuccessful = %@, isSuccessful? @YES:@NO );

}

- (void)authorize
{   
   OSStatus myStatus;
   myStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, 
kAuthorizationFlagDefaults, mAuthorizationRef);
  
   AuthorizationItem myItems[1];
  
   myItems[0].name = com.greenleaf.FileCopyTest.myRight1;

   myItems[0].valueLength = 0;
   myItems[0].value = NULL;
   myItems[0].flags = 0;
  
  
   AuthorizationRights myRights;

   myRights.count = sizeof( myItems ) / sizeof( myItems[0] );
   myRights.items = myItems;
  
   AuthorizationFlags myFlags = kAuthorizationFlagDefaults | 
kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
  
   myStatus = AuthorizationCopyRights(mAuthorizationRef, myRights, 
kAuthorizationEmptyEnvironment, myFlags, NULL);

   if( myStatus == errAuthorizationSuccess )
   {
   NSLog(@Successful in authorizing..  );
   }
  
}


Although it returns errAuthorizationSuccess in authorize method, 
when a file is to be copied, it returns fail state and the file is not 
copied.

Can anyone help me to figure out why?

Should I use AuthorizationExecuteWithPrivileges() and invoke an external 
command like cp?
I think it should be possible to copy files with proper privilege with 
Cocoa calls.


Thank you.
JongAm Pawrk
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] copy operation and authorization

2009-11-12 Thread JongAm Park

I'm sorry, but the scenario doesn't apply to mine.

Thank you.

Sherm Pendley wrote:

On Thu, Nov 12, 2009 at 12:44 PM, JongAm Park
joshua_park2006-applel...@yahoo.com wrote:
  

NSString *sourceFile = [NSString
stringWithFormat:@%@/Desktop/test3.valm, NSHomeDirectory()];



Have you tried this?

[[NSWorkspace sharedWorkspace] openFile:sourceFile];

Many apps register their plugin extensions as document types, so you
can simply open them and let the app handle the installation for you.
The screen saver app, for example, does this with .saver plugins.

sherm--

  


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] copy operation and authorization

2009-11-12 Thread JongAm Park

Nick Zitzmann wrote:

On Nov 12, 2009, at 10:44 AM, JongAm Park wrote:

  

  NSString *PlugInPath = [NSString stringWithString:@/Library/Application 
Support/Final Cut Pro System Support/Plugins/test3.valm];



Apologies for being a little pedantic here, but calling +stringWithString: is 
almost never necessary and in this case is just cluttering the autorelease 
pool/garbage collector. You can set NSString pointers to NSString constants 
with no problems.

  
It's intermediate code. I have good reason to use stringWithString or 
stringWithFormat. It was revised to hide something from original code, 
but I didn't want to change much to post the code to the mailing list. 
So, I used remainder from the original code.




Although it returns errAuthorizationSuccess in authorize method, when a file is to be 
copied, it returns fail state and the file is not copied.
Can anyone help me to figure out why?



You cannot escalate the privileges of a running task on Mac OS X. So if a 
running task does not have root privileges, then it never will.

  


Then how?

Should I use AuthorizationExecuteWithPrivileges() and invoke an external command like 
cp?
I think it should be possible to copy files with proper privilege with Cocoa 
calls.



Yes. Apple actually wants you to use AEWP() to run your own helper tool for 
security reasons, though it's highly unlikely you'll run into problems by doing 
direct invocations. Check the list archives for details.

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


  


___

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

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

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

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


Re: [Q] copy operation and authorization

2009-11-12 Thread JongAm Park

Hi,

I already took a look at it. It is to use factored approach.

Thank you.

Volker in Lists wrote:

Hi,

I am using this and I guess it is the recommended way of doing. Works 
well: 
http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/index.html 



Volker

Am 12.11.2009 um 18:44 schrieb JongAm Park:


Hello,

I'm trying to copy a file from a desktop to a /Library/Application 
Supports/../Plugins directory.
Because the directory requires to obtain system administrator's 
privilege I should be authorized.


so, I wrote codes like this.

- (void)awakeFromNib
{
  [self authorize];
}

- (void) applicationWillTerminate:(NSNotification *)aNotification
{
  OSStatus myStatus;
  NSLog( @applicationWillTerminate);
myStatus = AuthorizationFree( mAuthorizationRef, 
kAuthorizationFlagDestroyRights );

 }

-(IBAction)copyWithNSFileManager:(id)sender
{
  NSString *PlugInPath = [NSString 
stringWithString:@/Library/Application Support/Final Cut Pro System 
Support/Plugins/test3.valm];
NSString *sourceFile = [NSString 
stringWithFormat:@%@/Desktop/test3.valm, NSHomeDirectory()];

BOOL isSuccessful;
  isSuccessful = [[NSFileManager defaultManager] copyPath:sourceFile 
toPath:PlugInPath handler:nil];

}

-(IBAction)copyWithNSWorkspace:(id)sender
{
  NSString *PluginPath = [NSString 
stringWithString:@/Library/Application Support/Final Cut Pro System 
Support/Plugins];
  NSString *sourceDirectory = [NSString 
stringWithFormat:@%@/Desktop, NSHomeDirectory()];

  NSArray *files = [NSArray arrayWithObject:@test3.valm];
NSInteger tag;
  BOOL isSuccessful = [[NSWorkspace sharedWorkspace] 
performFileOperation:NSWorkspaceCopyOperation

   source:sourceDirectory
  destination:PluginPath
files:files
  tag:tag];
NSLog(@isSuccessful = %@, isSuccessful? @YES:@NO );
}

- (void)authorize
{  OSStatus myStatus;
  myStatus = AuthorizationCreate(NULL, 
kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, 
mAuthorizationRef);

AuthorizationItem myItems[1];
myItems[0].name = com.greenleaf.FileCopyTest.myRight1;
  myItems[0].valueLength = 0;
  myItems[0].value = NULL;
  myItems[0].flags = 0;
  AuthorizationRights myRights;
  myRights.count = sizeof( myItems ) / sizeof( myItems[0] );
  myRights.items = myItems;
AuthorizationFlags myFlags = kAuthorizationFlagDefaults | 
kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
myStatus = AuthorizationCopyRights(mAuthorizationRef, myRights, 
kAuthorizationEmptyEnvironment, myFlags, NULL);

  if( myStatus == errAuthorizationSuccess )
  {
  NSLog(@Successful in authorizing..  );
  }
 }

Although it returns errAuthorizationSuccess in authorize method, 
when a file is to be copied, it returns fail state and the file is 
not copied.

Can anyone help me to figure out why?

Should I use AuthorizationExecuteWithPrivileges() and invoke an 
external command like cp?
I think it should be possible to copy files with proper privilege 
with Cocoa calls.


Thank you.
JongAm Pawrk
___

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

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

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



This email sent to volker_li...@ecoobs.de





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] copy operation and authorization

2009-11-12 Thread JongAm Park

Thank you. I will try AuthorizationExecuteWithPrivileges().

JongAm Park

Nick Zitzmann wrote:

On Nov 12, 2009, at 11:34 AM, JongAm Park wrote:

  

You cannot escalate the privileges of a running task on Mac OS X. So if a 
running task does not have root privileges, then it never will.
  

Then how?



That's what AEWP() is for. Once you've pre-authorized, you pass your 
authorization ref to AEWP(), and it will run the program you want it to run 
with root privileges. But you can never elevate the privileges of an 
unprivileged app, not even for one call.

Note that AEWP() does not run tasks _as_ root (and yes, there's a difference). 
If you need that, then you need to invoke AEWP() with a wrapper that sets the 
uid. Search the archives for details.

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


  


___

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

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

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

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


Re: [Q] copy operation and authorization

2009-11-12 Thread JongAm Park

Thank you all.

It works now.
What is interesting was that it didn't require to use PreAuthoriazation 
flag when invoking cp.
I think the Factored Application case in the document was about an 
external program which are not Unix commands but something else.


Thank you again.
JongAm Park
___

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

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


[Q] How to populate custom button of QuickTime media control?

2009-10-12 Thread JongAm Park

Hello,

I would like to add number of audio tracks menu item under custom  
button on QuickTime media control.
What I mean by saying custom button is the triangle button which is  
at the right most side if you open a QuickTime movie  using Web browser.


I'm currently using QTKit and found some old sample code,  
QTCustomButton.c/h. But I don't know how to know if the custom button  
is clicked.
Also, I would like to know if there is a way to do it with Cocoa.  
QTKit or MovieController don't seem to support the custom button  
directly.


Also, QuickTime X doesn't seem to have the custom button.
if it doesn't have one, is there any other alternative way?

Thank you.
JongAm Park

___

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

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


[Q] CFStringGetCStringPtr( ..., kCFStringEncodingUTF8)

2009-06-23 Thread JongAm Park

Hello.

I didn't find any CoreFoundation mailing list, so I post my question 
about CFStringEtCStringPtr() here in Cocoa mailing list.


My problem is that CFStringGetCStringPtr( ..., kCFStringEncodingUTF8) 
doesn't convert a string passed through its first parameter and returns 
0 on English system.
However, on Japanese system, it returns a pointer to converted string 
correctly.


The first parameter points to a string which is a path in English. There 
is no Japanese characters.
Because the 2nd parameter is one of 8 bit encoding, it didn't work 
before on Japanese system, where it was called like :


CFStringGetCStringPtr( ...,  CFStringGetSystemEncoding() )

The encoding method on a Japanese system is

kCFStringEncodingMacJapanese 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacJapanese

So, I forced the 2nd parameter to kCFStringEncodingUTF8 and thought that 
it would work on English system also.

However, on an English system, of which system encoding is

kCFStringEncodingMacRoman 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacRoman


It doesn't convert its 1st parameter and returned 0.
So, I had to call another CFStringGetCStringPtr() with 
CFStringGetSystemEncoding() as its 2nd parameter.


Is it a bug? Usually English encoding is the most trouble-free encoding 
method which can be converted to UTF8. So, I expected that it would work 
with kCFStringEncodingUTF8.

Or.. can anyone tell me why it doesn't work?

My whole source code which contains this fix is like

   char *fullPath;
   char outPath[512];;
  
   Boolean conversionResult;

   CFStringEncoding encodingMethod;
   // This is for ensuring safer operation. When 
CFStringGetCStringPtr() fails,

   // it tries CFStringGetCString().
  
   encodingMethod = CFStringGetSystemEncoding();
  
   // 1st try for English system

   fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
   if( fullPath == NULL )
   {
   // 2nd try for Japanese system
   encodingMethod = kCFStringEncodingUTF8;
   fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
   }
  
   // for safer operation.

   if( fullPath == NULL )
   {
   CFIndex length = CFStringGetLength(mstr);
   fullPath = (char *)malloc( length + 1 );
   conversionResult = CFStringGetCString(mstr, fullPath, length, 
kCFStringEncodingUTF8 );
  
   strcpy( outPath, fullPath );
  
   free( fullPath );

   }
   else
   strcpy( outPath, fullPath );

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: [Q] CFStringGetCStringPtr( ..., kCFStringEncodingUTF8)

2009-06-23 Thread JongAm Park

Thanks for your reply.

However, even with CFStringGetCString() with the 2nd parameter 
kCFStringEncodingUTF8 doesn't work correctly.


Laurent Cerveau wrote:
According to the doc it is completely OK for the CFStringPtr to 
return NULL. 


  CFStringGetCStringPtr()
  CFStringGetCharactersPtr()

These functions are provided for optimization only. They will either 
return the desired
pointer quickly, in constant time, or they return NULL. They might 
choose to return NULL
for many reasons; for instance it's possible that for users running in 
different
languages these sometimes return NULL; or in a future OS release the 
first two might
switch to always returning NULL. Never observing NULL returns in your 
usages of these
functions does not mean they won't ever return NULL. (But note the 
CFStringGetCharactersPtr()

exception mentioned further below.)

What you do with falling back to CFStringGetCString is right

laurent

On Jun 23, 2009, at 7:26 PM, JongAm Park wrote:


Hello.

I didn't find any CoreFoundation mailing list, so I post my question 
about CFStringEtCStringPtr() here in Cocoa mailing list.


My problem is that CFStringGetCStringPtr( ..., kCFStringEncodingUTF8) 
doesn't convert a string passed through its first parameter and 
returns 0 on English system.
However, on Japanese system, it returns a pointer to converted string 
correctly.


The first parameter points to a string which is a path in English. 
There is no Japanese characters.
Because the 2nd parameter is one of 8 bit encoding, it didn't work 
before on Japanese system, where it was called like :


CFStringGetCStringPtr( ...,  CFStringGetSystemEncoding() )

The encoding method on a Japanese system is

kCFStringEncodingMacJapanese 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacJapanese


So, I forced the 2nd parameter to kCFStringEncodingUTF8 and thought 
that it would work on English system also.

However, on an English system, of which system encoding is

kCFStringEncodingMacRoman 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacRoman



It doesn't convert its 1st parameter and returned 0.
So, I had to call another CFStringGetCStringPtr() with 
CFStringGetSystemEncoding() as its 2nd parameter.


Is it a bug? Usually English encoding is the most trouble-free 
encoding method which can be converted to UTF8. So, I expected that 
it would work with kCFStringEncodingUTF8.

Or.. can anyone tell me why it doesn't work?

My whole source code which contains this fix is like

  char *fullPath;
  char outPath[512];;
Boolean conversionResult;
  CFStringEncoding encodingMethod;
  // This is for ensuring safer operation. When 
CFStringGetCStringPtr() fails,

  // it tries CFStringGetCString().
encodingMethod = CFStringGetSystemEncoding();
// 1st try for English system
  fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
  if( fullPath == NULL )
  {
  // 2nd try for Japanese system
  encodingMethod = kCFStringEncodingUTF8;
  fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
  }
// for safer operation.
  if( fullPath == NULL )
  {
  CFIndex length = CFStringGetLength(mstr);
  fullPath = (char *)malloc( length + 1 );
  conversionResult = CFStringGetCString(mstr, fullPath, length, 
kCFStringEncodingUTF8 );

strcpy( outPath, fullPath );
free( fullPath );
  }
  else
  strcpy( outPath, fullPath );

Thank you.

___

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


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

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

This email sent to lcerv...@me.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: [Q] CFStringGetCStringPtr( ..., kCFStringEncodingUTF8)

2009-06-23 Thread JongAm Park

Oh.. one more thing...

I think you didn't catch what I wanted to say.
It will be OK to return NULL if it can't convert a given string to a 
string in a given text encoding method.
( But, yes.. Apple's document mentioned that its behaviour can be 
changed, so don't rely on it. )


What I wanted to say was Why does it return a meaningful address when 
the system encoding is Japanese while it doesn't when the system 
encoding is English?.

(When UTF8 is used for a target. )
Can't MacRoman be converted to UTF8 while MacJapanese can be?
I assumed that MacRoman code page is almost identical to UTF8, because 
UTF8 is compatible with ASCII and MacRoman is extended form for ASCII.


Anyway.. I will go around the problem...

Thank you anyway.

Laurent Cerveau wrote:
According to the doc it is completely OK for the CFStringPtr to 
return NULL. 


  CFStringGetCStringPtr()
  CFStringGetCharactersPtr()

These functions are provided for optimization only. They will either 
return the desired
pointer quickly, in constant time, or they return NULL. They might 
choose to return NULL
for many reasons; for instance it's possible that for users running in 
different
languages these sometimes return NULL; or in a future OS release the 
first two might
switch to always returning NULL. Never observing NULL returns in your 
usages of these
functions does not mean they won't ever return NULL. (But note the 
CFStringGetCharactersPtr()

exception mentioned further below.)

What you do with falling back to CFStringGetCString is right

laurent

On Jun 23, 2009, at 7:26 PM, JongAm Park wrote:


Hello.

I didn't find any CoreFoundation mailing list, so I post my question 
about CFStringEtCStringPtr() here in Cocoa mailing list.


My problem is that CFStringGetCStringPtr( ..., kCFStringEncodingUTF8) 
doesn't convert a string passed through its first parameter and 
returns 0 on English system.
However, on Japanese system, it returns a pointer to converted string 
correctly.


The first parameter points to a string which is a path in English. 
There is no Japanese characters.
Because the 2nd parameter is one of 8 bit encoding, it didn't work 
before on Japanese system, where it was called like :


CFStringGetCStringPtr( ...,  CFStringGetSystemEncoding() )

The encoding method on a Japanese system is

kCFStringEncodingMacJapanese 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacJapanese


So, I forced the 2nd parameter to kCFStringEncodingUTF8 and thought 
that it would work on English system also.

However, on an English system, of which system encoding is

kCFStringEncodingMacRoman 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacRoman



It doesn't convert its 1st parameter and returned 0.
So, I had to call another CFStringGetCStringPtr() with 
CFStringGetSystemEncoding() as its 2nd parameter.


Is it a bug? Usually English encoding is the most trouble-free 
encoding method which can be converted to UTF8. So, I expected that 
it would work with kCFStringEncodingUTF8.

Or.. can anyone tell me why it doesn't work?

My whole source code which contains this fix is like

  char *fullPath;
  char outPath[512];;
Boolean conversionResult;
  CFStringEncoding encodingMethod;
  // This is for ensuring safer operation. When 
CFStringGetCStringPtr() fails,

  // it tries CFStringGetCString().
encodingMethod = CFStringGetSystemEncoding();
// 1st try for English system
  fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
  if( fullPath == NULL )
  {
  // 2nd try for Japanese system
  encodingMethod = kCFStringEncodingUTF8;
  fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
  }
// for safer operation.
  if( fullPath == NULL )
  {
  CFIndex length = CFStringGetLength(mstr);
  fullPath = (char *)malloc( length + 1 );
  conversionResult = CFStringGetCString(mstr, fullPath, length, 
kCFStringEncodingUTF8 );

strcpy( outPath, fullPath );
free( fullPath );
  }
  else
  strcpy( outPath, fullPath );

Thank you.

___

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


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

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

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

Re: [Q] CFStringGetCStringPtr( ..., kCFStringEncodingUTF8)

2009-06-23 Thread JongAm Park

Hello, Aki

Oh.. I see. when it can do efficiently is the key!

Thank you very much for pointing that out.

Aki Inoue wrote:

JongAm,

The keyword here is that the function returns non-NULL when it can do 
so efficiently.
It all depends on a particular CFString instance's internal 
representation and the encoding being passed.


The best encoding for a particular string is 
CFStringGetFastestEncoding().


Aki

On Jun 23, 2009, at 12:13 PM, JongAm Park wrote:


Oh.. one more thing...

I think you didn't catch what I wanted to say.
It will be OK to return NULL if it can't convert a given string to a 
string in a given text encoding method.
( But, yes.. Apple's document mentioned that its behaviour can be 
changed, so don't rely on it. )


What I wanted to say was Why does it return a meaningful address 
when the system encoding is Japanese while it doesn't when the system 
encoding is English?.

(When UTF8 is used for a target. )
Can't MacRoman be converted to UTF8 while MacJapanese can be?
I assumed that MacRoman code page is almost identical to UTF8, 
because UTF8 is compatible with ASCII and MacRoman is extended form 
for ASCII.


Anyway.. I will go around the problem...

Thank you anyway.

Laurent Cerveau wrote:
According to the doc it is completely OK for the CFStringPtr to 
return NULL.

 CFStringGetCStringPtr()
 CFStringGetCharactersPtr()

These functions are provided for optimization only. They will either 
return the desired
pointer quickly, in constant time, or they return NULL. They might 
choose to return NULL
for many reasons; for instance it's possible that for users running 
in different
languages these sometimes return NULL; or in a future OS release the 
first two might
switch to always returning NULL. Never observing NULL returns in 
your usages of these
functions does not mean they won't ever return NULL. (But note the 
CFStringGetCharactersPtr()

exception mentioned further below.)

What you do with falling back to CFStringGetCString is right

laurent

On Jun 23, 2009, at 7:26 PM, JongAm Park wrote:


Hello.

I didn't find any CoreFoundation mailing list, so I post my 
question about CFStringEtCStringPtr() here in Cocoa mailing list.


My problem is that CFStringGetCStringPtr( ..., 
kCFStringEncodingUTF8) doesn't convert a string passed through its 
first parameter and returns 0 on English system.
However, on Japanese system, it returns a pointer to converted 
string correctly.


The first parameter points to a string which is a path in English. 
There is no Japanese characters.
Because the 2nd parameter is one of 8 bit encoding, it didn't work 
before on Japanese system, where it was called like :


CFStringGetCStringPtr( ...,  CFStringGetSystemEncoding() )

The encoding method on a Japanese system is

kCFStringEncodingMacJapanese 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacJapanese 



So, I forced the 2nd parameter to kCFStringEncodingUTF8 and thought 
that it would work on English system also.

However, on an English system, of which system encoding is

kCFStringEncodingMacRoman 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFStringEncodingMacRoman 




It doesn't convert its 1st parameter and returned 0.
So, I had to call another CFStringGetCStringPtr() with 
CFStringGetSystemEncoding() as its 2nd parameter.


Is it a bug? Usually English encoding is the most trouble-free 
encoding method which can be converted to UTF8. So, I expected that 
it would work with kCFStringEncodingUTF8.

Or.. can anyone tell me why it doesn't work?

My whole source code which contains this fix is like

 char *fullPath;
 char outPath[512];;
   Boolean conversionResult;
 CFStringEncoding encodingMethod;
 // This is for ensuring safer operation. When 
CFStringGetCStringPtr() fails,

 // it tries CFStringGetCString().
   encodingMethod = CFStringGetSystemEncoding();
   // 1st try for English system
 fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
 if( fullPath == NULL )
 {
 // 2nd try for Japanese system
 encodingMethod = kCFStringEncodingUTF8;
 fullPath = (char*)CFStringGetCStringPtr(mstr, encodingMethod);
 }
   // for safer operation.
 if( fullPath == NULL )
 {
 CFIndex length = CFStringGetLength(mstr);
 fullPath = (char *)malloc( length + 1 );
 conversionResult = CFStringGetCString(mstr, fullPath, length, 
kCFStringEncodingUTF8 );

   strcpy( outPath, fullPath );
   free( fullPath );
 }
 else
 strcpy( outPath, fullPath );

Thank you.

___

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


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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com

[Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread JongAm Park

Hello, all

I'm just curious about the naming convention for Core Graphics and  
Foundation.
For example, NSMakeRect and CGRectMake are similar but different about  
where the Rect is in its method name.

What is even worse is NSPointInRect and CGRectContainsPoint.
So, if a person is used to the Foundation convention, it is not  
intuitive to find proper method in Core Graphics.


Is there any reason they are named like that?

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: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread JongAm Park
Yeah.. I agree with you in the point of view. But if we take a look at  
it from different angle, NSMakeRect is better, because it is more  
understandable due to its resemblance to spoken English.


NSPointInRect vs. CGRectContainsPoint is more subtle. Is it Rect- 
related method or Point-related method?


Whatever they are, it would be great if there is consistency or if the  
document mentions those in related functions or methods. part.



On Mar 15, 2009, at 12:04 AM, Andy Lee wrote:

I noticed the differences too, and my guess was that it makes it  
easier to find functions related to CGRects, by searching the API  
for terms that contain CGRect.  I actually prefer it this way.


--Andy

On Mar 15, 2009, at 2:43 AM, JongAm Park wrote:


Hello, all

I'm just curious about the naming convention for Core Graphics and  
Foundation.
For example, NSMakeRect and CGRectMake are similar but different  
about where the Rect is in its method name.

What is even worse is NSPointInRect and CGRectContainsPoint.
So, if a person is used to the Foundation convention, it is not  
intuitive to find proper method in Core Graphics.


Is there any reason they are named like that?

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: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread JongAm Park

Thank you for your reply.

So, I understood that the naming convention was changing.

And.. yes.. I know I should accept what Apple makes, but I just was  
just curious.


Thank you.

On Mar 15, 2009, at 1:21 AM, Ken Thomases wrote:


On Mar 15, 2009, at 2:39 AM, JongAm Park wrote:


On Mar 15, 2009, at 12:04 AM, Andy Lee wrote:


On Mar 15, 2009, at 2:43 AM, JongAm Park wrote:

I'm just curious about the naming convention for Core Graphics  
and Foundation.
For example, NSMakeRect and CGRectMake are similar but different  
about where the Rect is in its method name.

What is even worse is NSPointInRect and CGRectContainsPoint.
So, if a person is used to the Foundation convention, it is not  
intuitive to find proper method in Core Graphics.


Is there any reason they are named like that?


I noticed the differences too, and my guess was that it makes it  
easier to find functions related to CGRects, by searching the API  
for terms that contain CGRect.  I actually prefer it this way.


Whatever they are, it would be great if there is consistency or if  
the document mentions those in related functions or methods. part.


I think the division isn't Core Graphics vs. Foundation (or, more  
generally, one framework vs. another).  I think it's between legacy  
and new APIs.  It seems fairly clear to me that Apple has adopted a  
convention that new APIs should be centered around a type, and that  
names within such an API are to start with the name of the type.


However, large portions of Cocoa predate the adoption of this  
convention, coming as they do from NeXTStep/OpenStep.  Those parts  
aren't going to be just gratuitously renamed to conform to the new  
convention.  That would be massively disruptive.


Unfortunately, there's just no way to generalize one way to think  
about all things.  You have to accept things as they are and cope  
with the fact that there isn't just one rule.


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: [Q] efficient or good model for send/receive with streams scheduled in runloop?

2009-01-29 Thread JongAm Park

Thank you for your comment.

Shawn Erickson wrote:

A lock? As in NSLock, etc.? Why do you think you need a lock here
given it isn't multi-thread and the fact that IO appears to be driven
by a runloop which will serialize access for you.

  
At first, I was not sure if the Run-Loop was implemented using thread or 
signal.
So, I tried locking, but it turned out that it was not multithreaded 
from app programmer's point of view.

It seems to be implemented using signal, so using lock was not helpful.

You gave us very little actionable information, we can only guess at
your implementation. You will have to provide more details and ideally
sample code.

-Shaw
Yeah... I know. I also often say so if someone asks me and information 
he gives me is not sufficient.
However, I also understand that sometimes there is no way to provide 
more information.

So, by discussing I can figure out what he really wants.
By the way I asked somewhat general design using a delegate message 
triggered by a run-loop.

You see such kind of model from many books on network programming.

Anyway, thank you for your comment again.

JongAm Park
___

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

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


[Q] efficient or good model for send/receive with streams scheduled in runloop?

2009-01-27 Thread JongAm Park

Hello,

I would like to write a network program which is scheduled in runloop.

According to Stream Programming Guide for Cocoa, there are two 
scheduling, one is polling, and the other is run-loop scheduling.
Because I don't want it to block things, the run-loop scheduling would 
be a nice an convenient way to go.
( Probably using thread with polling or signaling is more flexible. 
Actually it looks like that the run-loop scheduling is implemented with 
thread and signaling. )


With run-loop scheduling, it is very handy to send data to others only 
when there is space in a buffer, and receive only when there are data in 
a buffer. ( NSStreamEventHasSpaceAvailable and 
NSStreamEventHasBytesAvailable )


However, I have difficulty in making it to send data and receive ack 
from a server.
Sometimes, it receives some meaningful data about changed information 
from a server, if a client send a request to change some data.

But sometimes it also receives ack.
So, I would like to make it do next job after receiving an ack.
So, I embraced a send routine with a lock. But the whole client process 
is in dead-lock status, because it is not multi-threaded.

( a receive routine already locked. )

Under this situation, is there a good network programming model or 
pattern? How should I solve this issue?


Thank you.
JongAm Park

___

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

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


[Q] disposing of a stream object when NSStreamEventEndEncounterered is received?

2009-01-27 Thread JongAm Park

Hello.

According to Stream Programming Guide for Cocoa : Writing to Output 
Streams, it says :


When an NSOutputStream object concludes writing data to an output 
stream, it sends the delegate a |NSStreamEventEndEncountered| event in a 
|stream:handleEvent:| message. At this point the delegate should dispose 
of the stream object by doing the mirror-opposite of what it did to 
prepare the object. In other words, it should first close the stream 
object, remove it from the run loop, and finally release it.


However, I have a system with which a server send back a notification 
when a client registers that it want to get some notification to the 
server. For the system, a stream or a channel which requested the 
notification should be remained open to get notifications from the 
server afterwards.


Under this scenario, can't I use the Run-Loop based meachanism? is there 
any way to keep the stream open?


Thanks,
JongAm Park

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] How to let the pasteboard know a file type?

2008-12-19 Thread JongAm Park
Hello. I found out that NSCreateFilenamePboardType() would help. So, I 
tried it like :


My code example is :

In awakeFromNib


NSString 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSString.html
 *quicktimeFileNamesPboardType = NSCreateFilenamePboardType(@mov);

[myNSTableView registerForDraggedTypes:[NSArray 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html
 arryWithObject:quickTimeFileNamesPboardType]];


In -tableView:writeRowsWithIndexes:toPasteboard:


NSString 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSString.html
 *quicktimeFileNamesPboardType = NSCreateFilenamePboardType(@mov);

anIndex = [selectedRowsIndexSet firstIndex];
while( anIndex != NSNotFound )
{
   fileName = [NSString 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSString.html
 stringWithFormat:@%@/%...@.mov, configPath, [[dataArray objectAtIndex:anIndex] 
name]];
   [fileNamesArray addObject:fileName];

   // Next index
   anIndex = [selectedRowIndexSet indexGreaterThanIndex:anIndex];
}

[pboard declareTypes:[NSArray 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html
 arrayWithObjects:quicktimeFilenamesPboardType, nil] owner:nil];
isSuccessful = [pboard setPropertyList:fileNamesArray 
forType:quicktimeFilenamesPboardType];

...


When I check what information is exported from my program with the Drag 
Peeker X, it shows :



Item Reference: 19884c10
  Item Bounds (tlbr): { 86, 1, 104, 191 }
  Number of flavors: 0


Strangely, it doesn't have any flavor of data.

Is there anything wrong how I use the NSCreateNSFilenamePboardType? How 
to use it properly?


Thank you in advance.

P.S. By the way, is it normal to put 'furl' and 'hfs' flavor when 
NSFilenamesPboardType is used? Because an array of file names are added 
to the pasteboard, I thought that only file name strings were added. But 
it turned out no-so-true.


JongAm Park wrote:

Hi,

Thanks to a utility program, called DragPeeker X, I found out some 
clue why the FCP treated dragged file as a file with unknown type.


When I dragged the same file from the Finder to the FCP, it shows :

Number of Items: 1
1. Item Reference: 19884c10
   Item Bounds (tlbr): { 86, 1, 104, 191 }
   Number of flavors: 2
   1.Flavor Type: 'furl'
   Flavor Flags: 0
   Length: 54
   Data:
   66 69 6C 65 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 
file://localhost
   2F 56 6F 6C 75 6D 65 73 2F 31 37 32 2E 31 36 2E 
/Volumes/172.16.
   32 34 36 2E 31 34 36 2F 4D 4F 56 2F 30 30 30 33 
246.146/MOV/0003
   59 42 2E 6D 6F 76   
YB.mov2.Flavor Type: 'hfs '

   Flavor Flags: 300
   Length: 80
   Data:
   4D 6F 6F 56 3F 3F 3F 3F 00 00 FF 98 00 00 00 13 
MooV
   0A 30 30 30 33 59 42 2E 6D 6F 76 DC 00 00 00 00 
.0003YB.mov.
   FF FF FF FF 00 00 00 00 00 25 F0 A0 A0 31 60 34 
.%...1`4
   91 F6 C0 A0 BF FF DA 80 84 04 20 42 91 F6 6B 44 
.. B..kD
   91 F6 C0 A0 00 86 B4 00 17 BB 17 FC BF FF DA C4 



But if I drag one from my application to the FCP, it shows :

Number of Items: 1
1. Item Reference: c0c0a
   Item Bounds (tlbr): { 219, 244, 219, 244 }
   Number of flavors: 2
   1.Flavor Type: 'furl'
   Flavor Flags: 0
   Length: 54
   Data:
   66 69 6C 65 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 
file://localhost
   2F 56 6F 6C 75 6D 65 73 2F 31 37 32 2E 31 36 2E 
/Volumes/172.16.
   32 34 36 2E 31 34 36 2F 4D 4F 56 2F 30 30 30 33 
246.146/MOV/0003
   59 42 2E 6D 6F 76   
YB.mov2.Flavor Type: 'hfs '

   Flavor Flags: 0
   Length: 80
   Data:
   00 00 00 00 00 00 00 00 00 00 FF 98 00 00 00 13 

   0A 30 30 30 33 59 42 2E 6D 6F 76 FC 00 25 DB A0 
.0003YB.mov..%..
   00 00 00 06 00 18 80 00 00 00 00 60 00 25 8E B0 
...`.%..
   90 10 7A 44 BF FF DA 70 44 04 20 42 90 10 7D EC 
..zD...pD. B..}.
   00 00 00 02 BF FF DA 90 00 00 00 20 BF FF DC F4 
... 



( I also tried NSURLPboardType and NSFileContentsPboardType. But they 
didn't make information like above appear. )

The PboardType I used was NSFilenamesPboardType.

The major difference between those are in the 2nd flavor type 'hfs'.
Their flavor flags are different: one is 300, while the other is 0.

What actually matters, I think, is the data of the 2nd flavor.
The one using the Finder starts with MooV, which says that the 
dragged item is a QuickTime movie, while the one from my application 
doesn't contain

[Fwd: Re: [Q] How to let the pasteboard know a file type?]

2008-12-19 Thread JongAm Park

Because my previoius post contains extra href link, it was not readable.
So, I am posting it by removing all format.

 Original Message 
Hello. I found out that NSCreateFilenamePboardType() would help. So, I 
tried it like :


My code example is :

In awakeFromNib


NSString *quicktimeFileNamesPboardType = NSCreateFilenamePboardType(@mov);

[myNSTableView registerForDraggedTypes:[NSArray 
arryWithObject:quickTimeFileNamesPboardType]];



In -tableView:writeRowsWithIndexes:toPasteboard:


NSString *quicktimeFileNamesPboardType = NSCreateFilenamePboardType(@mov);

anIndex = [selectedRowsIndexSet firstIndex];
while( anIndex != NSNotFound )
{
   fileName = [NSString stringWithFormat:@%@/%...@.mov, configPath, 
[[dataArray objectAtIndex:anIndex] name]];

   [fileNamesArray addObject:fileName];

   // Next index
   anIndex = [selectedRowIndexSet indexGreaterThanIndex:anIndex];
}

[pboard declareTypes:[NSArray 
arrayWithObjects:quicktimeFilenamesPboardType, nil] owner:nil];
isSuccessful = [pboard setPropertyList:fileNamesArray 
forType:quicktimeFilenamesPboardType];


...


When I check what information is exported from my program with the Drag 
Peeker X, it shows :



Item Reference: 19884c10
  Item Bounds (tlbr): { 86, 1, 104, 191 }
  Number of flavors: 0


Strangely, it doesn't have any flavor of data.

Is there anything wrong how I use the NSCreateNSFilenamePboardType? How 
to use it properly?

Thank you in advance.

P.S. By the way, is it normal to put 'furl' and 'hfs' flavor when 
NSFilenamesPboardType is used? Because an array of file names are added 
to the pasteboard, I thought that only file name strings were added. But 
it turned out no-so-true.


JongAm Park wrote:
 Hi,

 Thanks to a utility program, called DragPeeker X, I found out some 
clue why the FCP treated dragged file as a file with unknown type.


 When I dragged the same file from the Finder to the FCP, it shows :

 Number of Items: 1
 1. Item Reference: 19884c10
Item Bounds (tlbr): { 86, 1, 104, 191 }
Number of flavors: 2
1.Flavor Type: 'furl'
Flavor Flags: 0
Length: 54
Data:
66 69 6C 65 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 
file://localhost
2F 56 6F 6C 75 6D 65 73 2F 31 37 32 2E 31 36 2E 
/Volumes/172.16.
32 34 36 2E 31 34 36 2F 4D 4F 56 2F 30 30 30 33 
246.146/MOV/0003
59 42 2E 6D 6F 76   
YB.mov2.Flavor Type: 'hfs '

Flavor Flags: 300
Length: 80
Data:
4D 6F 6F 56 3F 3F 3F 3F 00 00 FF 98 00 00 00 13 
MooV
0A 30 30 30 33 59 42 2E 6D 6F 76 DC 00 00 00 00 
.0003YB.mov.
FF FF FF FF 00 00 00 00 00 25 F0 A0 A0 31 60 34 
.%...1`4
91 F6 C0 A0 BF FF DA 80 84 04 20 42 91 F6 6B 44 
.. B..kD
91 F6 C0 A0 00 86 B4 00 17 BB 17 FC BF FF DA C4 



 But if I drag one from my application to the FCP, it shows :

 Number of Items: 1
 1. Item Reference: c0c0a
Item Bounds (tlbr): { 219, 244, 219, 244 }
Number of flavors: 2
1.Flavor Type: 'furl'
Flavor Flags: 0
Length: 54
Data:
66 69 6C 65 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 
file://localhost
2F 56 6F 6C 75 6D 65 73 2F 31 37 32 2E 31 36 2E 
/Volumes/172.16.
32 34 36 2E 31 34 36 2F 4D 4F 56 2F 30 30 30 33 
246.146/MOV/0003
59 42 2E 6D 6F 76   
YB.mov2.Flavor Type: 'hfs '

Flavor Flags: 0
Length: 80
Data:
00 00 00 00 00 00 00 00 00 00 FF 98 00 00 00 13 

0A 30 30 30 33 59 42 2E 6D 6F 76 FC 00 25 DB A0 
.0003YB.mov..%..
00 00 00 06 00 18 80 00 00 00 00 60 00 25 8E B0 
...`.%..
90 10 7A 44 BF FF DA 70 44 04 20 42 90 10 7D EC 
..zD...pD. B..}.
00 00 00 02 BF FF DA 90 00 00 00 20 BF FF DC F4 
... 



 ( I also tried NSURLPboardType and NSFileContentsPboardType. But they 
didn't make information like above appear. )

 The PboardType I used was NSFilenamesPboardType.

 The major difference between those are in the 2nd flavor type 'hfs'.
 Their flavor flags are different: one is 300, while the other is 0.

 What actually matters, I think, is the data of the 2nd flavor.
 The one using the Finder starts with MooV, which says that the 
dragged item is a QuickTime movie, while the one from my application 
doesn't contain anything. ( all 0's. )


 So, is there any way to mark that the interested file is in a 
specific type, i.e. QuickTime movie file?


 Thank you.


___

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

Please do not post admin requests or moderator comments to the list

[Q] How will the Pasteboard manager be changed?

2008-12-19 Thread JongAm Park

Hello.

I'm implementing some logic to enable drag from my application's 
NSTableView  and drop on the Final Cut Pro's project.
I found out that it was not possible with NSFilenamesPboardType. When I 
compared it a dragdrop from the Finder to the FCP, the one between the 
Finder and the FCP contained fURL and hfs flavors and its hfs flavor 
data showed that the dragged item was a QuickTime movie, while the one 
between from my program and the Finder contained same kind of data but 
its hfs flavor didn't show that it was a QuickTime movie.
So, I tried using NSCreateFilenamePboardType( @mov ) and 
NSCreateFilenamePboardType( (NSString *)kUTTypeQuickTimeMovie ); but 
they didn't allow the dragdrop. Although the default 
NSFilenamesPboardType generates fURL and hfs flavor, the one from 
NSCreateFilenamePboardType() doesn't generate them.
So, I started thinking that mechanism using NSCreateFilenamePboardType() 
is on its way to death.


So, I read Apple's document further, and found out that the Carbon's 
pasteboard manager dropped many functions like something related to flavors.
Almost all functions are deprecated, and it gave me feeling that 
probably the Carbon's pasteboard manager would work like that of Cocoa.
(Well, eventually Carbon would die, but.. at least 64bit support on the 
Carbon and GUI support look so. )

So, I wonder if I really give up dragdrop from my application and the FCP.
The FCP looks like a Carbon app. So, I may need to write carbon code to 
put hfs flavor. But I doubt if it is worth while to doing so.


So, can anyone tell me how the Carbon's pasteboard manager will change, 
and why Cocoa's pasteboard manager doesn't reveal some methods which 
handles flavors easily? Probably flavors are being deprecated also? ( 
Although there should be some similar mechanism.. )


I will appreciate any comment.
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: [Q] How will the Pasteboard manager be changed?

2008-12-19 Thread JongAm Park

Thanks for your comment.

Although the AppKit supports UTIs, but I couldn't find a way to generate 
pasteboard type for 'hfs'.

So, probably for this, I think Carbon functions should be used.
There are only two functions in the AppKit for making file type specific 
Pboard : NSCreateFileContentsPboardType() and NSCreateFilenamePboardType().


Although NSFilenamesPboardType yield 'fURL' and 'hfs' flavors, using 
returned string by calling NSCreateFileContentsPboardType() doesn't 
generate any flavors. So, I had to find a way to generate the 'hfs' 
using the Cocoa, but I guess I need to use Carbon functions.


By the way, can the Pasteboard type and NSPasteboard be intermixed like 
CFStringRef and NSString?


Thanks,
JongAm Park

Jim Correia wrote:

On Dec 19, 2008, at 5:39 PM, JongAm Park wrote:

So, can anyone tell me how the Carbon's pasteboard manager will 
change, and why Cocoa's pasteboard manager doesn't reveal some 
methods which handles flavors easily? Probably flavors are being 
deprecated also? ( Although there should be some similar mechanism.. )


The preferred, mechanism independent way, to describe types on Mac OS 
X is to describe them via a Uniform Type Identifier (UTI).


Most places in AppKit should transparently support UTIs on 10.5 and 
later. If you need to interact with the pasteboard on earlier 
releases, you'll have to drop down to the procedural API in Pasteboard.h.


If you have a four char code that you need to represent as a UTI, you 
can do the conversion using the functions in UTType.h.


Jim



___

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

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

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

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


[Q] What type the Final Cut Pro expect when a file is dragdropped to its project?

2008-12-18 Thread JongAm Park

Hello.

I wrote some codes which will enable dragdrop from my application to 
FCP's project.
Before implementing it, I tried dragging and dropping a file from a 
Finder to an FCP's project which was opened with the FCP.
After confirming that the FCP supports dragdrop from the Finder, I 
started implementing codes like below.


In awakeFromNib
  /
  // Registering the drag type for Drag  Drop support
  [mClipTable registerForDraggedTypes:[NSArray 
arrayWithObjects:NSFilenamesPboardType,NSURLPboardType, nil]];


  // Allow that the drag target or where it drops is other application,
  // especially the Final Cut Pro.
  [mClipTable setDraggingSourceOperationMask:NSDragOperationEvery 
forLocal:NO];

  

- (BOOL)tableView:(NSTableView *)aTableView 
writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard 
*)pboard

{
  JALog(@--[Initiation of Drag]--);
  JALog(@rowIndexes : %@, rowIndexes);
 
  NSMutableArray *fileNamesArray = [NSMutableArray array];

  NSURL *draggedFileURL;

  // The pasteboard is for NSFilenamesPboard
  [pboard declareTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSURLPboardType, nil] 
owner:self];
 
  NSString *configPath = [preferenceSetting configPath];

  NSIndexSet *selectedRowsIndexSet = [mClipTable selectedRowIndexes];
  unsigned int anIndex;
  int indexInClipsArray;
  NSString *fileName;
 
  anIndex = [selectedRowsIndexSet firstIndex];

  while( anIndex != NSNotFound )
  {
   // For NSFilenamesPboardType
   indexInClipsArray = [self getClipsArrayIndex:anIndex];
   fileName = [NSString stringWithFormat:@%@/%@, configPath, 
[[mClipArray objectAtIndex:indexInClipsArray] longName]];

   [fileNamesArray addObject:fileName];

// For NSURLPboardType
draggedFileURL = [[NSURL alloc] initFileURLWithPath:fileName];
[draggedFileURL writeToPasteboard:pboard];
[draggedFileURL release];

   // next index
   anIndex = [selectedRowsIndexSet indexGreaterThanIndex:anIndex];
  }

  [pboard setPropertyList:fileNamesArray forType:NSFilenamesPboardType];

  return YES;

}

When I drag and dropped a file which is shown in my application to the 
FCP, the FCP displayed a dialog box which said File Error: Unknown 
file.. Because the paste board type to use is NSFilenamesPboardType, I 
populate file names with its path prefixed. But it didn't work.

Also, I tried NSURLPboardType, but it didn't work also.
Two options left are file content and File Promise, but I am not sure if 
which one will work.

Can anyone tell me what paste board type the FCP can accept?

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


[Q] availableTypeFromArray returns NXFileContentsPboardType instead of NSFileContentsPboardType

2008-12-18 Thread JongAm Park

Hello, all.

I'm struggling to enable dragdropping to Final Cut Pro's project window 
from my application.


While I was trying to figure out how to, I found this strange thing.

NSArray *supportedTypes = [NSArray 
arrayWithObject:NSFileContentsPboardType];


NSString *matchingType = [pboard availableTypeFromArray:supportedTypes];
if( [matchingType compare:@NSFileContentsPboardType] == NSOrderedSame )
{
   outputFileName = [NSString stringWithFormat:@%@/Desktop/test.mov, 
NSHomeDirectory()];
   outputFileNameResult = [pboard 
readFileContentsType:NSFileContentsPboardType toFile:outputFileName];

}


I expected that the matchingType returned by calling 
availableTypeFromArray is @NSFileContentsPboardType.

But, in fact, it returns @NXFileContentsPboardType.
So, it doesn't reach the body of the if clause.
Is this a bug?

For other pboard types, it seems to return NS*PboardType, according to 
this document.

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/Reference/Reference.html#//apple_ref/doc/uid/2328-availableTypeFromArray_

___

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

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


[Q] How to let the pasteboard know a file type?

2008-12-18 Thread JongAm Park

Hi,

Thanks to a utility program, called DragPeeker X, I found out some clue 
why the FCP treated dragged file as a file with unknown type.


When I dragged the same file from the Finder to the FCP, it shows :

Number of Items: 1
1. Item Reference: 19884c10
   Item Bounds (tlbr): { 86, 1, 104, 191 }
   Number of flavors: 2
   1.Flavor Type: 'furl'
   Flavor Flags: 0
   Length: 54
   Data:
   66 69 6C 65 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 
file://localhost
   2F 56 6F 6C 75 6D 65 73 2F 31 37 32 2E 31 36 2E 
/Volumes/172.16.
   32 34 36 2E 31 34 36 2F 4D 4F 56 2F 30 30 30 33 
246.146/MOV/0003
   59 42 2E 6D 6F 76   
YB.mov 
   2.Flavor Type: 'hfs '

   Flavor Flags: 300
   Length: 80
   Data:
   4D 6F 6F 56 3F 3F 3F 3F 00 00 FF 98 00 00 00 13 
MooV
   0A 30 30 30 33 59 42 2E 6D 6F 76 DC 00 00 00 00 
.0003YB.mov.
   FF FF FF FF 00 00 00 00 00 25 F0 A0 A0 31 60 34 
.%...1`4
   91 F6 C0 A0 BF FF DA 80 84 04 20 42 91 F6 6B 44 
.. B..kD
   91 F6 C0 A0 00 86 B4 00 17 BB 17 FC BF FF DA C4 



But if I drag one from my application to the FCP, it shows :

Number of Items: 1
1. Item Reference: c0c0a
   Item Bounds (tlbr): { 219, 244, 219, 244 }
   Number of flavors: 2
   1.Flavor Type: 'furl'
   Flavor Flags: 0
   Length: 54
   Data:
   66 69 6C 65 3A 2F 2F 6C 6F 63 61 6C 68 6F 73 74 
file://localhost
   2F 56 6F 6C 75 6D 65 73 2F 31 37 32 2E 31 36 2E 
/Volumes/172.16.
   32 34 36 2E 31 34 36 2F 4D 4F 56 2F 30 30 30 33 
246.146/MOV/0003
   59 42 2E 6D 6F 76   
YB.mov 
   2.Flavor Type: 'hfs '

   Flavor Flags: 0
   Length: 80
   Data:
   00 00 00 00 00 00 00 00 00 00 FF 98 00 00 00 13 

   0A 30 30 30 33 59 42 2E 6D 6F 76 FC 00 25 DB A0 
.0003YB.mov..%..
   00 00 00 06 00 18 80 00 00 00 00 60 00 25 8E B0 
...`.%..
   90 10 7A 44 BF FF DA 70 44 04 20 42 90 10 7D EC 
..zD...pD. B..}.
   00 00 00 02 BF FF DA 90 00 00 00 20 BF FF DC F4 
... 



( I also tried NSURLPboardType and NSFileContentsPboardType. But they 
didn't make information like above appear. )

The PboardType I used was NSFilenamesPboardType.

The major difference between those are in the 2nd flavor type 'hfs'.
Their flavor flags are different: one is 300, while the other is 0.

What actually matters, I think, is the data of the 2nd flavor.
The one using the Finder starts with MooV, which says that the 
dragged item is a QuickTime movie, while the one from my application 
doesn't contain anything. ( all 0's. )


So, is there any way to mark that the interested file is in a specific 
type, i.e. QuickTime movie file?


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: [Q] How to add nested items to NSOutlineView?

2008-11-06 Thread JongAm Park

Thank you for your answer.

I found same question asked by other person in Cocoa mailing list.

http://www.cocoabuilder.com/archive/message/cocoa/2008/4/7/203440

and an answer refers 
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/Troubleshooting.html#//apple_ref/doc/uid/TP40002148-182809





Benjamin Stiglitz wrote:
However, if I get reference of an item in existing view and insert 
new item in its data source, NSMutableArray, it can't display the 
newly added nested items.


I tried NSTreeController's rearragneObjects and the NSOutlineView's 
reloadItem:reloadChildren, but it doesn't seem to work for me.


Can anyone tell me how to add new items?


Since you’re using NSTreeController, you should modify the array in a 
KVO-compatible way. Take a look at
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/mutableArrayValueForKeyPath: 



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


[Q] How to add nested items to NSOutlineView?

2008-11-05 Thread JongAm Park

Hello.

I'm writing a Source List View using the NSOutlineView and an 
NSTreeController.

It should work on Mac OS X 10.4 Tiger, so I can't use NSTreeNode.

My Source List View is based on Mark Alldritt’s source list view, 
http://www.latenightsw.com/blog/?p=29.
Problem is that when a data source for the view is set up at first, it 
can even display nested items.
However, if I get reference of an item in existing view and insert new 
item in its data source, NSMutableArray, it can't display the newly 
added nested items.


I tried NSTreeController's rearragneObjects and the NSOutlineView's 
reloadItem:reloadChildren, but it doesn't seem to work for me.


Can anyone tell me how to add new items?

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


Re: IB plugins

2008-10-03 Thread JongAm Park



 Ken,

 Step 2 of this section says: In the library window, select the  
 Library  IB SDK group. This group contains a single entry, which is  
 a library object template. It is referring to the Interface  
 Builder Kit category of items (as opposed to, for example, the  
 Cocoa or WebKit groups) in the Library window.



When I create a new IB project using Xcode, I can't see any files,  
groups, categories or resources labeled Interface Builder Kit. Which  
application should I be looking in? Xcode or InterfaceBuilder? If you  
create a new IB plugin at your end, do you see this Interface Builder  
Kit category? If not, which of the automatically generated files is  
it contained in?


Hello.
The current Interface Builder Plug-in project template contains a bug 
and I reported it.

But you should not have problem in the step you have trouble.

For comparison, my project string formatter IB plugin project contains 
these. I didn't add any new files, except for an image.


JAStringFormatter ( the project)
- Plugin ( This is a directory for a plugin which will be built )
  - Class Descriptions
  - Classes
  - Other Sources
  - Resources
 - JAStringFormatterLibrary.nib ( This *contains *the *LIBRARY 
OBJECT!* So, open this one. )

 - JAStringFormatterInspector.xib
 - JAStringFormatter-picture.tif

- Framework ( This is a directory for a framework to be built. Other 
project which will use your plugin will be linked to this framework. )

  - Classes
 - Resources

- Products ( will contain built IB plugin and its framework )
- Frameworks ( frameworks which are linked to the your IB plugin/framework)

--
Now, if you open your *.nib file which I wrote in red, or commented as 
(This contains the LIBRARY OBJECT!.. ),
you will be able to locate some icons : File's owner, First Responder, 
Application, Library Object


The Library Object there is the one you are mentioning. The document 
shows the default one, and you can edit it or you can remove it and add 
a new one.
If you want to locate the Library Object, which is 
IBLibraryObjectTemplate, bring a Library panel under Tools menu of 
the Interface Builder.
Under its Objects tab, and under Library=Cocoa, you will be able to 
locate Interface Builder Kit. If you click it, there is only one item, 
Library Template which is subtitled as IBLibraryObjectTemplate. It is 
the one you want.


I hope this clarify your question.

JongAm Park



___

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

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


[Q] Which mailing list is for the functions like valloc()?

2008-09-26 Thread JongAm Park

Hello, all.

I think I found a bug in the valloc(). However, before reporting it to 
Apple, I would like to ask if it is really a bug or if anyone also 
noticed the problem.
So, I tried figuring out what mailing list is for, but couldn't 
determined it.
Can it be here, Cocoa-dev, or others like *Darwin-x86* 
http://lists.apple.com/mailman/listinfo/darwin-x86 or *Darwin-dev* 
http://lists.apple.com/mailman/listinfo/darwin-dev?


Thanks

___

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

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


[Q] Custom NSFormatter and IB's Cocoa Simulator

2008-09-22 Thread JongAm Park

Hello.

I tried making my own custom NSFormatter by following the guide, 
Interface Builder Plug-In Programming Guide


However, when I tried my NSFormatter subclass using the Simulate 
Interface menu item of the Interface Builder, it rasied :


An uncaught exception was raised
*** - [NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of 
class (JAStringFormatter)


*** Terminating app due to uncaught exception  
'NSInvalidUncarchiveOperationException', reason:
'*** - [NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of 
class (JAStringFormatter)'


Can anyone tell me how to solve this problem?

Also, I would like to ask if 
attributedStringForObjectValue:withDefaultAttributes: is really 
requried to be overriden.
The document says, To subclass NSFormatter, you must, at the least, 
override the three primitive methods:.


Thank you in advance.

___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] How to enable Copy Paste in a text field of a Final Cut Pro plugin window?

2008-09-05 Thread JongAm Park

How are you doing, all?

I wrote a Final Cut Pro plugin which had a few NSTextFields on it.

What I figured out is that the Final Cut's Edit=Copy  Paste menu are 
not enabled and it doesn't allow copy and paste text for the text fields 
on the plugin window.


I tried checking how other FxP plugins work and they work Ok with the 
copy and paste.

Can any one explain me how to enable the Copy  Paste for my plugin?
I checked the First Responder's methods and found copy:, paste:, cut: 
there.


Some plugin like Cinema Tools Audio EDL... has its own menu bar while 
EDL shares the menu of the FCP.
Because my plugin doesn't have menu resource, if there is a way to share 
the FCP's, it would be better.


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


Re: [Q] How to enable Copy Paste in a text field of a Final Cut Pro plugin window?

2008-09-05 Thread JongAm Park

Darrin Cardani wrote:

On Sep 5, 2008, at 11:26 AM, JongAm Park wrote:


How are you doing, all?

I wrote a Final Cut Pro plugin which had a few NSTextFields on it.

What I figured out is that the Final Cut's Edit=Copy  Paste menu 
are not enabled and it doesn't allow copy and paste text for the text 
fields on the plugin window.


I tried checking how other FxP plugins work and they work Ok with the 
copy and paste.

Can any one explain me how to enable the Copy  Paste for my plugin?
I checked the First Responder's methods and found copy:, paste:, 
cut: there.


Some plugin like Cinema Tools Audio EDL... has its own menu bar 
while EDL shares the menu of the FCP.
Because my plugin doesn't have menu resource, if there is a way to 
share the FCP's, it would be better.



What sort of plugin is this? If it's an FxPlug, you can just use a 
text edit parameter, and it should behave correctly. This has the 
added bonus of not needing to write your own code to handle an 
NSTextView.


There is no published way for 3rd parties to add menu items to FCP.

Darrin
--
Darrin Cardani
[EMAIL PROTECTED]

Hi!

Thank you for your reply.

By the way, I will not add a custom menu items to the FCP.
The Final Cut Pro plugin I'm working on will display a dialog box or a 
window. There are a few NSTextField, not NSTextView, instance. When a 
user types some text in the text field instances, he can want to 
copy/cut and paste text.
It was a kind of a free bread for usual Cocoa app. program, but I found 
out that it was not for the plugin. So, I took a look at other plugins 
and if it was possible to copy/paste text.


There was a plugin, called EDL, in the export menu of the FXP, and it 
doesn't have its own menu items like Copy, Cut, and Paste.

However, the FXP's menu items under the Edit menu were enabled properly.
So, I would like to know how to do so.

I tried searching about the text edit prarameter mentioned, but I 
couldn't figure out what it is for and how to use it.


FYI, the FXP plugin's super class is NSObject conforms 
PRODataInterchange protocol.


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


[Q] SFPreferenceView and authorize as admin?

2008-08-21 Thread JongAm Park

I don't think it is not possible.. but.. does anyone know how to?

Thank you.

 Original Message 
Subject:[Q] SFPreferenceView and authorize as admin?
Date:   Wed, 20 Aug 2008 14:53:34 -0700
From:   JongAm Park [EMAIL PROTECTED]
To: cocoa-dev cocoa-dev@lists.apple.com



Hello, all.

Does any of you know how to authorize a user as an admin user using the 
SFPreferenceView?


I'm writing a preference pane for the System Preference.
What this custom preference pane does are :

- Display system wide setting, but until a user clicks the lock icon, 
a user is not allowed to change it.
 When the user clicks the lock icon, it asks ID and password. ( This 
is done by the SFPreferenceView. )


- Display user-specific setting and allows changing them

- When the user choose other preference pane, it saves the system-wide 
setting and the user-specific setting.



To save the system-wide setting, I used :

   CFPreferenceSetValue( CFSTR(System Name, [systemNameField
   stringValue], kAppID, kCFPreferencesAnyUser, kCFPreferencesAnyHost );

   isSuccessful = CFPreferencesSynchronize( kAppID,
   kCFPreferencesAnyUser, kCFPreferencesAnyHost );


Currently the SFPreferenceView is initialized like :

   [authView setDelegate:self];
   [authView setString:appID_UTF8_CString];
   [authView updateStatus:self];
   [authView setEnabled:YES];


For being sure, I also obtain the authorization from the authView and 
tried setting kAuthorizationRuleAuthenticateAsAdmin.


   SFAuthorization *authorization = [authView authorization];
   AuthorizationRef authRef = [authorization authorizationRef];
   AuthorizationRights *authRights = [authView authorizationRights];

   CFStringRef keys[2] = { CFSTR(kAuthorizationRightRuel),
   CFSTR(kAuthorizationComment)};
   CFStringRef values[2] = {
   CFSTR(kAuthorizationRuleAuthenticateAsAdmin), CFSTR(Authorize as
   Admin) };

   CFDictionaryRef dictRef = CFDictionaryCreate( NULL, (void *)keys,
   (void *)values, 2, kCFCopyStringDictionaryKeyCallBacks,
   kCFTypeDictionaryValueCallBacks);

   // To modify the authorization of the authView, the authRef is used.
   result = AuthorizationRightSet( authRef, authRights-items[0].name,
   dictRef, CFSTR(Authorize as an admin), NULL, NULL );


Although it returns 1 for the isSuccessful, it doesn't create a plist 
file in /Library/Preferences directory for the system-wide setting.


Can anyone help me?

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


[Q] Using SFAuthorizationView in a Preference Pane project

2008-08-20 Thread JongAm Park

How are you doing?

I write a sample preference pane in which there are a few text fields 
and check boxes.
They are organized as two groups: one for system-wide setting, and the 
other for a user-specific setting.


I use the SFAuthorizationView for restricting users to access a 
system-wide setting.
However, it should be able to retrieve a system wide setting and display 
it in grayed-out text in the text fields and set the state of the check 
boxes in that way.


There are two things I would like to do.

1. Without asking a user's ID and password, which is done by the 
SFAuthorizationView, can it get the system wide setting?
It would be nice if a user can see the existing system-wide 
setting, although they are grayed-out.
(Only when a user unlocks the lock icon provided by the 
SFAuthorizationView, he/she can change the setting.)


2. The system-wide setting doesn't seem to be saved in 
/Library/Preferences directory, although the user-specific setting is 
saved in ~/Library/Preferences directory. The code looks like :
  
CFPreferencesSetValue( CFSTR(System Name), [systemNameField 
stringValue], kAppID, kCFPreferencesAnyUser, kCFPreferencesAnyHost );
isSuccessful = CFPreferencesSynchronize(kAppID, kCFPreferencesAnyUser, 
kCFPreferencesAnyHost);


  The isSuccessful contains YES, when the CFPreferencesSynchronize() 
is called.
   However, there is no com.GreenLeaf.JAPreferencePaneTest.plist file 
in /Library/Preferences for the system-wide setting!
  I checked if the system wide setting is saved in other places 
already, but I couldn't find it.


Can someone give me some advice?

Thank you.
JongAm Park
___

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

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


[Q] SFPreferenceView and authorize as admin?

2008-08-20 Thread JongAm Park

Hello, all.

Does any of you know how to authorize a user as an admin user using the 
SFPreferenceView?


I'm writing a preference pane for the System Preference.
What this custom preference pane does are :

- Display system wide setting, but until a user clicks the lock icon, 
a user is not allowed to change it.
 When the user clicks the lock icon, it asks ID and password. ( This 
is done by the SFPreferenceView. )


- Display user-specific setting and allows changing them

- When the user choose other preference pane, it saves the system-wide 
setting and the user-specific setting.



To save the system-wide setting, I used :

   CFPreferenceSetValue( CFSTR(System Name, [systemNameField
   stringValue], kAppID, kCFPreferencesAnyUser, kCFPreferencesAnyHost );

   isSuccessful = CFPreferencesSynchronize( kAppID,
   kCFPreferencesAnyUser, kCFPreferencesAnyHost );


Currently the SFPreferenceView is initialized like :

   [authView setDelegate:self];
   [authView setString:appID_UTF8_CString];
   [authView updateStatus:self];
   [authView setEnabled:YES];


For being sure, I also obtain the authorization from the authView and 
tried setting kAuthorizationRuleAuthenticateAsAdmin.


   SFAuthorization *authorization = [authView authorization];
   AuthorizationRef authRef = [authorization authorizationRef];
   AuthorizationRights *authRights = [authView authorizationRights];

   CFStringRef keys[2] = { CFSTR(kAuthorizationRightRuel),
   CFSTR(kAuthorizationComment)};
   CFStringRef values[2] = {
   CFSTR(kAuthorizationRuleAuthenticateAsAdmin), CFSTR(Authorize as
   Admin) };

   CFDictionaryRef dictRef = CFDictionaryCreate( NULL, (void *)keys,
   (void *)values, 2, kCFCopyStringDictionaryKeyCallBacks,
   kCFTypeDictionaryValueCallBacks);

   // To modify the authorization of the authView, the authRef is used.
   result = AuthorizationRightSet( authRef, authRights-items[0].name,
   dictRef, CFSTR(Authorize as an admin), NULL, NULL );


Although it returns 1 for the isSuccessful, it doesn't create a plist 
file in /Library/Preferences directory for the system-wide setting.


Can anyone help me?

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


Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-03 Thread JongAm Park

Thank you very much for the valuable information.

I will try the 1st and the 3rd options, because the 2nd option will  
not be easily applicable withouth refactoring the current code a lot.


Thank you again,
Regards,
JongAm Park

On Aug 2, 2008, at 7:51 AM, James Bucanek wrote:

JongAm Park mailto:[EMAIL PROTECTED] wrote  
(Friday, August 1, 2008 7:27 PM -0700):
The function will write about 19200 bytes per every call. I'm  
going to
write XDCAM 35 or 50 video data. What is curious was that saving  
files

as QuickTime movie format from the Final Cut Pro takes about 20 secs
for 1 minutes of XDCAM 35 video source, but if it does so using a FCP
plug-in of which source codes I work with takes about 35 seconds.
There is a call back function which is called by th FCP, and I even
tried converting it to multithreaded version, but it is still much
slower than the FCP's own scheme.

I measured the performance and found out that the most of the time
were spent with the FSWriteFork() function. Probably other parts
should be streamlined also, but it would impact significantly if the
file write can be faster.


Writing 19,200 bytes per call is going to add a significant amount  
of overhead. FSWriteFork() can be blindingly fast, but degrades  
when given small and/or misaligned chunks of data to deal with.


In my experience, the keys to making FSWriteFork() fly are

- Align the data to be written in memory to page boundaries (man  
valloc).

- Write data in multiples of page size blocks (man getpagesize)
- Turn off caching (see Cache Constants of FSWriteFork)

This allows FSWriteFork to avoid maintaining and copying your data  
into a buffer, which then gets written to disk in pieced. If all of  
the above prerequisites are met, the file system can perform a DMA  
transfer directly from your address space to the disk controller.


In my application, I was primarily interested in increasing read  
performance. Aligning the data buffers and reading large blocks  
(2MB) at a time more than doubled the read performance while  
simultaneously dropping CPU overhead.


Ultimately, I ended up creating a separate thread to read the data  
from the file into a set of circular buffers, while a second thread  
processed the data that had already been read. Between the faster I/ 
O and the reduced CPU overhead (which could then be utilized by the  
thread processing the data) I was able to improve the performance  
of my application by 350%.

--
James Bucanek



___

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

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


[Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread JongAm Park

Hello..

I have some codes which were written in Carbon and we want to make its 
performance faster.
I found out that most of the time is spent by a series of FSWriteFork() 
function. So, I would like to use any method which is faster than that.
fwrite is one option but I also looked up a Cocoa method, writeData 
message of the NSFileHandle.


Does anyone know if the writeData's performance compared to the 
FSWriteFork()?

Or can anyone suggest other methods to take?

Thank you.
JongAm Park
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-01 Thread JongAm Park

Thank you, Jens Alfke for your reply.

The function will write about 19200 bytes per every call. I'm going  
to write XDCAM 35 or 50 video data.
What is curious was that saving files as QuickTime movie format from  
the Final Cut Pro takes about 20 secs for 1 minutes of XDCAM 35 video  
source, but if it does so using a FCP plug-in of which source codes I  
work with takes about 35 seconds. There is a call back function which  
is called by th FCP, and I even tried converting it to multithreaded  
version, but it is still much slower than the FCP's own scheme.


I measured the performance and found out that the most of the time  
were spent with the FSWriteFork() function.
Probably other parts should be streamlined also, but it would impact  
significantly if the file write can be faster.


Thank you.

On Aug 1, 2008, at 6:04 PM, Jens Alfke wrote:



On 1 Aug '08, at 3:33 PM, JongAm Park wrote:

I have some codes which were written in Carbon and we want to make  
its performance faster.
I found out that most of the time is spent by a series of  
FSWriteFork() function. So, I would like to use any method which  
is faster than that.
fwrite is one option but I also looked up a Cocoa method,  
writeData message of the NSFileHandle.


All of those end up going through the same filesystem calls  
('write', primarily) in the kernel, so one's not going to be faster  
than another. I would expect fwrite to be a tiny bit slower because  
of the extra buffering that stdio does, and NSFileHandle will also  
be a little slower because of the overhead of calling Objective-C  
methods. But generally that wouldn't be noticeable.


What really makes a difference is how much data you write on each  
call — the more the better. It may also help to use uncached  
writes, if the file's not going to be read again soon.


The fs_usage tool can help you see what filesystem calls you're  
making and how much data is being sent in every call.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] [NSValue valueWithBytes: objCType:]

2008-07-31 Thread JongAm Park
 recover 
message's point of view, it is declared in the stack area of other 
message! )


There are couple of interesting things, anyway.

1. Whether the dataDesc is statically declared or not, although it is 
freed in the end of the encode action handler, it is still maintained 
and could be accessed from another message, recover. And with the 
Memory browser, I could confirm that the memory content was still there. 
Why is it so? Does the NSData or NSArray just retains them?


2. However, when I intentionally bzero it, the content is nullified, and 
the recover message sees the content as zeros. So, it is not caches in 
the NSArray. It seems to me that it just uses by referencing.


3. Should they be also freed in the recover function although it is done 
so in the encode action handler?


4. Should the dataDesc also be transformed separately as the data is?

5. for the data, I used dataWithBytes: length: thinking that it will 
copy the contents, instead of just referencing the original. However, it 
turns out that it just references it. I figured that out by bzeroing the 
original, and how it is seen in the recover function.
There is another message, dataWithBytesNoCopy:length:. It made me think 
that the dataWithBytes:length copies, while the 
dataWithBytesNoCopy:length just references it. The explanation on the 
dataWithBytes:length: is :


The number of bytes to 'copy' from bytes.

But as I described, it doesn't seem to copy.

Can anyone help me?

Thank you.
JongAm Park

___

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

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

2008-07-31 Thread JongAm Park

Hello.

Well, I did review the code as usual.
It is interesting that the exactly same memory blocks were allocated for 
the interested data and dataDesc.

So, it looked like that it is referenced, although they were not.

Thanks.

Jens Alfke wrote:
Something's fundamentally wrong with your code, in that data you think 
you're copying is really just being referenced through a pointer. I'm 
sorry, but you posted a lot of stuff and I'm not going to read through 
it all to debug it for you. You need to do some code review on your own.


—Jens


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Any document that shows differences of Cocoa, programmiing for Mac and for the iPhone/iPod touch?

2008-07-15 Thread JongAm Park

Thanks for the reply, Mr. Arentz.
Yeah.. I read the document but it doesn't really give me some idea on 
why it is made and why we need to use it.

Until the Tiger, views in a NIB file could be loaded, couldn't it?
So, I agree with your last comment. :)

The NSViewController documentation does a good job. The Overview  
section outlines three things that the NSViewController will handle  
for you.


I have not used the NSViewController in my project. But I think it is  
mostly useful when you want to load a (custom) view from a NIB/XIB  
file and hook it up to a bindings enabled data source.


For me the class reference is a bit dry. I would love to read more in  
the style of WHY you would want to use a certain class. A more  
pragmatic 'recipe' style documentation.


  S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Any document that shows differences of Cocoa, programming for Mac and for the iPhone/iPod touch?

2008-07-15 Thread JongAm Park

Oh.. Thank you very much for the links.
Actually I know the KATI blog. I even bookmarked it before, but I didn't 
noticed the article!

I found her blog from flickr link at Cocoa Head LA!

http://www.flickr.com/photos/kepi/2586194046/

What is more interesting here is that our beloved phone from a 
stripestar and a fruit company seems to be heavily modeled on the 
sibling of NSViewController, and I was curious if the design of Cocoa 
for the desktop also moves to that direction.



From: Stefan Arentz [EMAIL PROTECTED]
Just found this, should be interesting for other people ...

  
http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/ 

  
http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-of-3/ 

  
http://katidev.com/blog/2008/05/26/nsviewcontroller-the-new-c-in-mvc-pt-3-of-3/ 



S.
  

___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread JongAm Park

Hello, all.

Because the final SDK for the iPhone came out, I started to take a look 
at it.
Although I knew that Window/View hierarchies are different on the Mac 
and the iPhone, I found that there were some fundamental difference in 
programming model.


For example, this code from 
http://developer.apple.com/iphone/gettingstarted/docs/creatingiphoneapps.action,

it creates a view controller and add its view as a window's sub view.

Listing 2. Creating the content view

- (void) applicationDidFinishLaunching:(UIApplication *)application
{
   // Set up the view controller
   UIViewController *aViewController = [[UIViewController alloc] 
initWithNibName:@MoveMeView

   bundle:[NSBundle 
mainBundle]];

   self.viewController = aViewController;
   [aViewController release];

   // Add the view controller's view as a subview of the window
   UIView *controllersView = [viewController view];
   [window addSubView:controllersView];
   [window makeKeyAndVisible];
}


However, for the Mac, something like the view controller was not 
necessary, right? and a content view is not added manually like the code 
above. ( I don't mean that Oh, there is no UIViewController and 
UIView. I know that those are made for the iPhone. )
When a window and its view are made using the Interface Builder, they 
were handled automatically for the Mac.

Isn't this true for the iPhone?

(Well, I just looked up NSViewController document and it says that it 
was added to the Leopard.
Is there any document which explains why it is added and how the 
programming model is changed due to the addition of it? )


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


Re: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread JongAm Park
I'm sorry. I thought that the announcement of the final Xcode 3.1 also 
covered the iPhone SDK issue automatically.


Thanks for reminding me of that.

Waqar Malik wrote:

http://lists.apple.com/archives/Xcode-users/2008/Jul/msg00276.html

Still under NDA.


___

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

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


[Q] How to add Find feature for an NSTextView?

2008-07-09 Thread JongAm Park

Hello.

I'm trying to write codes that searches a given text in an NSTextView.
Currently, a window has an NSSearchField and an NSTextView. Some text 
will be loaded into the NSTextView and I expect users type into the 
NSSearchField to search some words in the NSTextView.


I connected -(IBAction)searchSource:(id)sender to the NSSearchField.

-(IBAction)searchSource:(id)sender
{
   NSString *searchString = [searchField stringValue];
   NSRange stringRange = NSMakeRange(0, [searchString length] );

   // xmlSourceView is the NSTextView in which the given string will be 
searched

   [xmlSourceView showFindIndicatorForRange:stringRange];
   [xmlSourceView performFindPanelAction:self];
}

According to the document, the performFindPanelAction performs some 
actions based on its tag.

However, there is no explanation how to set the tag.

Also, I tried Command-F to display a Find dialog box, but all of its 
buttons are disabled.
I thought Find feature was automatically enabled without writing any 
code before, but it doesn't work for me now.


Can anyone help me?

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


[Q] How to highlighted text remained as highlighted?

2008-07-09 Thread JongAm Park

Hello.

With the Safari, when users search some text in a HTML document, the 
found text is remained highlighted until they click Done button.
I tried using the showFindIndicatorForRage for NSTextView, but the 
yellow highlight just disappears after it blinks.

Is there any way to leave it highlighted?

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


Re: [Q] How to highlighted text remained as highlighted?

2008-07-09 Thread JongAm Park

Oh.. I see. Thank you for the information.

On Jul 9, 2008, at 4:14 PM, Douglas Davidson wrote:



On Jul 9, 2008, at 4:07 PM, JongAm Park wrote:

With the Safari, when users search some text in a HTML document,  
the found text is remained highlighted until they click Done  
button.
I tried using the showFindIndicatorForRage for NSTextView, but the  
yellow highlight just disappears after it blinks.

Is there any way to leave it highlighted?


There is no support for Safari-style highlighting.  Various forms of  
highlighting were considered, and the one implemented is the one  
considered to be appropriate for most NSTextView usage.


Douglas Davidson



___

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

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


[Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park

Hello, all.

Can anyone help me to figure out an issue regarding to a status menu 
width issue on Tiger?

The project I work on is for the Tiger and the Leopard.

I used this code to set an icon, which is longer horizontally than 
vertically, and it worked on the Leopard.


NSStatusBar *statusBar = [NSStatusBar systemStatusBar];

// Because it is a eps version of our company's name, it is longer 
horizontally. So, I used

// NSVariableStatusItemLength instead of NSSquareStatusItemLength
statusBarItem = [[statusBar statusItemWithLength: 
NSVariableStatusItemLength] retain];


[statusBarItem setImage:inactiveCompanyImage];
[statusBarItem setEnabled:YES];
[statusBarItem setToolTip:@Blah blah..];
[statusBarItem setHighlightMode:YES];

It works nicely with the Leopard, but our support team people say that 
it doesn't with the Tiger.
I'm suspicious if they use a small status bar program for displaying CPU 
temperature, etc.

(During the ToolBox era, I noticed such a case.. )

I would appreciate any 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 [EMAIL PROTECTED]


[Q] Regression of setSize for NSImage?

2008-07-01 Thread JongAm Park

Hello, all.

On the Leopard, I set a status bar item an icon with an eps image.
Because the eps image is somewhat big, I used the NSImage's size method 
to retrieve the size and

multiplied by 0.3 for its width and height.
And setSize method is called for the NSImage.

It works well on a Leopard machine, but on a Tiger it doesn't resized.
According to the document, the setSize has existed from 10.0.0.
Is this a bug? regression?

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


Re: [Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park

Hello. Thanks for your comment.

The problem is about scaling.
So, on a leopard, the big eps image was scaled to its 30% size 
correctly, but on a Tiger, it doesn't.

it seems to be displayed as is.

(Peter Ammon, I'm sorry that I posted somewhat half-written inquiry. I 
hit a return key while I was moving my stuff. )


A screenshot taken on a Tiger is attached, so I hope it would reveal the 
problem.


Thank you.
inline: Snapshot 2008-07-01 13-21-01.tiff___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park


Hello. Thanks for your comment.

The problem is about scaling.
So, on a leopard, the big eps image was scaled to its 30% size 
correctly, but on a Tiger, it doesn't.

it seems to be displayed as is.

(Peter Ammon, I'm sorry that I posted somewhat half-written inquiry. I 
hit a return key while I was moving my stuff. )


A screenshot taken on a Tiger is attached, so I hope it would reveal the 
problem.


Thank you.


inline: Snapshot 2008-07-01 13-21-01.tiff___

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

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

  1   2   >