Re: Write Finder plugin

2012-07-31 Thread Rakesh Singhal
Hi Kyle,

Thank you very much. It worked.

Regards,
Rakesh Singhal

On Thu, Jul 26, 2012 at 7:47 PM, Kyle Sluder k...@ksluder.com wrote:

 On Jul 26, 2012, at 3:56 AM, Rakesh Singhal rakesh.sing...@gmail.com
 wrote:

  It worked. Pbs was indexing the old build.
 
  On 10.7, I am not getting the file path instead of that I get something
  like file:///.file/id=6571367.3388989. In 10.6, I am getting full path.
  Is there something, I am missing?

 That's a file reference URL. Use -[NSURL filePathURL] to convert it to a
 normal file URL.

 --Kyle Sluder
___

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

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

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

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


UITableView not obeying storyboard settings

2012-07-31 Thread Alex Zavatone
I've got a UITableView within another view on a storyboard as in the example 
here:

https://docs.google.com/file/d/0B3FbUXsjem4pcFJkeWpTVzVRdVU/edit?pli=1

In my storyboard, the rect of the UITableView is (0, 313, 768, 598), and I am 
navigating to the scene ala a segue.


But as soon as viewDidLoad is called, the frame rect of the UITableView is  (0 
0; 768 911).

I'm not setting this anywhere and setting  UITableView.frame back to 
CGRectMake(0, 313, 768, 598) doesn't do anything on viewDidLoad or 
viewWillAppear.

Can anyone point out what I'm missing or doing wrong and why this is resizing 
to full screen in the first place??

Thanks in advance,
- Alex Zavatone
___

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

Please do not post 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: FSEvents eventid (or perhaps event)'s life

2012-07-31 Thread Alfian Busyro

Thanks for all replies.

Now I know that event ID is related with device UUID.
And about FSEventStore, I google it but I can not found any information 
of this.

can you provide some information of this ?

Alfian.

On 12/07/31 9:53, Ron Hunsinger wrote:

On Jul 30, 2012, at 4:47 AM, Robert Martin robmar...@frontiernet.net wrote:


Just keep track of the device UUID for each path and last event ID that you're 
tracking. EventID's are tied to each device, so you have to know that the 
device has not changed behind your back. For example, this can happen if the 
user has switched to a cloned backup drive containing the folders you are 
tracking. If the UUID's don't match, you can alert the user and rebuild 
whatever it is you're doing.

What you need to track is the UUID of the FSEventStore, together with the last 
event ID.

That is, there are three relevant IDs:
The volume itself has a UUID
Each volume has its own FSEventStore, with its own UUID
There is an event ID, that is meaningful only with respect to its 
particular FSEventStore

The FSEventStore gets invalidated and discarded at the slightest hint of 
trouble; most commonly any time the volume is not unmounted properly. A system 
crash, of course, fails to unmount any volume correctly, so it invalidates the 
FSEventStores of all volumes mounted at the time. A full OS install seems to 
also invalidate the FSEventStore.

The volume's UUID persists across all those things, but not across an erase. 
You can use it to be sure you're referring to the proper volume.

You can get the volume's UUID from diskutil info. You can read the 
FSEventStoreUUID from /.fseventsd/fseventsd-uuid

-Ron Hunsinger


___

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

Please do not post 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/alfian.busyro%40kddi-web.com

This email sent to alfian.bus...@kddi-web.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: UITableView not obeying storyboard settings

2012-07-31 Thread The Rhythmic
Have you connected an IBOutlet from code  then linked it in storyboard? I
assume you are programmatically setting the frame on this IBOutlet. And,
Did you check the Table View object's autosizing in Storyboard?

