Re: Retrieve all available Finder tags on Monterey and later

2023-02-16 Thread Leo Revzin via Cocoa-dev

Solution found - credit goes to Thomas Tempelmann and James Walker:

sqlite3 
~/Library/SyncedPreferences/com.apple.kvs/com.apple.KeyValueService-Production.sqlite 
"SELECT writefile('path/to//tags.plist', ZPLISTDATAVALUE) FROM 
ZSYDMANAGEDKEYVALUE WHERE ZKEY = 'FinderTagDict';"

___

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


Retrieve all available Finder tags on Monterey and later

2023-01-09 Thread Leo Revzin via Cocoa-dev
I wonder if anyone has figured out a way to retrieve ALL available 
Finder tags on Monterey and later?


On pre-Monterey systems, it was possible by reading this file:

~/Library/SyncedPreferences/com.apple.finder.plist

However, this file doesn't exist anymore.

Other methods (such as reading Finder prefs or fileLabels of 
NSWorkspace) only return the 8 standard labels - but not any custom tags 
created by the user.


Googling the subject didn't produce any results.


Thanks for any info,
Leo
___

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: 'altool' cannot be found

2019-06-16 Thread Leo via Cocoa-dev



Thanks Keary,

You helped me solve the issue.

altool was indeed in this folder:

/Applications/Xcode.app/Contents/Developer/usr/bin/

However, xcode-select -p returned /Library/Developer/CommandLineTools

I reset the path with xcode-select -r.

Now everything seems to work.


Thanks,
Leo





On 6/15/19 9:56 AM, Keary Suska wrote:

I am using that Xcode version and for a while now all Xcode utilities and 
command line tools are installed in the Xcode app package. My copy is at 
/Applications/Xcode.app/Contents/Developer/usr/bin/altool. Do you find it in 
that location?

If so, xcrun should be able to find it. If you run xcode-select -p does it show 
the expected path?

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


On Jun 15, 2019, at 12:12 AM, Leo via Cocoa-dev  
wrote:


Hi all,

I wanted to start building a notarization automation script.

However, when I try to use the 'xcrun altool' in Terminal, I get the following 
error:

xcrun: error: unable to find utility "altool", not a developer tool or in PATH

I'm on macOS 10.14.5, Xcode 10.2.1.

I then especially downloaded and installed Xcode Command Line Tools - still get 
same error.

Other tools like stapler do work.

I checked this dir and altool is not there: 
/Library/Developer/CommandLineTools/usr/bin

Any idea what's going on?


Thanks for any help!

Leo
___

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/cocoa-dev%40esoteritech.com

This email sent to cocoa-...@esoteritech.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


'altool' cannot be found

2019-06-15 Thread Leo via Cocoa-dev



Hi all,

I wanted to start building a notarization automation script.

However, when I try to use the 'xcrun altool' in Terminal, I get the 
following error:


xcrun: error: unable to find utility "altool", not a developer tool or 
in PATH


I'm on macOS 10.14.5, Xcode 10.2.1.

I then especially downloaded and installed Xcode Command Line Tools - 
still get same error.


Other tools like stapler do work.

I checked this dir and altool is not there: 
/Library/Developer/CommandLineTools/usr/bin


Any idea what's going on?


Thanks for any help!

Leo
___

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 get log from user

2019-06-15 Thread Leo via Cocoa-dev


___

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: Notarization error: The signature algorithm used is too weak

2019-05-30 Thread Leo via Cocoa-dev





On 5/29/19 1:53 PM, Richard Charles wrote:

On May 28, 2019, at 8:18 PM, Leo via Cocoa-dev  
wrote:

Can you please elaborate on this...

Perhaps this will help.

https://stackoverflow.com/questions/25152451/are-mac-app-store-code-sign-resource-envelopes-always-version-1


Thanks Richard,

The issue is now solved - thanks to someone's advice on Stack Overflow:

https://stackoverflow.com/questions/56351428/macos-notarization-error-the-signature-algorithm-used-is-too-weak 


I need to sign the actual framework first, then re-package it as tar.gz.

I added this process as Run Script phase in Xcode - and the app is 
finally notarized.



Leo
___

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: Is the list alive?

2019-05-29 Thread Leo via Cocoa-dev



On 5/29/19 9:02 AM, Steve Mills via Cocoa-dev wrote:

On May 28, 2019, at 19:46:26, Leo via Cocoa-dev  
wrote:


Hmm... my earlier message today never got through.

Supposedly, these lists are to be done away with at some point. Someone started 
co...@apple-dev.groups.io, which many of us have moved to. Or use the annoying 
and inferior dev forums.developer.apple.com.

--
Steve Mills
Drummer, Mac geek


Thanks for the info.

Now I see that my emails do get through - however, it takes HOURS for 
them to show up (like 5+ hours).


I wonder if it's normal - or should I adjust something on my end?


Leo
___

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: Notarization error: The signature algorithm used is too weak

2019-05-29 Thread Leo via Cocoa-dev





On 5/28/19 9:26 PM, Richard Charles wrote:

On May 28, 2019, at 3:43 PM, Leo via Cocoa-dev  
wrote:

-I recently contacted Apple again and they pointed me to some resource page 
that was created back in 2016. It briefly mentions a similar error - but still 
without any info on how to solve it:
https://developer.apple.com/library/archive/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG301

-A search on this error didn't produce anything useful.

-The tar.gz file in question is an eSellerate licensing framework. As many 
people may know, it's been a popular licensing??platform for Mac software for 
over a decade. While I switched to a different licensing platform some time 
ago, I still have thousands of customers with eSellerate licenses (as I'm sure 
is the situation with many other Mac developers).

