Re: Write Finder plugin

2012-07-13 Thread Eric Schlegel

On Jul 12, 2012, at 10:45 PM, Rakesh Singhal rakesh.sing...@gmail.com wrote:

 Hi Eric,
 
 Thanks. I am trying to do it using Services but I couldn't find any sample 
 code.  Can I do it in python?

No, you can only write a Service with Objective C. You can read about 
implementing a service here: 
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/SysServices/introduction.html.

-eric


___

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

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

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

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


Re: Write Finder plugin

2012-07-13 Thread Nathan Day
You can do this with Services if you are willing to have it in the services 
menu of the contextual menu, the user has to enable your service by going to 
System Preferences  Keyboard  Keyboard Shortcuts, you may be able to 
AppleScript that. If you are just writing scripts for you own use that you want 
to use from the Contextual Menu, do a google search for Mac Services 
AppleScripts. I think there is at least 1 app that lets you run scripts as 
services.

Doing it in Cocoa is pretty straight forward.

On 13/07/2012, at 3:45 PM, Rakesh Singhal rakesh.sing...@gmail.com wrote:

 Hi Eric,
 
 Thanks. I am trying to do it using Services but I couldn't find any sample
 code.  Can I do it in python?
 
 Regards,
 Rakesh Singhal
 
 On Tue, Jul 3, 2012 at 12:09 AM, Eric Schlegel eri...@apple.com wrote:
 
 
 On Jul 2, 2012, at 9:53 AM, Rakesh Singhal rakesh.sing...@gmail.com
 wrote:
 
 There are applications (eg. dropbox) which are able to create items in
 finder's contextual menu, not service. There should be some way to do it.
 
 There is no supported way to do this. Dropbox uses various hacks to make
 its way into the Finder process. Frequently, the current version of Dropbox
 is incompatible with a new release of Mac OS X and has to be disabled.
 Don't use them as a model.
 
 -eric
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.com
 
 This email sent to nathan_...@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: Write Finder plugin

2012-07-13 Thread Uli Kusterer
On 13.07.2012, at 08:43, Nathan Day wrote:
 You can do this with Services if you are willing to have it in the services 
 menu of the contextual menu, the user has to enable your service by going to 
 System Preferences  Keyboard  Keyboard Shortcuts, you may be able to 
 AppleScript that. If you are just writing scripts for you own use that you 
 want to use from the Contextual Menu, do a google search for Mac Services 
 AppleScripts. I think there is at least 1 app that lets you run scripts as 
 services.


 IIRC, if you set the flags correctly in the Info-plist, your service's item 
will automatically be activated. Only old-style services need to be activated 
explicitly. Others show up as soon as their context matches (e.g. the selected 
file has the UTI that your service expects as input).

Cheers,
-- Uli Kusterer
Die Zeugen des TeachText sind überall...
http://www.wiederholungstaeter-podcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Load UIWebView with new content

2012-07-13 Thread Vavelin Kevin
Hi there,

I want to refresh my webView when I add something that i've write in 
javascript with 
stringByEvaluatingJavaScriptFromString: .

But when I call the method my html is still the same. I want to reload my html 
page and just modify one thing with javascript. Do you have any idea of how I 
can do it ?

Thanks in advance for your answers.

Vavelin Kévin
Twitter | Blog | LinkedIn 
Entrepreneur
Developer OS X / iOS

___

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

Please do not post 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: Load UIWebView with new content

2012-07-13 Thread Erik Stainsby
You need to use -loadHtmlString:


Time Dwarf,
Roaring Guy

On 2012-07-13, at 4:51 AM, Vavelin Kevin vavelinke...@gmail.com wrote:

 Hi there,
 
 I want to refresh my webView when I add something that i've write in 
 javascript with 
 stringByEvaluatingJavaScriptFromString: .
 
 But when I call the method my html is still the same. I want to reload my 
 html page and just modify one thing with javascript. Do you have any idea of 
 how I can do it ?
 
 Thanks in advance for your answers.
 
 Vavelin Kévin
 Twitter | Blog | LinkedIn 
 Entrepreneur
 Developer OS X / iOS
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/erik.stainsby%40roaringsky.ca
 
 This email sent to erik.stain...@roaringsky.ca