To debug, you can try adding another table view object (ignore the
problematic one) completely programmatically (don't configure it via
storyboard) and set it to the same frame size  (0, 313, 768, 598). BTW, how
do you get 768  598? Are they valid? YOu can also try setting the height 
width of the problematic tableview to something smaller just for a try (say
(0,200,320,100).



On Tue, Jul 31, 2012 at 12:37 PM, Alex Zavatone z...@mac.com wrote:

 I've got a UITableView within another view on a storyboard as in the
 example here:

 https://docs.google.com/file/d/0B3FbUXsjem4pcFJkeWpTVzVRdVU/edit?pli=1

 In my storyboard, the rect of the UITableView is (0, 313, 768, 598), and I
 am navigating to the scene ala a segue.


 But as soon as viewDidLoad is called, the frame rect of the UITableView is
  (0 0; 768 911).

 I'm not setting this anywhere and setting  UITableView.frame back to
 CGRectMake(0, 313, 768, 598) doesn't do anything on viewDidLoad or
 viewWillAppear.

 Can anyone point out what I'm missing or doing wrong and why this is
 resizing to full screen in the first place??

 Thanks in advance,
 - Alex Zavatone
 ___

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

 Please do not post 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/therhythmic%40gmail.com

 This email sent to therhyth...@gmail.com

___

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

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

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

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


Re: NSTextView scrolling

2012-07-31 Thread ecir hana
On Tue, Jul 31, 2012 at 6:19 AM, Richard Somers rsomers...@awinets.comwrote:


 This might help.


 http://www.cocoabuilder.com/archive/cocoa/145464-nstextview-auto-scroll-up-behaviour.html


Thanks for the reply! However, it does not seem to work - it still scrolls
half-page up/down, even if I change the margin variable there...

[sorry for the previous mail - it has a typo]
___

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

Please do not post 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: UIScrollView insertSubview:atIndex: problem

2012-07-31 Thread Dave


On 30 Jul 2012, at 19:40, David Duncan wrote:


You are going to have to define what you mean by start  end, as it  
is not clear in context.


If you mean a visual location, then neither of these methods are  
going to do what you want. You would put something visually at the  
start/end of the view by setting its location (via frame.origin or  
center) not via the add subview method you use.


If you mean a layering order, then the insertSubview:atIndex:  
method may attempt to do what you want, but given that a scroll  
view has other implicit subviews you would need to be more careful  
if you need an exact location. It may make more sense to use an  
intermediate subview that you place content into and which is a  
child of the scroll view in that case.

--
David Duncan



Hi David,

It's probably easier if I try to describe what I am trying to do!

Basically I have process that generates UIImage's and each of these  
images needs to be presented in a Scroll View. However there can be a  
large number of images generated and each image is pretty big too, so  
obviously, it can't hold them all in RAM. My idea is to keep a number  
of images (say 5) cached and as the user scrolls, generate the next  
or previous image and discard the old one.


In this document:

http://developer.apple.com/library/ios/DOCUMENTATION/WindowsViews/ 
Conceptual/UIScrollView_pg/UIScrollView_pg.pdf


I found the following:

Configuring Subviews of a Paging Scroll View

The subviews of a paging scroll view can be configured in one of two  
ways. If the content is small, you could
draw the entire contents at once, in a single view that is the size  
of the scroll view’s contentSize. While this
is the easiest to implement, it is not efficient when dealing with  
large content areas, or page content that takes

time to draw.

When your application needs to display a large number of pages or  
drawing the page content can take some
time, your application should use multiple views to display the  
content, one view for each page. This is more
complicated, but can greatly increase performance and allows your  
application to support much larger display
sets. The PageControl example uses this multiple view technique. By  
examining the sample code, you can see

exactly how this technique can be implemented.

Supporting a large number of pages in a paging scroll view can be  
accomplished using only three view instances,
each the size of the device screen: one view displays current page,  
another displays the previous page, and
third displays the next page. The views are reused as the user  
scrolls through the pages.
When the scroll view controller is initialized, all three views are  
created and initialized. Typically the views are
a custom subclass of UIView, although an application could use  
instances of UIImageView if appropriate. The
views are then positioned relative to each so that when the user  
scrolls, the next or previous page is always in
place and the content is ready for display. The controller is  
responsible for keeping track of which page is the

current page.

To determine when the pages need to be reconfigured because the user  
is scrolling the content, the scroll
view requires a delegate that implements the scrollViewDidScroll:  
method. The implementation of this
method should track the contentOffset of the scroll view, and when it  
passes the mid point of the current
view’s width, the views should be reconfigured, moving the view that  
is no longer visible on the screen to the
position that represents the next and previous page (depending on the  
direction the user scrolled). The delegate
should then inform the view that it should draw the content  
appropriate for the new location it the represents.


By using this technique, you can display a large amount of content  
using a minimum of resources.


If drawing the page content is time consuming, your application could  
add additional views to the view pool,
positioning those as pages on either side of the next and previous  
pages as scrolling occurs, and then draw
the page content of those additional pages when the current content  
scrolls.


--

The above is basically what I'd like to do, hold a number of pages/ 
images around the current page and when the user Scrolls left or  
right replace the appropriate pages/images with newly rendered versions.


I reckon that holding to 2 or 3 pages/images to the left and right of  
the current image should be enough to allow the user to scroll and  
not know the pages are being generated on the fly.


I've looked for the Sample Code mention is the above document, but I  
can't find it anywhere, I found a sample project on the Apple  
Developer Site but it doesn't seem to the the one they are talking  
about.


Any ideas or sample code on how to do this gratefully appreciated!

Thanks in Advance
Dave


















Re: UITableView not obeying storyboard settings

2012-07-31 Thread Alex Zavatone
Ahh, thought I caught this before it went out.

In any case, it appears that setting the frame of a UITableView doesn't do 
anything on viewDidLoad, or viewWillAppear, but does work on viewDidAppear.

And the reason the tableView didn't obey the storyboard settings was that the 
parent view wasn't wired to the class's view outlet.   

Cheers.  

On Jul 31, 2012, at 3:07 AM, Alex Zavatone wrote:

 I've got a UITableView within another view on a storyboard as in the example 
 here:
 
 https://docs.google.com/file/d/0B3FbUXsjem4pcFJkeWpTVzVRdVU/edit?pli=1
 
 In my storyboard, the rect of the UITableView is (0, 313, 768, 598), and I am 
 navigating to the scene ala a segue.
 
 
 But as soon as viewDidLoad is called, the frame rect of the UITableView is  
 (0 0; 768 911).
 
 I'm not setting this anywhere and setting  UITableView.frame back to 
 CGRectMake(0, 313, 768, 598) doesn't do anything on viewDidLoad or 
 viewWillAppear.
 
 Can anyone point out what I'm missing or doing wrong and why this is resizing 
 to full screen in the first place??
 
 Thanks in advance,
 - Alex Zavatone
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/zav%40mac.com
 
 This email sent to z...@mac.com

___

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

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

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

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


Re: UIScrollView insertSubview:atIndex: problem

2012-07-31 Thread David Duncan
On Jul 31, 2012, at 3:52 AM, Dave d...@looktowindward.com wrote:

 The above is basically what I'd like to do, hold a number of pages/images 
 around the current page and when the user Scrolls left or right replace the 
 appropriate pages/images with newly rendered versions.


So it sounds like you want the views to be visually in a particular position, 
and you should thus ensure that each view has the correct frame.origin or 
center to place them that way.
--
David Duncan

___

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

Please do not post 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: UIScrollView insertSubview:atIndex: problem

2012-07-31 Thread Quincey Morris
On Jul 31, 2012, at 03:52 , Dave d...@looktowindward.com wrote:

 Basically I have process that generates UIImage's and each of these images 
 needs to be presented in a Scroll View. However there can be a large number 
 of images generated and each image is pretty big too, so obviously, it can't 
 hold them all in RAM. My idea is to keep a number of images (say 5) cached 
 and as the user scrolls, generate the next or previous image and discard the 
 old one.

Remember that scrolling can accelerate if the user keeps swiping, which means 
that scrolling doesn't necessarily display *every* view of the sequence.

If the time it takes to create the view is short (less than the display refresh 
time), then there's no point in caching nearby images at all, at least from a 
scrolling point of view. You can simply recreate images as they are needed.

If -- the more likely scenario -- it takes longer to create the images, then 
caching the images isn't really going to solve the performance problem either, 
because that would require the cache to correctly predict what images are 
*going to* be needed, and have enough advance warning to be able to load up the 
cache *before* the images are needed. Your intended caching mechanism will fail 
in the case where the failure is probably most noticeable to the user -- the 
fast, continuous scrolling I already mentioned.

For those reasons, I'd suggest you'd be better off creating the images on 
demand, in a background thread, and drawing them when they become available. 
(You can create a low-resolution version or a partial representation of the 
data to display immediately, if that can be done fast enough.)

Such an approach, combined with the 3-views scrolling technique (to keep the 
memory usage down), should give you a good solution.

IDK either where sample code disappears these days, but watch the 2011 WWDC 
session video on using scroll views. It walks through the process of 
configuring such a view (it's fairly simple, and you can pretty much write your 
own code while watching). If you want to see how iOS 6 will simplify things a 
bit more, watch the beginning of the 2012 session on the same subject. I'd also 
highly recommend the 2012 WWDC session on concurrent user interfaces -- why, 
when and how you might move drawing to the background.


___

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

Please do not post 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


NSTask and NSPipe has buffering issues?

2012-07-31 Thread Mr. Gecko
I am having weird results with NSTask. It sometimes retrieves the output, and 
other times receives nothing.

I have example code for this issue at 
https://dl.dropbox.com/u/610721/NSTask%20Issue.zip

The result I have is below:

0 Starting
0 Received /bin/ls
0 Done
1 Starting
1 Received
1 Done
2 Starting
2 Received
2 Done
3 Starting
3 Received
3 Done
4 Starting
4 Received
4 Done
5 Starting
5 Received
5 Done
6 Starting
6 Received /bin/ls
6 Done
7 Starting
7 Received
7 Done
8 Starting
8 Received (null)
8 Done
9 Starting
9 Received (null)
9 Done
10 Starting
10 Received /bin/ls
10 Done
11 Starting
11 Received /bin/ls
11 Done
12 Starting
12 Received
12 Done
13 Starting
13 Received
13 Done
14 Starting
14 Received /bin/ls
14 Done
15 Starting
15 Received /bin/ls
15 Done
16 Starting
16 Received /bin/ls
16 Done
17 Starting
17 Received /bin/ls
17 Done
18 Starting
18 Received /bin/ls
18 Done
19 Starting
19 Received /bin/ls
19 Done

In the sample, I have sorted it out per the task which was started. Received is 
any stderr or stdin output from the task ran. In this example, I am running 
/usr/bin/which ls as it's simple and runs quickly.

My thinking is there is some sort of buffer on the NSPipe and by the time the 
task quits, the buffer ether didn't receive the data or it hasn't prepared it 
for sending the notification.

Can anyone help me out with this issue? It's been bugging me for hours.

Thanks,
Mr. Gecko
___

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

Please do not post 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: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Wim Lewis

On 31 Jul 2012, at 3:33 PM, Mr. Gecko wrote:
 I am having weird results with NSTask. It sometimes retrieves the output, and 
 other times receives nothing.

I haven't looked at the code you posted, but is it possible that you're reading 
from the NSPipe in such a way that you're mixing up the end-of-file 
indication with the no more data is available right now, but may arrive later 
indication? That's a common reason for this kind of problem.

 My thinking is there is some sort of buffer on the NSPipe and by the time the 
 task quits, the buffer ether didn't receive the data or it hasn't prepared it 
 for sending the notification.

IIRC, NSPipe simply wraps a Unix pipe, which will hold unread data even after 
the writer closes its end of the pipe (that is, the writer can write some data 
and exit before the reader reads anything, and the reader will still get all 
the data followed by EOF).



___

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

Please do not post 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: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Mr. Gecko
What do you recommend after the task finishes? I have tried [[outPipe 
fileHandleForReading] readDataToEndOfFile] after the task finishes and it 
doesn't seem to improve. Can you maybe give me an example of how to do this 
right?

On Jul 31, 2012, at 6:01 PM, Wim Lewis w...@omnigroup.com wrote:

 I haven't looked at the code you posted, but is it possible that you're 
 reading from the NSPipe in such a way that you're mixing up the end-of-file 
 indication with the no more data is available right now, but may arrive 
 later indication? That's a common reason for this kind of problem.
 
 IIRC, NSPipe simply wraps a Unix pipe, which will hold unread data even after 
 the writer closes its end of the pipe (that is, the writer can write some 
 data and exit before the reader reads anything, and the reader will still get 
 all the data followed by EOF).

___

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

Please do not post 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: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Kyle Sluder
On Tue, Jul 31, 2012, at 03:33 PM, Mr. Gecko wrote:
 I am having weird results with NSTask. It sometimes retrieves the output,
 and other times receives nothing.
 
 I have example code for this issue at
 https://dl.dropbox.com/u/610721/NSTask%20Issue.zip

NSTask requires a running runloop. Your code is a plain-ol' Foundation
tool and doesn't have a runloop.

I wouldn't be surprised if NSPipe has the same requirement.

--Kyle Sluder
___

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

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

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

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


Re: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Mr. Gecko
I have multiple run loops.

On the main thread I have [[NSRunLoop currentRunLoop] run];

On the sub threads for NSTask and NSPipe, I have 
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, YES);