As far as I understand, this whole situation has to do something with signing 
files inside tar.gz archives - on which I couldn't find any info either

Looks to me like your eSellerate framework is signed with a version 1 
signature. You need to resign the framework with a version 2 signature.

--Richard Charles




Thanks Richard,

Can you please elaborate on this...

I'm on Xcode 10 and Mojave. As far as I understand, ever since Mavericks 
it's always version 2 signature.


Or am I missing something?

I don't see any option in codesign to specify the signature version.


Thanks,
Leo
___

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


Is the list alive?

2019-05-29 Thread Leo via Cocoa-dev



Hmm... my earlier message today never got through.
___

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


Notarization error: The signature algorithm used is too weak

2019-05-28 Thread Leo via Cocoa-dev




Hi all,

I wonder if anyone's familiar with this error which only happens when I 
send my apps for notarization:


"AppName.zip/AppName.app/Contents/Resources/EWSMacCompress.tar.gz/EWSMacCompress.tar/EWSMac.framework/Versions/A/EWSMac83886082"
"The signature algorithm used is too weak."


Additional info:

-I've been signing my apps for years with no issues. The error only 
happens when sending the apps for notarization.


-I submitted a bug back in November 2018, provided Apple all the info 
they asked for - but it was never addressed further.


-I recently contacted Apple again and they pointed me to some resource 
page that was created back in 2016. It briefly mentions a similar error 
- but still without any info on how to solve it:
https://developer.apple.com/library/archive/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG301 



-A search on this error didn't produce anything useful.

-The tar.gz file in question is an eSellerate licensing framework. As 
many people may know, it's been a popular licensing??platform for Mac 
software for over a decade. While I switched to a different licensing 
platform some time ago, I still have thousands of customers with 
eSellerate licenses (as I'm sure is the situation with many other Mac 
developers).


As far as I understand, this whole situation has to do something with 
signing files inside tar.gz archives - on which I couldn't find any info 
either



Any help will be appreciated!


Thanks,
Leo

___

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: Is "-init" really needed?

2017-08-09 Thread Leo

I love "new".

Why type more and clutter your code when you don't have to.


Cheers,
Leo



On 8/8/17 12:45 PM, Alex Zavatone wrote:

I see it creeping back in to use with some people, but IMO, new bears too many 
references to other languages’ use of new.

It seems too close to how it would be used in other languages and may imply 
things that aren’t the best.

I think it’s a case of, “well in the olden days, new was used for stuff that 
was different.  We’ll use another word now.”

This just seems like a case of, “yeah, you can do it, but it’s probably better 
to let it rest and use another approach.”

Thoughts?  Agree?  Disagree?

- Alex Zavatone


On Aug 8, 2017, at 5:13 AM, Uli Kusterer <witness.of.teacht...@gmx.net> wrote:

On 8. Aug 2017, at 02:23, Carl Hoefs <newsli...@autonomy.caltech.edu> wrote:

Is the use of +new discouraged also?

Apple have gone back and forth on this AFAIR. +new was actually the 
pre-retain/release way to create an object. So it has been discouraged since 
... OpenStep, I think? But it was never formally deprecated, and I'm seeing it 
used more and more in ARC code these days.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.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/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/leo.r%40rogers.com

This email sent to le...@rogers.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: NSOpenPanel stopped working in some apps on Sierra

2016-12-07 Thread Leo

Thanks,

I found out what the problem was - but my emails to the list ended up 
being empty... hmm... another issue to solve?


Anyway, in brief:

I had NSSplitView's -dividerThickness method defined as a category with 
some custom thickness - instead of subclassing NSSplitView. Not a good 
idea, but it was years ago and I didn't know it back then. It did affect 
the divider thickness in NSOpenPanel too but didn't cause any problems 
until Sierra.



Leo





On 12/7/16 10:43 PM, じょいすじょん wrote:

On 2016 Dec 8, at 9:22, Jens Alfke <j...@mooseyard.com> wrote:



On Dec 7, 2016, at 3:16 PM, Leo <le...@rogers.com> wrote:

Any attempt to call it with runModal results with the following errors:

   [General] *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty 
array
   [General] (null)

What’s the backtrace?

Chances are there’s something messed up in the defaults the open-panel stores. 
If you look at the apps’ defaults and delete any that have “OpenPanel” in the 
name, that might fix things. (But it’d be a good idea to capture a dump of the 
defaults first, and put that in a bug report to Apple.)

—Jens
___

I would add that without the stacktrace and without showing code, it's pretty 
hard to do anything for you beyond guessing.


___

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: NSOpenPanel stopped working in some apps on Sierra

2016-12-07 Thread Leo

___

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: NSOpenPanel stopped working in some apps on Sierra

2016-12-07 Thread Leo

___

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


NSOpenPanel stopped working in some apps on Sierra

2016-12-07 Thread Leo

Hi all,

I suddenly discovered a strange issue:

NSOpenPanel stopped working in some of my apps.

Any attempt to call it with runModal results with the following errors:

[General] *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds 
for empty array

[General] (null)

The problem started on Sierra (or maybe with 10.12.1 update).

The same code worked for years with no issues.

Also, the problem only affects three apps (fortunately). The same code 
works fine in the rest of them as always.



Any ideas? Any help is appreciated!


Thanks,
Leo
___

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: Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-25 Thread Leo

___

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: dataWithPDFInsideRect returns raster text

