How to restrict an app to run from harddisk

2012-05-22 Thread Abhijeet Singh
Hi,How can I check whether my application is running from Harddisk or from a 
removable media (CD, USB drive...). I used [[NSWorkspace sharedWorkspace] 
getFileSystemInfoForPath:path isRemovable:&isRem isWritable:&isWritable 
isUnmountable:&isUnmountable description:&description type:&type] method and 
used the "isRemovable" parameter to check whether it is removable media or not. 
It works fine if i directly copy my app to HDD, CD or USB drive. But if I 
create a disk image of my application and keep it on har disk and then I run my 
app from disk image the isRemovable parameter still shows that it is running 
from removable media and that's not true. My purpose is I dont want my user to 
run my application from Hard Disk. Please suggest some way to achieve 
this.Thanks & RegardsAbhijeetGet Yourself a cool, short @in.com Email ID now!
___

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

Please do not post 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: Bidirectional, Manual Binding in custom control

2012-05-22 Thread Jerry Krinock

On 2012 May 21, at 21:52, Quincey Morris wrote:

> This seems more or less the correct approach to defining a custom binding. 
> "More or less" because you may have committed some minor technical violation 
> of custom binding implementations, described unintelligibly in this document:
> 
>   
> https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html
> 
> However, it's not particularly clear what benefit it brings you to implement 
> a custom binding, since there's no practical way any more (AFAIK) to use 
> custom bindings in IB.

Thank you, Quincey.  Yes, I know about that – arghhh – IB limitation.  That's 
why I -bind in the window controller's -awakeFromNib.

> With a code-based approach, it may be easier and clearer just to implement 
> the two halves of the behavior directly:

Yes, I see what you mean.  This may be one of those cases where Cocoa Bindings 
makes life more difficult instead of easier.

In this case, I kind of like the binding though, because all of the other 
fields in this Inspector window use bindings, and I'd rather not break the 
pattern.  I'll read "How Do Bindings Work" and see if I can find any "technical 
violations".

Jerry

(For sake of list archives, for anyone else who wants to try this, there's an 
important detail I left out of my original post.  Remember to -unbind: in the 
window controller's -windowWillClose or -dealloc, or you'll get exceptions 
and/or crashes.  I do it in both methods, calling a method which also removes 
other observers.  I use an instance variable, m_isObserving, to keep track of 
whether or not my bindings and observers are active.)
___

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

Please do not post 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 restrict an app to run from harddisk

2012-05-22 Thread Scott Ribe
On May 22, 2012, at 3:50 AM, Abhijeet Singh wrote:

> ...I run my app from disk image the isRemovable parameter still shows that it 
> is running from removable media and that's not true.

Well, yes it is. The disk image is unmountable. Maybe the system's definition 
of removable is different than yours, but really how do you define this for 
virtual media.

> My purpose is I dont want my user to run my application from Hard Disk. 
> Please suggest some way to achieve this.

Inherently stupid, user-hostile, unenforceable requirement--give it up? Or 
accept the limitation that a disk image is always removable. Or go to extreme 
lengths to use lower-level calls to determine that the volume is a disk image, 
then find out where it's located, then check the containing disk type.

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


MapKit overlay tip

2012-05-22 Thread Alex Zavatone
Just wanted to pass on this little pearl I just discovered in the case that it 
might help someone else.

I've got a bunch of images that I'm using as mapKit mapView overlays for iOS 
devices and of course was interested in having them be as small as possible and 
load as fast as possible.

So, I took all the PNGs and converted them to JPEGs at varying compression 
sizes and got them nice and small.

Map drawing time went up terribly and the images and maps started slowly 
chunking in on the devices.  

Don't use JPEGs.  Use PNGs.  it's a world of difference in map drawing 
performance.

Hope this tip/warning helps someone.

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


Re: MapKit overlay tip

2012-05-22 Thread Conrad Shultz
On 5/22/12 12:52 PM, Alex Zavatone wrote:
> Just wanted to pass on this little pearl I just discovered in the
> case that it might help someone else.
> 
> I've got a bunch of images that I'm using as mapKit mapView overlays
> for iOS devices and of course was interested in having them be as
> small as possible and load as fast as possible.
> 
> So, I took all the PNGs and converted them to JPEGs at varying
> compression sizes and got them nice and small.
> 
> Map drawing time went up terribly and the images and maps started
> slowly chunking in on the devices.
> 
> Don't use JPEGs.  Use PNGs.  it's a world of difference in map
> drawing performance.
> 
> Hope this tip/warning helps someone.