If you are saying that you have to use NSRunLoop in order for it to work, get 
it working in my example and have the run loop stop running.

I tried multiple things as well.

[[NSRunLoop currentRunLoop] runUntilDate:[NSDate 
dateWithTimeIntervalSinceNow:1]];

I tried using CFRunLoopRun();
I tried using CFRunLoopStop(CFRunLoopGetCurrent()) to stop [[NSRunLoop 
currentRunLoop] run];

I am really getting nowhere. If you really think you know how to fix it, do so 
in the code and report back to me with working code. Don't make guess work as 
this has been bugging me for hours and I think I tried pretty much everything 
possible. I have not attempted to use c libraries to interact with the NSPipe.

I can confirm if you do not stop the run loop, it will get everything… However… 
I cannot do this as I do not know how much data I am receiving from the task.

Is there a way to have NSPipe read until it actually reaches the end of file? 
What I have tried so far doesn't seem to work.

Thanks for helping me with this crazy task.

On Jul 31, 2012, at 7:14 PM, Kyle Sluder k...@ksluder.com wrote:

 NSTask requires a running runloop. Your code is a plain-ol' Foundation
 tool and doesn't have a runloop.
 
 I wouldn't be surprised if NSPipe has the same requirement.
 
 --Kyle Sluder


___

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

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

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

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