2013-12-23 Thread Leo
If it doesn't work, you may need to use CGPDF... stuff and combine your 
elements in PDF manually. But that's just a guess as I never had to 
solve the issue you describe.


Leo



On 12/19/13, 12:12 PM, Leonardo wrote:


I get a pdf from my NSView using dataWithPDFInsideRect. If my view contains
only a NSTextView, dataWithPDFInsideRect properly returns a pdf with real
and selectable test.
But if put over the NSTextView a NSView in which I draw a transparent png
NSImage, the text laying exactly under the image gets rasterized and not
selectable.
In other words I can't put any image over the text and and get a
professional pdf.
Is a way to solve this trouble? I guess yes. Thanks.



Regards
-- Leonardo


___

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/leo.r%40rogers.com

This email sent to le...@rogers.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

Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-22 Thread Leo

I'm sandboxing an app for the first time. The app has been out for a few years 
by now, non-sandboxed.

The app receives batches of PDF files and exports them with some changes. Users 
can select files from NSOpenPanel or drag-and-drop.

There are two options:

-export files into a specific folder, or
-export each file into its original folder.

The first option works with no problem: users select a destination folder in 
NSOpenPanel, I create and then resolve the bookmark for this folder. Files are 
being exported there as expected.


However, I'm not sure how to deal with the second option when each file should 
be exported to its original enclosing folder.

I tried to create a bookmark for file's enclosing folder when users add the 
files:

NSURL *url = [NSURL fileURLWithPath:[filePath 
stringByDeletingLastPathComponent]];

NSData *bookmarkData = [url

bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
includingResourceValuesForKeys:nil
relativeToURL:nil
error:err];

However, it results in this error: The file “enclosing folder name” couldn’t be 
opened.

As far as I understand, it happens because user selects the file, which still 
doesn't grant the right to bookmark its enclosing folder.


If I create a bookmark for file's URL, I can't use this bookmark to export the 
file: the bookmark doesn't grant permissions to the enclosing folder.


I did some extensive research and experimented with different options with no 
luck.


What am I missing? How can I bookmark the enclosing folder of user-selected 
file (if at all)?


Any help will be appreciated!


Thanks,
Leo

___

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: Sandboxing: Can't bookmark enclosing folder of user-selected file

2013-12-22 Thread Leo

___

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: Storing strings in code

2012-08-09 Thread Leo

Thanks everybody for all the suggestions!

I got the point: there's no way to do this easier than I already do.

I don't need any sophisticated security.

All I want is that if someone opens the executable in a text editor, the 
paths of certain two files to not appear in plain text.


For this purpose, my method does what I need:

NSString *str = [[NSArray arrayWithObjects: @m, @y, @S, @t, 
@r, @i, @n, @g, nil] componentsJoinedByPath:@]



If there's someone who can crack this, or crack my demo protection by 
reverse engineering, then this person wouldn't buy my products anyway so 
I'm not worrying.


Thanks again,
Leo

On 8/8/12 5:00 PM, Alex Zavatone wrote:

How much security do you want?

If your strings are basic ASCII, then their value is ASCII 32 to 126.  You can 
just bit shift the ASCII values (+128), store the ASCII value, or zip the 
strings.

On Aug 8, 2012, at 4:37 PM, Jean-Daniel Dupas wrote:


Le 8 août 2012 à 22:15, Rick Mann rm...@latencyzero.com a écrit :


On Aug 8, 2012, at 12:58 , Leo le...@rogers.com wrote:


As I recently learned, plain strings are stored as is in the executable and 
can be discovered - if opening it in a text editor, for example.

That is, if I have a string @myString inside the code, it can be read in 
plain text inside the executable.

I have a couple of string I don't want to be discovered (related to demo period 
handling).

Is there an easy way to store them in an encoded way?

I tried to define them as C strings (const char) but it doesn't make a 
difference.


So far I just break them into characters in AppleScript Editor, add @ in front 
of each with find-replace, and then store them as an array which receives the 
-componentsJoinedByString: method.

Is there an easier way?

There's no truly secure way to do this. About the best you can do is encrypt 
the strings, but people can crack it if they want to badly enough. Depending on 
how much effort you want them to go through, you can do any number of things to 
encrypt, from simple to complex.

You might also consider requiring a connection to a server to see if you should 
run. But given enough interest, you will get p0wned eventually.


Requiring a connection to check license is the best way to bother legitimate 
customers, while being totally ineffective to stop your application to being 
cracked.

I would not bother to much to hide strings. There is far more information in 
the binary that can be used to crack it, like the full objc metas.


--
Rick

-- Jean-Daniel





___

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/leo.r%40rogers.com

This email sent to le...@rogers.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

Storing strings in code

2012-08-08 Thread Leo
As I recently learned, plain strings are stored as is in the 
executable and can be discovered - if opening it in a text editor, for 
example.


That is, if I have a string @myString inside the code, it can be read 
in plain text inside the executable.


I have a couple of string I don't want to be discovered (related to demo 
period handling).


Is there an easy way to store them in an encoded way?

I tried to define them as C strings (const char) but it doesn't make a 
difference.



So far I just break them into characters in AppleScript Editor, add @ in 
front of each with find-replace, and then store them as an array which 
receives the -componentsJoinedByString: method.


Is there an easier way?

Thanks,
Leo
___

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 deactivate an app

2012-02-01 Thread Leo

What happens if you send

set frontmost of process yourApp to false

then, using the name of your app? Will it reveal the previous app by a chance?