___

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

Please do not post 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: Write Finder plugin

2012-07-13 Thread Mark Munz
But the OP *could* create a Workflow OS X Services Item that has a Run
Shell Script action with a python script.

On Thu, Jul 12, 2012 at 11:16 PM, Eric Schlegel eri...@apple.com wrote:

 On Jul 12, 2012, at 10:45 PM, Rakesh Singhal rakesh.sing...@gmail.com wrote:

 Hi Eric,

 Thanks. I am trying to do it using Services but I couldn't find any sample 
 code.  Can I do it in python?

 No, you can only write a Service with Objective C. You can read about 
 implementing a service here: 
 https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/SysServices/introduction.html.

 -eric


 ___

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

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

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

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



-- 
Mark Munz
unmarked software
http://www.unmarked.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


Core Data Multiuser

2012-07-13 Thread Flavio Donadio
Hello, people!


I'll bring this subject to surface again. I know it pops here and there from 
time to time, but I've never seen anything conclusive, besides advice to steer 
off this idea.

For a long time, I have wanted to develop a pseudo-CRM software for my small 
business. It will be used for simple things, like managing customer and product 
data, sending quotes and invoices and stuff like that. I need it to be 
multiuser and I am fed up with web-based software. We use only Macs. Period.

From what I've read in this and other lists, and also lots of forums, Core Data 
wasn't meant for multiuser access and I understand it. But...

I am reading Marcus Zarra's book on Core Data (Core Data - Apple’s API for 
Persisting Data on Mac OS X) and I have to say the book is excellent. And it 
got me thinking about this project again.

One of the problems in using Core Data with multiple users accessing the same 
persistent store is concurrency. But I've seen techniques for that, such as 
using multiple MOCs. Marcus Zarra's book talks about it in chapter 9, about 
multithreading. I've seen it in Apple's documentation also.

On chapter 11, the book talks about distributed Core Data, using Distributed 
Objects to exchange NSManagedObjects between a client app and a server app. The 
latter deals with the MOC and the persistent store. Zarra warns about 
scalability problems, since NSManagedObjectContext is not thread-safe and, the, 
all clients' data would be dealt with serially... But, what if I used one MOC 
per client?

What do you guys think about it? Is it a bad idea? I've studied a lot of 
alternatives (BaseTen, ODBC, Web Services), but I can't wrap my head around 
them...


Cheers,
Flavio
___

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

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

Custom NSTextAttachment

2012-07-13 Thread Alexander Reichstadt
Hi,

trying to build a custom subclass of NSTextAttachment I thought it would be 
fully supported in an NSTextView.

In a test project at app launch I insert an attachment:

[_textView setString:@This is a test string\rThis is a test string\rThis 
is a test string\rThis is a test string\rThis is a test string\rThis is a test 
string\rThis is a test string\rThis is a test string\rThis is a test 
string\rThis is a test string\r];
TATextAttachment *att = [[TATextAttachment alloc] init];
NSAttributedString *as = [NSAttributedString 
attributedStringWithAttachment:att];
[[_textView textStorage] appendAttributedString:as];

In the attachment I draw a custom cell. It all works so far, but when I select 
a text that contains that custom attachment and drag the selection to another 
location, only the text without the custom attachment cell icon is inserted at 
the new location.

When dragging a text that contains a regular NSTextAttachment it gets dragged 
and dropped as a file icon in the new location.

Why?

Alex
___

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

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


-[NSFileHandle readInBackgroundAndNotify] opens the file again

2012-07-13 Thread Rick Mann
I'm using NSFileHandle in an ARC app on OS X Lion to read from a serial port.

Everything works fine 'till I go to close the port. I open the port with POSIX 
calls, set up some stuff, then instantiate an NSFileHandle with the file 
descriptor I got from open().