Re: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Kyle Sluder
On Jul 31, 2012, at 6:53 PM, Mr. Gecko grmrge...@gmail.com wrote:

 
 I can confirm if you do not stop the run loop, it will get everything… 
 However… I cannot do this as I do not know how much data I am receiving from 
 the task.

1) Yes, you need to run the run loop forever (NSDistantFuture).

2) You don't need to know in advance how much data you need to read. Just stop 
running the run loop when you're done.

3) Why are you using threads at all? You should just be able to fire off an 
NSTask from the main thread and let its run loop take care of notifying you.

--Kyle Sluder
___

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

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

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

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

Re: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Mr. Gecko
I need threads because the main thread is a network loop waiting for a 
connection and when it gets a connection, it spawns a thread like in my 
example. I need to be able to respond to the client with all the data from the 
task and I need to close out the connection and release the spawned 
thread/object.

I need to do this in a reasonable amount of time as well. I cannot just slow 
down the speed by 1 second as that makes the response to the client 1 second 
slower.

Do you recommend that I work with C APIs to make my own NSTask which works?

In response to number 2, how can I stop the run loop and how could I know when 
I got everything? I don't have any way to verify I got everything.

On Jul 31, 2012, at 9:00 PM, Kyle Sluder k...@ksluder.com wrote:

 1) Yes, you need to run the run loop forever (NSDistantFuture).
 
 2) You don't need to know in advance how much data you need to read. Just 
 stop running the run loop when you're done.
 
 3) Why are you using threads at all? You should just be able to fire off an 
 NSTask from the main thread and let its run loop take care of notifying you.
 
 --Kyle Sluder