If not, then is there any way to capture the name of the app you need to activate at an 
earlier stage, so you can send it set frontmost  to true later?

Leo


On 2/1/12 1:44:49 AM, Gerriet M. Denkmann wrote:

On 1 Feb 2012, at 11:33, Leo wrote:


If I understand your goals correctly, you can send the following AppleScript 
script:

tell application System Events to set frontmost of process yourApp to true

I tried the following in AppleScript Editor:

set appList to processes
tell application System Events
set proCount to count of processes
set appList to appList  (  proCount  ):
repeat with x from (1) to (proCount)
set appName to name of process x
set appList to appList  appName  ,
end repeat
end tell
log appList


But the resulting list of apps has only a very rough resemblance to the list 
displayed by Command-Tab.

So the following:
NSString *source = @tell application \System Events\ to set frontmost of process 
2 to true;
NSAppleScript *appleScript = [ [ NSAppleScript alloc ] initWithSource: source ];
NSDictionary *errorInfo;
NSAppleEventDescriptor *aed = [ appleScript executeAndReturnError:errorInfo ];
[ appleScript release ];

does work in that is activates some app, but process 2 is NOT the previous 
active app.

Kind regards,

Gerriet.





___

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 deactivate an app

2012-01-31 Thread Leo
If I understand your goals correctly, you can send the following 
AppleScript script:


tell application System Events to set frontmost of process yourApp to true

You can use NSAppleScript of Scripting Bridge (although the latter maybe 
an overkill for just one line).


Leo


On 1/31/12 2:55:31 AM, Gerriet M. Denkmann wrote:

I have an app A, where I can select a word and press a button.
This starts (or activates) another app called B, which displays some 
information about this word.

Works fine so far.

But if there is no information about the word, app B should make app A active 
again.
But how?
(B should not be hidden; it should remain visible, so that the user sees: Word not 
found.)

I tried [NSApp deactivate] -  the documentation says, I should not use this 
method - and indeed, it makes the B-window look inactive, but does NOT make A 
active - the menu bar still belongs to B.
No good.

The there is NSWorkspace runningApplications - but: The order of the array is 
unspecified.
Not really useful.

I just want the equivalent of Command-Tab: making the next most recent app 
active.

There probably is a simple, direct and obvious solution. But I cannot see it.

Kind regards,

Gerriet.

P.S. 10.7.2


___

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/leo.r%40rogers.com

This email sent to le...@rogers.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: NSPopUpButton Binding Frustration

2012-01-30 Thread Leo

On 1/30/12 11:34:11 AM, Keary Suska wrote:

For instance, when using selectedObject, the returned object must be an exact 
object in the content/contentObjects array. -isEqual is not enough.


Thank you! You just unexpectedly solved me the headache I had for a long 
time.


Leo

___

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: Is slowing down bindings updates possible?

2012-01-15 Thread Leo

I'm not sure if this has already been suggested:

What if you don't update the UI unless the change is at least 1 sec or 
1% or certain amount of bytes (whatever suits your needs better)?


Leo


On 1/15/12 12:33:31 AM, Andrew wrote:

Thank you all for the opinions. I left the code as-is in terms of
binding, but changed my rate calculations to use a weighted running
average. After doing so, the estimated seconds tick by one at a time
for the most part, and the rate is more constant. This is a tool for
me and some co-workers, so at this point, it is good enough. But the
ideas are sound and if it bothers me enough, I may decouple the UI
from the model by not using bindings at some point and use a timer
based approach.

On Sat, Jan 14, 2012 at 10:37 AM, Kyle Sluderkyle.slu...@gmail.com  wrote:

On Jan 14, 2012, at 2:53 AM, Marcel Weihermarcel.wei...@gmail.com  wrote:


Hi Andrew,

On Jan 13, 2012, at 6:57 , Andrew wrote:


The result of this is that the UI updates really frequently and the
estimated time to complete and the download rate jump around a lot. I
would love it if I could tell cocoa to only update the UI once per
second instead of immediately when the property key changes.

You shouldn't push updates to the UI, the UI should query the model, and it should do it 
at human speed, not at whatever speed the machine can manage to change the 
state.  There are a bunch of reasons for this, not least is that UI updating is fairly 
heavyweight and you can actually impact your performance (significantly, in some cases).

Be careful here. This is good advice in this particular circumstance, but in 
general pushing values to the UI is good and common design. The UI will 
register as a KVO observer, or as an NSNotification observer, or perhaps the 
controller will just call -setObjectValue: directly.

Breaking this pattern should be a conscious decision. For example, you don't 
push a value to cell-based NSTableViews; you tell the table view it needs to 
ask you for the values at certain indexes. This is because cell-based table 
views are an optimization that avoids keeping tons of view objects around.

But view-based table views behave just like any other view: you push updates 
directly to the controls contained within your table cell view.

In Andrew's case, it's clear that he should deviate from the norm, and the UI 
should be in charge of asking for the latest value at a rate that makes sense, 
probably controlled by an NSTimer.

--Kyle Sluder

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/leo.r%40rogers.com

This email sent to le...@rogers.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: Transparency of textured controls

2011-08-23 Thread Leo

On 8/21/11 7:02:09 PM, Andreas Mayer wrote:

Am 19.08.2011 um 21:36 schrieb Leo:

Actually, I finally realized what the real issue is: Apple for some reason didn't 
refresh NSSegmentedControl Rounded style to match the new appearance of 
NSTabView controls on Lion.