Note that as part of the build and bundling process, Xcode runs PNGs
through pngcrush, which does a variety of optimizations that reduce file
size and, I believe, do some hardware-specific decoding optimizations.
The upshot of this is that a comparison of raw PNG and JPG files is
totally meaningless; you would have to actually look at the
post-pngcrush output, and even this wouldn't tell the whole story.

If you are doing performance tuning, you should take a look at the
pertinent documentation (e.g.
https://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/PerformanceTuning/PerformanceTuning.html).
 There and in other docs Apple explicitly notes that PNG is "the
preferred image format for iOS apps."

(Something I hadn't really thought about is that this would suggest
different performance for PNGs that are downloaded by an app versus
those that are included at build-time.  Does anyone know whether there
is a noticeable difference?)

-- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.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


NSTextView row number

2012-05-22 Thread ecir hana
Hello,

I have a NSTextView and would like to keep track of where the cursor is in
terms of a line number. Please, is there a way to figure this out somehow
(akin ti lineRangeForRange:) or do I have to calculate it myself, e.g. by
caching newlines locations?
___

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

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


PDFThumbnailView Problem (kind of)

2012-05-22 Thread Matthew Weinstein
Dear Cocoa-gurus,
I have a typical thumbnailview on a drawer and a pdfview in main window. I have 
a category that lets me drag and drop a pdf onto the pdfview; it then gets the 
url and sets a pdfdocument to that url; sets the pdfview and sets the 
thumbnailview to the pdfview.

It "seems" to work; but I can't click on the thumbnails; they're there, but not 
clickable, until I resize the window, then all is well. 

Any idea of what's going on and what I need to do to "liberate" my 
thumbnailview (I've tried sending a setNeedsDisplay:-- Nada).

Matthew Weinstein


___

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

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


group row custom drawing nstableview

2012-05-22 Thread Rick C.
Hi,

I'm having some trouble doing a custom drawing for my group row in a view-based 
nstableview.  First of all I subclassed NSTableRowView is this correct?  And if 
so the problem I'm having is to recreate the floating effect which normally 
happens automatically if using a standard NSTableCellView.  I'm able to get the 
isFloating property, but I'm not sure what's the correct way to make the row 
float (setAlpha?) without making the text "float" as well?  Any pointers to get 
me going in the right direction here would be much appreciated.  Thanks!

rc
___

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

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

2012-05-22 Thread Jens Alfke

On May 22, 2012, at 3:14 PM, ecir hana wrote:

> I have a NSTextView and would like to keep track of where the cursor is in
> terms of a line number. Please, is there a way to figure this out somehow
> (akin ti lineRangeForRange:) or do I have to calculate it myself, e.g. by
> caching newlines locations?

Ask the view's NSLayoutManager.

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

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

Re: PDFThumbnailView Problem (kind of)

2012-05-22 Thread Antonio Nunes
On 23 May 2012, at 03:53, Matthew Weinstein wrote:

> I have a typical thumbnailview on a drawer and a pdfview in main window. I 
> have a category that lets me drag and drop a pdf onto the pdfview; it then 
> gets the url and sets a pdfdocument to that url; sets the pdfview and sets 
> the thumbnailview to the pdfview.
> 
> It "seems" to work; but I can't click on the thumbnails; they're there, but 
> not clickable, until I resize the window, then all is well. 
> 
> Any idea of what's going on and what I need to do to "liberate" my 
> thumbnailview (I've tried sending a setNeedsDisplay:-- Nada).

I've had a similar issue (and there are other issues with PDFThumbnailView that 
you may or may not run into). This is how I worked around it:
self.thumbnailView.PDFView = self.previewCanvas;
dispatch_async(dispatch_get_main_queue(), ^{
self.thumbnailView.thumbnailSize = 
self.thumbnailView.thumbnailSize;
});

Simply setting the thumbnail size causes the thumbnail view to straighten 
itself out.

-António


There is a world of difference between
searching for happiness and choosing
to be happy.






___

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

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