___

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

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

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

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


Re: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Jens Alfke

On Jul 31, 2012, at 7:43 PM, Mr. Gecko grmrge...@gmail.com wrote:

 I need threads because the main thread is a network loop waiting for a 
 connection and when it gets a connection, it spawns a thread like in my 
 example. I need to be able to respond to the client with all the data from 
 the task and I need to close out the connection and release the spawned 
 thread/object.

You don't need threads for this, as long as you use asynchronous I/O.

 In response to number 2, how can I stop the run loop and how could I know 
 when I got everything? I don't have any way to verify I got everything.

You know you got everything when the pipe connected to the task's stdout 
reaches EOF.

You might find MYTask useful: it's a general-purpose wrapper around NSTask that 
I wrote a few years ago (while writing a Mercurial client that did its work by 
invoking the hg tool.) It was surprisingly difficult to get everything to 
work right.
https://bitbucket.org/snej/myutilities/src/319441e240fa/MYTask.m
You're welcome to copy it (it's under a BSD license) or just use it as sample 
code to figure out how to use NSTask asynchronously.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


MKMapView annotation changes not being reflected on map display. Baffling.

2012-07-31 Thread Gavin Stokes
We have a problem where some underlying data changes, so we go through
the annotation collection for a mapview and change the affected
annotation (in this case its title); and when the associated marker on
the map is tapped, the displayed text isn't changed.