I guess that's intentional. The 'Capsule' style does look like the NSTabView 
controls.
I checked boh IB 3.2.6 and Xcode 4 again, and the Capsule looks almost 
identical to Textured Rounded, and it's also transparent. Is it really 
different on your setup?



And please bring back the colorful  Finder sidebar

Thats most definitely intentional. They said so in one of the sessions at WWDC, 
IIRC. It's meant to make the actual content stand out more.
Oh yeah, I know it's intentional! The only thing they achieved is making 
the sidebar much harder to use,in my opinion. The icons are almost 
indistinguishable, so instead of quickly recognizing the desired item by 
its custom color icon, users now must read all the labels. I have all my 
projects in the sidebar, with unique custom icon for each project. Plus 
dividers with no icon (just a transparent mask). In Lion it all became 
just a long list of names and useless dull icons.


What's next? Black-and-white Finder with no custom icons to make 
content stand out? The whole idea sounds as un-Mac as it can be to me.


Well I guess I take it really seriously. :) But the custom icons help 
find stuff really fast and effortlessly, which is important. And vice 
versa.


It's icons that make content stand out... that's why they were invented.

Also, when I was looking for a solution to bring back the normal 
sidebar, I happened to come across several discussions on the subject - 
and it looks like the majority of users are really upset about the new 
sidebar. Plus, there's no way for 3rd party developers to alter its 
appearance.


Well, hope someone from Apple reads it as well. :)

Leo


___

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


Scripting Bridge header file problem

2011-08-19 Thread Leo

Hi all,

I'm trying to use Scripting Bridge to send AppleScript to InDesign CS5.5.

I created the header file from scripting definitions... It's a huge file 
- 10.2 MB.


Added it to the project.

Now the project won't compile because the InDesign header file contains 
tons of duplicate declarations of various methods.


For example, mergeWith: declared 3 times for various InDesign classes.

It's unthinkable to correct all of them - there's over 500 errors

Is there a way to deal with it?

Obviously, I don't need all the classes. So I guess I just should delete 
whatever I don't need from the header file and correct a few remaining 
matching methods (if any).


Or is there a better way to fix it?

Thanks,
Leo

___

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: Transparency of textured controls

2011-08-19 Thread Leo

On 8/19/11 11:00:44 AM, Andreas Mayer wrote:

Am 13.08.2011 um 18:41 schrieb Leo:

For some reason, the textured controls are now transparent (e.g., Textured 
Rounded and Textured Square of NSSegmentedControl etc.)

 From the AppKit Release Notes:

--
Button Appearance Changes (New since early 2011 seed)

As part of an ongoing refresh of Aqua in Mac OS X Lion, some buttons look 
different and may not look the same in every context in your application. 
Specifically, the “Round Textured” button is not appropriate in any context 
other than directly on the background of a textured window. If you are using 
this kind of button in a table view or other context, please consider changing 
it to a “Round Rect” button.
--

Thanks Andreas!

Actually, I finally realized what the real issue is: Apple for some 
reason didn't refresh NSSegmentedControl Rounded style to match the 
new appearance of NSTabView controls on Lion.


So NSSegmentedControl still looks like the old Aqua blueish liquified 
controls. Which will look totally out of place on Lion.


I'll submit an appropriate request to Apple. Like - hello Apple! This is 
something you really had to update. And please bring back the colorful  
Finder sidebar with custom icons and Devices on top, so that it becomes 
user-friendly again (you did not have to ruin it really)!!


Best,
Leo
___

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


Transparency of textured controls

2011-08-13 Thread Leo

Hi all,

I think it's something new to Lion:

For some reason, the textured controls are now transparent (e.g., 
Textured Rounded and Textured Square of NSSegmentedControl etc.)


That is, underlying elements are showing through.

I guess the goal of this transparency is so that textured controls 
change their appearance when placed on a textured window.


I need to put segmented control at the top of a tabless NSTabView 
instead of its original tabs. If I use the Textured Square style, the 
tab view's bezel is showing through.


Obviously, I don't want to use other styles.

Is there any way to get rid of this transparency?