Then I call -readInBackgroundAndNotify, and a second file descriptor gets 
opened (I see this by using lsof).

That FD gets closed the moment some data comes in and a notification gets 
posted, but I just go right back and call -readInBackgroundAndNotify again to 
get the next data.

The problem is when I go to close the port. I still have a pending 
-readInBackgroundAndNotify, and so the port is opened twice. When I call 
-closeFile on the NSFileHandle, it closes the FD I initially opened, but leaves 
the second FD open.

I tried setting the NSFileHandle reference to nil so that ARC would release it, 
and hopefully call -dealloc on it, but either it's not doing that, or -dealloc 
doesn't close that second FD either.

In any case, when I go to open that port again, I get an error saying the 
resource is busy (if I quit my app, all FDs get closed).

This sure seems like a bug to me. Am I doing something wrong?

Thanks,
Rick


___

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

Please do not post 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: Binding NSTableView to NSSet

2012-07-13 Thread Koen van der Drift
A follow up question: how do I now sort the data in the table? I am showing 
three values in the table, and like to sort based on either one of them. The 
original data is in an unordered NSSet (from my CD model). I could create an 
NSArray in my view controller: NSArray *myArray = [myTagsSet allObjects], and 
bind that to the NSArrayController, instead of to the NSSet; then I can sort 
the values in the table based on the array using sortDescriptors as explained 
here: 
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/SortingTableViews/SortingTableViews.html#//apple_ref/doc/uid/1026i-CH10-SW1.
Would that be a good approach?

Other alternatives?

OSX, 10.7.

Thanks,

- Koen.





On Jul 4, 2012, at 5:59 PM, Koen van der Drift wrote:

 Ok, I found the solution.
 
 I added an NSArrayController to the nib, of which I bound the content set to 
 the NSSet of my model.  Then I bound the NSTableView to the 
 NSArrayController, and the views to the various attributes through the 
 objectVAlue.
 
 - Koen.
 
 
 On Jul 4, 2012, at 1:46 PM, Koen van der Drift wrote:
 
 Hi,
 
 I am trying to hookup a view based NSTableView to my CoreData model using 
 bindings.  The table should display various attributes of the entity 'Tags', 
 which has a many-to-one relationship with my main entity. In my code I can 
 see that the Tags entities are valid using NSLog statements, however I fail 
 to use the correct binding to hook it up to the table. From the docs (at 
 https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/PopulatingViewTablesWithBindings/PopulatingView-TablesWithBindings.html#//apple_ref/doc/uid/1026i-CH13-SW1),
  I see I need to bind the table to an NSArrayController, however, my Tags 
 are an NSSet.
 
 How do I solve this?
 
 Thanks,
 
 - Koen.
 


___

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

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


NSTableView Sends Null Column to Delegate/DataSource

2012-07-13 Thread Keary Suska
I am having a strange issue I haven't encountered before--for all of my data 
source and delegate methods the table view is sending nil for the table column, 
which obviously prevents me from fulfilling any of the requests. Has anyone 
seen this?

Xcode 4, targeting 10.6.

TIA,

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


___

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

Please do not post 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: NSTableView Sends Null Column to Delegate/DataSource

2012-07-13 Thread John Terranova
A nil tableColumn means to treat the whole row as one wide column, rather than 
the individual columns. It is useful for section headers. The docs for the 
applicable methods should explain the nil tableColumn. 

john

Sent from my iPhone

On Jul 13, 2012, at 11:21 PM, Keary Suska cocoa-...@esoteritech.com wrote:

 I am having a strange issue I haven't encountered before--for all of my data 
 source and delegate methods the table view is sending nil for the table 
 column, which obviously prevents me from fulfilling any of the requests. Has 
 anyone seen this?
 
 Xcode 4, targeting 10.6.
 
 TIA,
 
 Keary Suska
 Esoteritech, Inc.
 Demystifying technology for your home or business
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/johnte%40mac.com
 
 This email sent to joh...@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