In other cases, an annotation is deleted entirely, and the marker
remains on the map.

Even better, this only happens on one (remote, non-programming) team
member's device and not mine.

I've seen erratic behavior from these markers before, where they
seemingly won't get updated if the underlying annotation collection is
changed while the map is not on the screen.

Has anyone seen behavior like this or have any guesses?

Thanks!

Gavin
___

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

Please do not post 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: Repositioning another app's windows?

2012-07-31 Thread Jerry Krinock

On 2012 Jul 28, at 21:48, Lee Ann Rucker lruc...@vmware.com wrote:

 Use Accessibility. There's a utility called Moom that does that.

or AppleScript; moving windows is in the Standard Suite, so I think any app 
which announces itself as scriptable can have its windows moved.

Neither way is 100% reliable.  Accessibility probably requires that Enable 
Access for assistive devices be on in System Preferences.  I don't see why we 
have that stupid checkbox.  At least, in 10.8 it's on by default in a new 
account.


___

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

Please do not post 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: NSTask and NSPipe has buffering issues?

2012-07-31 Thread Ken Thomases
NSPipe itself doesn't require that a run loop be run, but the 
InBackgroundAndNotify methods of the associated NSFileHandle objects do.

You receive a zero-length NSData when (and only when) a read encounters EOF.

There is an inherent race between the receipt of the task termination 
notification and getting end-of-file on the output and error pipes.  This race 
is not in Cocoa, it's in the kernel and the interprocess communication 
mechanisms.  You can't rely on having received all of the data by the time you 
are notified of the task termination.

You should separately track when NSTask has posted the termination notification 
and when each pipe has gotten EOF.  Keep looping around the run loop until *all 
three* things have happened.  (In other words, generalize from your running 
variable.  You had the right idea but hadn't covered all of the important 
parts.)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: FSEvents eventid (or perhaps event)'s life

2012-07-31 Thread Michael Watson
On 30 Jul, 2012, at 17:53, Ron Hunsinger wrote:

 
 On Jul 30, 2012, at 4:47 AM, Robert Martin robmar...@frontiernet.net wrote:
 
 Just keep track of the device UUID for each path and last event ID that 
 you're tracking. EventID's are tied to each device, so you have to know that 
 the device has not changed behind your back. For example, this can happen if 
 the user has switched to a cloned backup drive containing the folders you 
 are tracking. If the UUID's don't match, you can alert the user and rebuild 
 whatever it is you're doing.
 
 What you need to track is the UUID of the FSEventStore, together with the 
 last event ID.
 
 That is, there are three relevant IDs:
   The volume itself has a UUID
   Each volume has its own FSEventStore, with its own UUID
   There is an event ID, that is meaningful only with respect to its 
 particular FSEventStore
 
 The FSEventStore gets invalidated and discarded at the slightest hint of 
 trouble; most commonly any time the volume is not unmounted properly. A 
 system crash, of course, fails to unmount any volume correctly, so it 
 invalidates the FSEventStores of all volumes mounted at the time. A full OS 
 install seems to also invalidate the FSEventStore.
 
 The volume's UUID persists across all those things, but not across an erase. 
 You can use it to be sure you're referring to the proper volume.
 
 You can get the volume's UUID from diskutil info. You can read the 
 FSEventStoreUUID from /.fseventsd/fseventsd-uuid

FSEventsCopyUUIDForDevice is the correct way to read the event store UUID.


- m



 
 -Ron Hunsinger
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/mikey-san%40bungie.org
 
 This email sent to mikey-...@bungie.org


___

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

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

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

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


Sorting NSArray -- advice on how to accomplish a simple alpha ordering?

2012-07-31 Thread Erik Stainsby
The NSSortDescriptor documentation seems especially opaque to me tonight. 
Surely there is a useful short description somewhere … ?  *whimper*


___

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

Please do not post 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: Sorting NSArray -- advice on how to accomplish a simple alpha ordering?