(Setting isOpague to YES doesn't change anything).


Thanks,
Leo



___

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: File Copy With Progress?

2011-08-13 Thread Leo
You can also use libcurl which supports the 'file' protocol along with 
ftp, http, etc. It's also not Cocoa, but easy to use and there's also 
its Cocoa wrapper CURLHandle (I'm not sure if they updated it to Intel 
eventually):


http://code.google.com/p/curlhandle/

Leo

On 8/11/11 7:22:53 PM, Todd Freese wrote:

Is there a Cocoa way in 10.6+ to copy a file with a progress call back? I would 
love to rid my code of calls to FSCopyObjectASync and all of it's non-sense.

Thanks!

Todd Freese
The Filmworkers Club


___

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: Frameworks (ConnectionKit)

2011-08-09 Thread Leo

You can use libcurl:

http://curl.haxx.se/

Extremely powerful library, which is a part of Mac OS X, that supports 
most protocols (FTP, SFTP, HTTP etc.) I find it very easy to use - but  
I've been using it for years in either its command line (curl) or 
library implementation.


There's also excellent Open Source polkit:

http://code.google.com/p/polkit/

which is partially based on libcurl and Mac OS X frameworks and supports 
even more protocols, such as Amazon S3, AFP and SMB.


I remember trying the ConnectionKit, and whatever I tried it just didn't 
work.


Leo

On 8/9/11 7:04:08 AM, Amy Heavey wrote:

Hi,

I'd  like to be able to use my mac app to upload an image to a server. 
From googling it seems the best way to achieve this is using the 
ConnectionKit framework to upload it via FTP.


I've downloaded the framework, but Im at a loss, the examples 
included don't build, and looking at the hillegass book there should 
be a .framework file for me to link to but I can't find one. I also 
can't find any documentation about how to use this. Can anyone point 
me in the right direction? Either for using ConnectionKit or how else 
to simply ftp a file to a server?


Many Thanks

Amy Heavey
Willow Tree Crafts
www.willowtreecrafts.co.uk



___

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/leo.r%40rogers.com

This email sent to le...@rogers.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: Frameworks (ConnectionKit)

2011-08-09 Thread Leo

On 8/9/11 6:28:54 PM, Mike Abdullah wrote:

Bear in mind PolKit is GPL, unless the author gives you permission otherwise.
Yeah actually I had to mention this but it didn't look like the original 
question referred to a commercial product.


___

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: Menu Item Key Equivalent

2011-08-09 Thread Leo

On 8/5/11 4:43:06 AM, Uli Kusterer wrote:

On 05.08.2011, at 08:49, Jens Alfke wrote:

Photoshop has always used letter keys as commands to select tools, and most 
other image editors on Mac follow suit, like Pixelmator and (I think) Acorn. 
I’m not sure if these show up in menus, though, although that seems like a good 
idea, as it makes them more discoverable.

  Just make sure you don't do it like Pixelmator: Every time I habitually try 
to tab from one text field to the next, all my palettes just vanish. The first 
few times this happened, I thought Pixelmator had crashed.


They just copied Photoshop. Although I also think it's a bad idea.

___

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


Keeping NSOutlineView always active?

2011-07-28 Thread Leo

Hi all,

Is it possible to make NSOutlineView look always active, even if it's 
not the actual first responder?


Similar to the way the sidebar appears in the Finder: the selection in 
sidebar always appears as active, even when you work with the actual 
window contents.


Am I missing something obvious?

Thanks,
Leo
___

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


Keeping NSOutlineView always active?

2011-07-28 Thread Leo

Hi all,

Is it possible to make NSOutlineView look always active, even if it's 
not the actual first responder?


Similar to the way the sidebar appears in the Finder: the selection in 
sidebar always appears as active, even when you work with the actual 
window contents.


Am I missing something obvious?

Thanks,
Leo
___

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: Keeping NSOutlineView always active?

2011-07-28 Thread Leo

Oops sorry - please ignore, just reposted as a separate thread.

Leo


On 7/28/11 4:09:38 AM, Leo wrote:

Hi all,

Is it possible to make NSOutlineView look always active, even if it's 
not the actual first responder?


Similar to the way the sidebar appears in the Finder: the selection in 
sidebar always appears as active, even when you work with the actual 
window contents.


Am I missing something obvious?

Thanks,
Leo 

___

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: Detecting shared folders

2010-11-18 Thread Leo

Greg and Ken:

Thanks a lot for answering my question about shared folders, that's exactly
what I needed!

Best,
Leo


 From: Greg Nelson nelsong...@gmail.com
 Date: Wed, 17 Nov 2010 00:01:24 -0500
 To: Leo le...@rogers.com, cocoa-dev@lists.apple.com
 Subject: Re: Detecting shared folders

 From: Ken Thomases k...@codeweavers.com
 Date: Wed, 17 Nov 2010 00:33:02 -0600
 To: Leo le...@rogers.com
 Cc: cocoa-dev@lists.apple.com
 Subject: Re: Detecting shared folders

___

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


Detecting shared folders

2010-11-16 Thread Leo
Hi,

I wonder if it's possible to detect a shared folder? That is a folder that
is shared via File Sharing.

Am I missing something obvious?

I couldn't find an appropriate folder attribute in either Cocoa or
AppleScript. Or any other way to distinguish a shared folder from other
folders.

I also assume there must be a list of all shared folders in one of the Unix
special directories. Or a way to retrieve it with a shell command. I did
some extensive research, couldn't find anything.

Any help would be appreciated!

Thanks,
Leo
___

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: NSSavePanel panel:shouldShowFilename:

2010-11-16 Thread Leo
From: Quincey Morris quinceymor...@earthlink.net

 a number of system extensions (like Default Folder, but I think that wasn't
 the first) added the ability to option-click on a disabled item to prefill the
 text field with an existing name,

 At some point (possibly Mac OS X 10.0), Apple quietly adopted this very useful
 convention.

I once submitted a request to Apple, maybe I'm in minority, but I hope this
behavior will be optional one day. Like Opt-click would be perfect.

I worked at a major ad agency for several years, and this behavior caused
major problems, misunderstandings and loss of time.

Most of the time, people click on the file list occasionally (maybe to
type-scroll to desired folder), the file gets quietly renamed, you save it
- and can never find it because it was saved under a name you never wanted
or thought about.

I had myself to cancel the Save dialog countless times to avoid saving files
under unwanted names.

Leo



___

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

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

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

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


How to make a token field that only accepts numbers: NSTokenField with NSNumberFormatter?

2009-02-19 Thread Leo Singer
Hi,

I want to create an NSTokenField that only accepts tokens that are
numbers.  In fact, I only want integers between 0 and, say, 170
inclusive.  I tried dropping an NSNumberFormatter onto my
NSTokenField, but it had no perceivable effect.  Help!

Leo
___

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: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-19 Thread Leo Singer
Sorry, I meant to send this to the list.

Leo


-- Forwarded message --
From: Leo Singer doc.aron...@gmail.com
Date: Thu, Feb 19, 2009 at 1:28 PM
Subject: Re: Running out of memory on stack in C++ routine invoked
within  Cocoa NSOperation
To: Greg Parker gpar...@apple.com


Thanks for all of the input on this.  I decided to override
NSOperation's - start selector and make the thread myself.  I wish
that there was a way to adjust the stack size per NSOperationQueue.
Maybe I should report that as a feature request.

I would rather not dynamically allocate that particular array because
the Cocoa application I am developing is simply a wrapper for a cross
platform C++ project.  This particular project has to manage a number
of different resources, including an SQLite database connection, an
open file, and a serial port device.  In order to keep error handling
as simple as possible, I have made heavy use of the RIAA pattern.  If
a serial port error occurs, for example, an exception gets thrown.  As
a result, the objects representing both the database and the open file
go out of scope, and their resources are released.

A std::vector would be unsuitable also because in my actual
application (not the cooked example I sent out) I need to be able to
manipulate that memory directly.

Some more background information might be helpful.  The application is
a GUI for a bootloader for Microchip brand DSPs.  The big array in
question is actually a 256 kb image of the device's program memory.

Thanks again,
Leo

On Wed, Feb 18, 2009 at 3:17 PM, Greg Parker gpar...@apple.com wrote:
 On Feb 18, 2009, at 3:22 AM, Michael Vannorsdel wrote:

 Really it would be best to malloc the space, use it, and free it.  Once
 you get to huge stack usage you gamble that you won't run out when there can
 be other higher up calls also consuming some (frameworks, libs, 3rd party
 code, ect).  Also if you only use the large amount once in a while then you
 have a bunch of unutilized memory sitting around.

 Agreed: use malloc for large memory allocations.

 One other limit that you apparently haven't run into yet: some architectures
 limit the maximum size of a single stack frame, even if there is lots of
 space on the stack. ppc has a maximum 64K stack frame size; arm may have a
 similar limit.


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


 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/doc.aronnax%40gmail.com

 This email sent to doc.aron...@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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Leo Singer
Hi,

I have a C++ method that I am invoking from within the - (void) main
selector of an NSOperation.  My Cocoa application is crashing because
this particular C++ method puts a huge amount of data on the stack.  I
am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
works fine if I call it from within a command line C++ program.

I have contrived some sample code to illustrate the problem.
TestOperation is an (Objective C) subclass of NSOperation; I am
running the NSOperation in a separate thread by putting it into an
NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
is responsible for doing one thing only: calling the go() method on an
instance of TestOperationImpl.

Note the very large array of ints that is declared inside
TestOperationImpl::go().  If it is changed to an array of shorts or an
array of chars, then this example code works fine, no EXEC_BAD_ACCESS.

Is there any way for me to give my application more memory, or at
least give more memory to the thread that is running this C++ method?

Thanks,
Leo

 TestOperation.h /
#import Cocoa/Cocoa.h

class TestOperationImpl {
private:
bool cancelled;
public:
TestOperationImpl();
void go();
void cancel();
};

@interface TestOperation : NSOperation {
TestOperationImpl* testOpImpl;
}
- initWithController: (TestOperationController*) controller;
@end

 End of TestOperation.h /

 TestOperation.mm /
#import TestOperation.h

TestOperationImpl::TestOperationImpl(TestOperationController* controller)
: cancelled(false)
{
}

void TestOperationImpl::go()
{
int bigArray[256000];

for (int j = 0 ; j  256000  !cancelled ; j ++)
{
bigArray[j] = 2*j;
}
}

void TestOperationImpl::cancel()
{
cancelled = true;
}

@implementation TestOperation
- initWithController: (TestOperationController*) ctrl
{
if (self = [self init])
testOpImpl = new TestOperationImpl(ctrl);
controller = ctrl;
return self;
}
- (void) dealloc
{
delete testOpImpl;
[super dealloc];
}
- (void) cancel
{
testOpImpl-cancel();
[super cancel];
}
- (void) main
{
testOpImpl-go();
}
@end

 End of TestOperation.mm /
___

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: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Leo Singer
Actually, if the big array and the loop are moved from the C++ method
into the Objective C selector - (void) main then the same
EXEC_BAD_ACCESS occurs.  So the problem is not related to C++.  The
following source code still exhibits the same problem:

 TestOperation.h /
#import Cocoa/Cocoa.h

@interface TestOperation : NSOperation {
}
@end

 End of TestOperation.h /

 TestOperation.mm /
#import TestOperation.h

@implementation TestOperation
- (void) main
{
   int bigArray[256000];

   for (int j = 0 ; j  256000  ![self isCancelled] ; j ++)
   {
   bigArray[j] = 2*j;
   }
}
@end

 End of TestOperation.mm /

On Wed, Feb 18, 2009 at 3:16 AM, Leo Singer doc.aron...@gmail.com wrote:
 Hi,

 I have a C++ method that I am invoking from within the - (void) main
 selector of an NSOperation.  My Cocoa application is crashing because
 this particular C++ method puts a huge amount of data on the stack.  I
 am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
 works fine if I call it from within a command line C++ program.

 I have contrived some sample code to illustrate the problem.
 TestOperation is an (Objective C) subclass of NSOperation; I am
 running the NSOperation in a separate thread by putting it into an
 NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
 is responsible for doing one thing only: calling the go() method on an
 instance of TestOperationImpl.

 Note the very large array of ints that is declared inside
 TestOperationImpl::go().  If it is changed to an array of shorts or an
 array of chars, then this example code works fine, no EXEC_BAD_ACCESS.

 Is there any way for me to give my application more memory, or at
 least give more memory to the thread that is running this C++ method?

 Thanks,
 Leo

  TestOperation.h /
 #import Cocoa/Cocoa.h

 class TestOperationImpl {
 private:
bool cancelled;
 public:
TestOperationImpl();
void go();
void cancel();
 };

 @interface TestOperation : NSOperation {
TestOperationImpl* testOpImpl;
 }
 - initWithController: (TestOperationController*) controller;
 @end

  End of TestOperation.h /

  TestOperation.mm /
 #import TestOperation.h

 TestOperationImpl::TestOperationImpl(TestOperationController* controller)
 : cancelled(false)
 {
 }

 void TestOperationImpl::go()
 {
int bigArray[256000];

for (int j = 0 ; j  256000  !cancelled ; j ++)
{
bigArray[j] = 2*j;
}
 }

 void TestOperationImpl::cancel()
 {
cancelled = true;
 }

 @implementation TestOperation
 - initWithController: (TestOperationController*) ctrl
 {
if (self = [self init])
testOpImpl = new TestOperationImpl(ctrl);
controller = ctrl;
return self;
 }
 - (void) dealloc
 {
delete testOpImpl;
[super dealloc];
 }
 - (void) cancel
 {
testOpImpl-cancel();
[super cancel];
 }
 - (void) main
 {
testOpImpl-go();
 }
 @end

  End of TestOperation.mm /

___

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: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Leo Singer
OK, so there is a way to change the size of the stack for an NSThread.
 But how do I do this for an NSOperationQueue?

NSThread has the following selector:
- (void) setStackSize:(NSInteger)s;

I need to find the equivalent selector for NSOperationQueue.  Any
ideas out there?

Leo

#import Cocoa/Cocoa.h

@interface MemoryTortureController : NSObject {
}
- (IBAction)memoryTortureBackground: (id) sender;
- (IBAction)memoryTorture: (id) sender;
@end

@implementation MemoryTortureController
- (IBAction)memoryTortureBackground: (id) sender
{
NSThread* thread;

thread = [[NSThread alloc] initWithTarget: self
 selector: @selector(memoryTorture:)
   object: sender];

// The magic line
[thread setStackSize:256000*8];

[thread start];
}
- (IBAction)memoryTorture: (id) sender
{
int bigmem[256000];
for (int i = 0 ; i  256000 ; i ++)
bigmem[i] = 2*i;
}
@end



On Wed, Feb 18, 2009 at 3:31 AM, Leo Singer doc.aron...@gmail.com wrote:
 Actually, if the big array and the loop are moved from the C++ method
 into the Objective C selector - (void) main then the same
 EXEC_BAD_ACCESS occurs.  So the problem is not related to C++.  The
 following source code still exhibits the same problem:

  TestOperation.h /
 #import Cocoa/Cocoa.h

 @interface TestOperation : NSOperation {
 }
 @end

  End of TestOperation.h /

  TestOperation.mm /
 #import TestOperation.h

 @implementation TestOperation
 - (void) main
 {
   int bigArray[256000];

   for (int j = 0 ; j  256000  ![self isCancelled] ; j ++)
   {
   bigArray[j] = 2*j;
   }
 }
 @end

  End of TestOperation.mm /

 On Wed, Feb 18, 2009 at 3:16 AM, Leo Singer doc.aron...@gmail.com wrote:
 Hi,

 I have a C++ method that I am invoking from within the - (void) main
 selector of an NSOperation.  My Cocoa application is crashing because
 this particular C++ method puts a huge amount of data on the stack.  I
 am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
 works fine if I call it from within a command line C++ program.

 I have contrived some sample code to illustrate the problem.
 TestOperation is an (Objective C) subclass of NSOperation; I am
 running the NSOperation in a separate thread by putting it into an
 NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
 is responsible for doing one thing only: calling the go() method on an
 instance of TestOperationImpl.

 Note the very large array of ints that is declared inside
 TestOperationImpl::go().  If it is changed to an array of shorts or an
 array of chars, then this example code works fine, no EXEC_BAD_ACCESS.

 Is there any way for me to give my application more memory, or at
 least give more memory to the thread that is running this C++ method?

 Thanks,
 Leo

  TestOperation.h /
 #import Cocoa/Cocoa.h

 class TestOperationImpl {
 private:
bool cancelled;
 public:
TestOperationImpl();
void go();
void cancel();
 };

 @interface TestOperation : NSOperation {
TestOperationImpl* testOpImpl;
 }
 - initWithController: (TestOperationController*) controller;
 @end

  End of TestOperation.h /

  TestOperation.mm /
 #import TestOperation.h

 TestOperationImpl::TestOperationImpl(TestOperationController* controller)
 : cancelled(false)
 {
 }

 void TestOperationImpl::go()
 {
int bigArray[256000];

for (int j = 0 ; j  256000  !cancelled ; j ++)
{
bigArray[j] = 2*j;
}
 }

 void TestOperationImpl::cancel()
 {
cancelled = true;
 }

 @implementation TestOperation
 - initWithController: (TestOperationController*) ctrl
 {
if (self = [self init])
testOpImpl = new TestOperationImpl(ctrl);
controller = ctrl;
return self;
 }
 - (void) dealloc
 {
delete testOpImpl;
[super dealloc];
 }
 - (void) cancel
 {
testOpImpl-cancel();
[super cancel];
 }
 - (void) main
 {
testOpImpl-go();
 }
 @end

  End of TestOperation.mm /


___

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