2012-07-31 Thread Graham Cox

On 01/08/2012, at 3:01 PM, Erik Stainsby wrote:

 The NSSortDescriptor documentation seems especially opaque to me tonight. 
 Surely there is a useful short description somewhere … ?  *whimper*


Sort descriptors are quite easy to use - what's the specific problem?


warning: typed into Mail:

NSSortDescriptor* desc = [NSSortDescriptor sortDescriptorWithKey:@compare: 
ascending:YES];

[myArray sortUsingDescriptors:[NSArray arrayWithObject:desc]];  //-- myArray 
assumed to be an NSMutableArray



note that for this simple case, using a sort descriptor might not the most 
efficient solution.




--Graham



___

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

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

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

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

Re: Sorting NSArray -- advice on how to accomplish a simple alpha ordering?

2012-07-31 Thread Graham Cox

On 01/08/2012, at 3:07 PM, Graham Cox wrote:

 NSSortDescriptor* desc = [NSSortDescriptor sortDescriptorWithKey:@compare: 
 ascending:YES];


Oops, this wasn't what I meant.

The key should be the property you're comparing to sort the objects. If your 
array is a bunch of strings to be sorted, then what is the key? Well, it's 
actually self:

NSSortDescriptor* desc = [NSSortDescriptor sortDescriptorWithKey:@self 
ascending:YES];

Because internally the descriptor is looping over the array and doing a 
-valueForKey:@self on each object, and that returns the object itself. The 
sort comparison itself is done by invoking -compare: on the objects.


If it's another sort of object that has a string property, then you would pass 
the name of that property, e.g. @lastName.

--Graham


___

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

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

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

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


Re: Sorting NSArray -- advice on how to accomplish a simple alpha ordering?

2012-07-31 Thread Erik Stainsby
This has me thinking that to get the alpha sorted list of keys from a 
dictionary I should be passing the keypath as the param for 
sortDescriptorWithKey: and not trying to externalize the keys into an array 
first … ?


On 2012-07-31, at 10:13 PM, Graham Cox graham@bigpond.com wrote:

 
 On 01/08/2012, at 3:07 PM, Graham Cox wrote:
 
 NSSortDescriptor* desc = [NSSortDescriptor sortDescriptorWithKey:@compare: 
 ascending:YES];
 
 
 Oops, this wasn't what I meant.
 
 The key should be the property you're comparing to sort the objects. If 
 your array is a bunch of strings to be sorted, then what is the key? Well, 
 it's actually self:
 
 NSSortDescriptor* desc = [NSSortDescriptor sortDescriptorWithKey:@self 
 ascending:YES];
 
 Because internally the descriptor is looping over the array and doing a 
 -valueForKey:@self on each object, and that returns the object itself. The 
 sort comparison itself is done by invoking -compare: on the objects.
 
 
 If it's another sort of object that has a string property, then you would 
 pass the name of that property, e.g. @lastName.
 
 --Graham
 
 


___

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

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

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

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

Re: Sorting NSArray -- advice on how to accomplish a simple alpha ordering?

2012-07-31 Thread Graham Cox

On 01/08/2012, at 3:20 PM, Erik Stainsby wrote:

 This has me thinking that to get the alpha sorted list of keys from a 
 dictionary I should be passing the keypath as the param for 
 sortDescriptorWithKey: and not trying to externalize the keys into an array 
 first … ?


If you want to iterate over the contents of a dictionary in alphabetical order 
of keys, I don't think there is a magic keypath that will allow you to operate 
on the dictionary itself.

Your first thought was right:

NSMutableArray  * sortedKeys =[ [dictionary allKeys] mutableCopy];
[sortedKeys sortUsingDescriptors:descriptors];//--- create 
descriptor using key @self or else using an alternative means of sorting

// now you can iterate over the dictionary in alphabetical order.


I would only use sort descriptors if a) I had to sort based on more than one 
criterion, e.g. lastName, firstName or b) I was using a table view that manages 
sorting using descriptors. For simple sorts there are easier ways to do it.


--Graham



___

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

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

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

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

Re: MKMapView annotation changes not being reflected on map display. Baffling.

2012-07-31 Thread Gavin Stokes
Never mind.  The problem was an incomplete array of annotations I was maintaing.
___

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

Please do not post 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