Re: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev


> On Mar 19, 2023, at 1:02 PM, Alan Snyder  wrote:
> 
> Your comments don’t make sense to me.
> 
> You either post an event to run the code on the main thread or, if you are on 
> the main thread, you run the code directly.
> 
> Running the code directly is what invoking a block does.
> 
> How is that unnecessary?
> 
> Would it make more sense if the parameter were named “c” and the code said 
> “c()”?
> 

Alan,

The code here does seem pretty straight forward. Never the less this is where 
it hangs. If you run the example in the bug report with -XstartOnFirstThread 
and then do a shift+ctrl+\ you should see this on the stack trace. 
It doesn’t run the block with the hang. NSLog traces show that.
So I assume something is wrong prior to here that is causing the problems.
So I started trying to back trace how you get here. That led me to the code 
that indicates with the switch you don’t get the same setup Swing app’s 
normally do but are supposed to manage things yourself - like run loops.
My best guess now is that the hang is because some necessary setup to run Swing 
is not being done with the -XrunOnFirstThread switch. 
If you look at the earlier sort of full trace I provided I point out one case 
where you end up in ThreadUtilities doing a block copy that happens without the 
switch but doesn’t happen with the switch. 
Things are somehow different and without possibly some fairly complicated 
native you aren’t going to be able to get this to work.
I just don’t think this was ever intended to be used by normal Swing 
applications.

Mike
  
___

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: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev


> On Mar 19, 2023, at 11:48 AM, Michael Hall  wrote:
> 
> 
> 
>> On Mar 19, 2023, at 10:50 AM, Alex Zavatone  wrote:
>> 
>> Would it make sense to intentionally cause this in one test case and then 
>> try dispatching on another queue at an intentional lower priority?  
>> 
>> I’m just brainstorming here to create a specific case that we know causes 
>> it, then examines other dispatch options at lower quality of service levels. 
>>  Am not even considering async yet and expect that may cause unintended 
>> possibilities.
>> 
>> My guess here is that we need this to be sync, but it cannot be on the main 
>> thread (obviously) so try lower QOS and another thread before looking in to 
>> a dispatch queue.
>> 
>> Just trying to look at this from the 100 ft view and exhaust the current 
>> options before moving pas them.
>> 
> 
> Not following some of this. 
> 

But, thanks for the replies.

Mike

___

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: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev


> On Mar 19, 2023, at 10:50 AM, Alex Zavatone  wrote:
> 
> Would it make sense to intentionally cause this in one test case and then try 
> dispatching on another queue at an intentional lower priority?  
> 
> I’m just brainstorming here to create a specific case that we know causes it, 
> then examines other dispatch options at lower quality of service levels.  Am 
> not even considering async yet and expect that may cause unintended 
> possibilities.
> 
> My guess here is that we need this to be sync, but it cannot be on the main 
> thread (obviously) so try lower QOS and another thread before looking in to a 
> dispatch queue.
> 
> Just trying to look at this from the 100 ft view and exhaust the current 
> options before moving pas them.
> 

Not following some of this. 

> Then there is always the case of, “does anyone else have this working?  What 
> are they doing and why does it work if they do?”
> 
> Cheers, 
> Alex Zavatone
> 
> Sent from my iPhone


But as mentioned I think if I remember right that this switch was done in the 
very early days of Mac java for only Eclipse because they had their own ‘window 
toolkit’. I am not aware of anyone else making regular use of it. But they 
might be.

It came up on a java forum because OpenGL code in a java Swing app I think was 
getting errors for not being on the main thread. Which -XstartOnFirstThread is 
supposed to accomplish.

I got into it because a long time back Apple was working on a Cocoa Java 
bridge. Some of that to work correctly also had to be on the main thread.

I came up with a little stub that would do a callback into java on the native 
thread. Basically perform selector on main the java callback.

However, since it was indicated that the java jdk providing a fix for 
-XstartOnFirstThread would be a preferred solution. I decided to look at that 
some. I have sort of concluded that most likely isn’t going to fly.


___

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: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev


> On Mar 19, 2023, at 10:37 AM, Alex Zavatone  wrote:
> 
> So while I am waiting for my coffee to actually start working, which 
> approaches do we think make sense here?
> 
> When starting up, check if thread == main and if so, do one thing, else do 
> the other?
> 
> If this is correct, what would each option be?
> 
> Is this an appropriate summary or a vast oversimplification?
> 
> Cheers, 
> Alex Zavatone
> 
> Sent from my iPhone
> 

I think I’ve put about as much time into this as I mean to right now.

But, what I think I’ve sort of concluded from what I saw in NSLog tracing the 
startup and what I’ve seen or heard in the past.

The java Swing (GUI) normally starts up and manages it’s own threads and run 
loop.

The Eclipse IDE came up with its own GUI called SWT, don’t know what that 
stands for, something windows toolkit probably.
Pretty much just for that a -XstartOnFirstThread option was added that runs on 
the Cocoa main thread. 
However, it appears some of the run loop handling Swing normally does is up to 
the responsibility of applications using that launch switch.
So use the switch for Swing applications and the normal setup isn’t done and 
Swing hangs. Bug Report. 
But probably not going to be fixed because the switch was never intended to be 
used for Swing applications.
Not worth too much more looking at I don’t think once I saw the comment that 
applications using the switch were on their own for managing run loops.


___

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: OS/X Java native bug

2023-03-19 Thread Michael Hall via Cocoa-dev


> On Mar 18, 2023, at 4:46 AM, Michael Hall  wrote:
> 
>> On Mar 17, 2023, at 7:49 AM, Alan Snyder > <mailto:javali...@cbfiddle.com>> wrote:
>> 
>> block() means invoke the block
> 
> 
> Not exactly and it still seems unnecessary here.
> 
> It appears to convert the block to a selector and then to invoke it. 

There seems to be something I’m missing here. An app running with this changed 
was crashing.
So the separate block() call might be necessary for some reason.

___

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: OS/X Java native bug

2023-03-18 Thread Michael Hall via Cocoa-dev


> On Mar 18, 2023, at 4:46 AM, Michael Hall  wrote:
> 
> The main differences seeming to be that it takes a pass through the CFRunLoop 
> doing an invokeBlockCopy

After seeing this (java_md_macosx.m JVMInit  sameThread is true)…

   /*
 * We cannot use dispatch_sync here, because it blocks the main 
dispatch queue.
 * Using the main NSRunLoop allows the dispatch queue to run 
properly once
 * SWT (or whatever toolkit this is needed for) kicks off it's own 
NSRunLoop
 * and starts running.
 */
I would think the problem is that -XrunOnFirstThread is intended for ’toolkit’s 
that aren’t Swing based but handle the gui and NSRunLoop as indicated 
themselves - like Eclipse with SWT.

Arbitrary Swing app’s just can’t use this jvm switch.

Sound plausible?


___

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: OS/X Java native bug

2023-03-18 Thread Michael Hall via Cocoa-dev


> On Mar 17, 2023, at 7:49 AM, Alan Snyder  wrote:
> 
> block() means invoke the block


Not exactly and it still seems unnecessary here.

It appears to convert the block to a selector and then to invoke it. 

Eliminate the comments and NSLog’s and I think the following is equivalent and 
a bit more concise. Note that performOnMainThread also includes a main thread 
check with the same wait=YES.

Unfortunately this still doesn’t eliminate the -XstartOnFirstThread hang. Still 
looking at that. The hang doesn’t ever get into the block. The paths to get 
here are slightly different but I haven’t figured out where the difference 
amounts to a bug.

+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block {
//if ([NSThread isMainThread] && wait == YES) {
/*
if ([NSThread isMainThread]) {
NSLog(@"ThreadUtilities perform main and wait");
//block();
[self performOnMainThread: on:self withObject:block waitUntilDone:wait];
} else {
*/
if (wait == YES) {
NSLog(@"ThreadUtilities not main and wait");
[self performOnMainThread:@selector(invokeBlock:) on:self 
withObject:block waitUntilDone:YES];
} else {
void (^blockCopy)(void) = Block_copy(block);
[self performOnMainThread:@selector(invokeBlockCopy:) on:self 
withObject:blockCopy waitUntilDone:NO];
}
//}
}

+ (void)performOnMainThread:(SEL)aSelector on:(id)target withObject:(id)arg 
waitUntilDone:(BOOL)wait {
NSLog(@"ThreadUtilities performOnMainThread target %@ with %@ on main %d 
name %@ wait %d", target, arg, [NSThread isMainThread],[[NSThread 
currentThread] name], wait);
NSLog(@"%@", NSThread.callStackSymbols);
NSLog(@"*");
if ([NSThread isMainThread] && wait == YES) {
[target performSelector:aSelector withObject:arg];
} else {
[target performSelectorOnMainThread:aSelector withObject:arg 
waitUntilDone:wait modes:javaModes];
}
}

invokeBlock is simply block()

+ (void)invokeBlock:(void (^)())block {
  block();
}

If really of interest the difference I’m seeing so far is this 
for -XstartOnFirstThread which works

2023-03-17 21:40:34.426 java[25865:2604833] java_md_macosx.m 
CreateExecutionEnvironment
2023-03-17 21:40:34.427 java[25865:2604833] java_md_macosx.m 
CreateExecutionEnvironment before MacOSXStartup
2023-03-17 21:40:34.427 java[25865:2604833] java_md_macosx MacOSXStartup
2023-03-17 21:40:34.427 java[25865:2604833] java_md_macosx ParkEventLoop
2023-03-17 21:40:34.427 java[25865:2604834] java_md_macosx.m 
CreateExecutionEnvironment
2023-03-17 21:40:34.427 java[25865:2604834] java_md_macosx.m 
CreateExecutionEnvironment before MacOSXStartup
2023-03-17 21:40:34.427 java[25865:2604834] java_md_macosx.m 
CreateExecutionEnvironment after MacOSXStartup
2023-03-17 21:40:35.342 java[25865:2604835] ThreadUtilities performOnMainThread 
target ThreadUtilities with <__NSMallocBlock__: 0x61d0b630> on main 0 name  
wait 0
2023-03-17 21:40:35.343 java[25865:2604835] (
0   libosxapp.dylib 0x00010b9b3f43 
+[ThreadUtilities performOnMainThread:on:withObject:waitUntilDone:] + 131
1   libawt_lwawt.dylib  0x00010bded11a +[AWTStarter 
start:] + 346
2   libawt_lwawt.dylib  0x00010bdeedb1 
Java_sun_lwawt_macosx_LWCToolkit_initAppkit + 273
3   ??? 0x00011ccfdde0 0x0 + 
4778352096
)
2023-03-17 21:40:35.343 java[25865:2604835] *
2023-03-17 21:40:35.343 java[25865:2604833] ThreadUtilities invokeBlockCopy
2023-03-17 21:40:35.343 java[25865:2604833] (
0   libosxapp.dylib 0x00010b9b3dcb 
+[ThreadUtilities invokeBlockCopy:] + 43
1   Foundation  0x7ff8039c9190 
__NSThreadPerformPerform + 177
2   CoreFoundation  0x7ff802b4eb78 
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
3   CoreFoundation  0x7ff802b4eb27 
__CFRunLoopDoSource0 + 157
4   CoreFoundation  0x7ff802b4e901 
__CFRunLoopDoSources0 + 212
5   CoreFoundation  0x7ff802b4d57b 
__CFRunLoopRun + 929
6   CoreFoundation  0x7ff802b4cb60 
CFRunLoopRunSpecific + 560
7   libjli.dylib0x00010ae4dd42 
CreateExecutionEnvironment + 450
8   libjli.dylib0x00010ae49a13 JLI_Launch + 
1411
9   java0x00010ada1c05 main + 389
10  dyld0x7ff802740310 start + 2432
)
2023-03-17 21:40:35.343 java[25865:2604833] *
2023-03-17 21:40:35.586 java[25865:2604835] ThreadUtilities not main and wait
2023-03-17 21:40:35.586 java[25865:2604835] ThreadUtilities 

Re: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev


> On Mar 17, 2023, at 7:49 AM, Alan Snyder  wrote:
> 
> block() means invoke the block
> 
>> On Mar 17, 2023, at 5:34 AM, Michael Hall via Cocoa-dev 
>>  wrote:
>> 
>> 
>> 
>>> On Mar 17, 2023, at 6:51 AM, Michael Hall  wrote:
>>> 
>>>> 
>>> 
>>> Sorry, I looked at your link and am still not sure this is correct if you 
>>> are already on the main thread.
>>> 
>> 

Alan,

Sorry for not believing you the first time.

Semantics. Not what I usually think of with ‘block’. 

Sort of a difficult thing to pin down.  What I first saw after the hang running 
a Panama early access for the jdk…

"AWT-EventQueue-0" #14 prio=6 os_prio=31 cpu=16.71ms elapsed=5.56s 
tid=0x7f7fdc833400 nid=26883 runnable  [0x73baf000]
   java.lang.Thread.State: RUNNABLE
at 
sun.java2d.opengl.CGLGraphicsConfig.getCGLConfigInfo(java.desktop@19-panama/Native
 Method)
at 
sun.java2d.opengl.CGLGraphicsConfig.getConfig(java.desktop@19-panama/CGLGraphicsConfig.java:137)
at 
sun.awt.CGraphicsDevice.(java.desktop@19-panama/CGraphicsDevice.java:99)
at 
sun.awt.CGraphicsEnvironment.initDevices(java.desktop@19-panama/CGraphicsEnvironment.java:169)
- locked <0x00070fc0f658> (a sun.awt.CGraphicsEnvironment)

I went to a current jdk 19 to maven build some of Martin’s project last night 
which still hangs but shows…

"AWT-EventQueue-0" #21 [27907] prio=6 os_prio=31 cpu=13.40ms elapsed=3.81s 
tid=0x7fdb3785de00 nid=27907 runnable  [0x717f5000]
   java.lang.Thread.State: RUNNABLE
at 
sun.java2d.metal.MTLGraphicsConfig.tryLoadMetalLibrary(java.desktop@19.0.2/Native
 Method)
at 
sun.java2d.metal.MTLGraphicsConfig.getConfig(java.desktop@19.0.2/MTLGraphicsConfig.java:140)
at 
sun.awt.CGraphicsDevice.(java.desktop@19.0.2/CGraphicsDevice.java:78)
at 
sun.awt.CGraphicsEnvironment.initDevices(java.desktop@19.0.2/CGraphicsEnvironment.java:169)
- locked <0x00070fcf11d8> (a sun.awt.CGraphicsEnvironment)

Different path same result.
___

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: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev


> On Mar 17, 2023, at 6:51 AM, Michael Hall  wrote:
> 
>> 
> 
> Sorry, I looked at your link and am still not sure this is correct if you are 
> already on the main thread.
> 

Searching shows this used enough places you would think it has to be correct. 
Again, I guess maybe I’ll try a little debugging.

Mike

___

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: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev


> On Mar 17, 2023, at 6:31 AM, Michael Hall  wrote:
> 
> 
> 
>> On Mar 17, 2023, at 4:07 AM, Saagar Jha  wrote:
>> 
>> The implementation of -[ThreadUtilities performOnMainThreadWaiting:block:] 
>> does the right thing here, which is calling the block directly if it’s 
>> already running on the main thread: 
>> https://github.com/openjdk/jdk/blob/9d518c528b11953b556aa7585fc69ff9c9a22435/src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m#L103.
>>  It’s likely that your hang is caused by something else.
>> 
>> Saagar Jha
>> 
> 
> That was already suggested but I couldn’t understand how it could be done. 
> I’ll take it as correct with the second opinion. The stack trace seemed to 
> indicate this as the place. Maybe something within the block.
> I may have to debug further. 
> 
> Thanks.
> 
> Mike
> 

Sorry, I looked at your link and am still not sure this is correct if you are 
already on the main thread.

[ThreadUtilities performOnMainThreadWaiting:YES block:^(){

+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block {
if ([NSThread isMainThread] && wait == YES) {
block();
} else {
if (wait == YES) {
[self performOnMainThread:@selector(invokeBlock:) on:self 
withObject:block waitUntilDone:YES];
} else {
void (^blockCopy)(void) = Block_copy(block);
[self performOnMainThread:@selector(invokeBlockCopy:) on:self 
withObject:blockCopy waitUntilDone:NO];
}
}
}

Given that the code is on the main thread and wait is indicated the code blocks 
correct? Until when? If it is until it is off the main thread, does that 
happen? Best case, whenever it comes out of the wait it falls through without 
ever attempting to run the block at all doesn’t it? Wouldn’t correct be 
something like…

+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block {
if ([NSThread isMainThread] && wait == YES) {
block();
}
if (wait == YES) {
[self performOnMainThread:@selector(invokeBlock:) on:self 
withObject:block waitUntilDone:YES];
} else {
void (^blockCopy)(void) = Block_copy(block);
[self performOnMainThread:@selector(invokeBlockCopy:) on:self 
withObject:blockCopy waitUntilDone:NO];
}
}

___

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: OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev


> On Mar 17, 2023, at 4:07 AM, Saagar Jha  wrote:
> 
> The implementation of -[ThreadUtilities performOnMainThreadWaiting:block:] 
> does the right thing here, which is calling the block directly if it’s 
> already running on the main thread: 
> https://github.com/openjdk/jdk/blob/9d518c528b11953b556aa7585fc69ff9c9a22435/src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m#L103.
>  It’s likely that your hang is caused by something else.
> 
> Saagar Jha
> 

That was already suggested but I couldn’t understand how it could be done. I’ll 
take it as correct with the second opinion. The stack trace seemed to indicate 
this as the place. Maybe something within the block.
I may have to debug further. 

Thanks.

Mike

___

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


OS/X Java native bug

2023-03-17 Thread Michael Hall via Cocoa-dev
This was just brought to my attention on a java mailing list.

An option was added to java startup options on OS/X -XstartOnFirstThread so the 
code starts on the main Appkit thread.

Currently if a java Swing application starts with that option it hangs. 

https://bugs.openjdk.org/browse/JDK-8289573

This bug indicates a regression from an earlier one…

https://bugs.openjdk.org/browse/JDK-7128597

For apparently pretty much the same problem it suggests…

> If +[NSThread isMainThread] returns true, you can simply call your 
> initializer directly, instead of punting it onto the main thread.

That from a former Apple Java Swing support person. Mike Swingler. 

Which resulted in a fix including…

> the addition of +[NSThread isMainThread] was done at Mike's suggestion

I found some old code that seems to include that fix…

if ([NSThread isMainThread]) {
  [GraphicsConfigUtil _getCGLConfigInfo: retArray];
  } else {
  [GraphicsConfigUtil performSelectorOnMainThread: 
@selector(_getCGLConfigInfo:) withObject: retArray waitUntilDone: YES];
  }

The current code that seems to regress to the original bug now looks like…

 [ThreadUtilities performOnMainThreadWaiting:YES block:^(){

With what appears to be all the code that was in the selector _getCGLConfigInfo 
following in an inline block. This always appears to run on main thread which I 
think is the reverted to bug. 

I’m not that familiar with code including blocks. Is there some fairly easy way 
to modify this and keep it running as an inline block but also add the 
isMainThread check to not always run on the main thread?
Or, would you have to put it back to include the check and invocation of a 
standalone selector?



___

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: Question about Info.plist's

2020-08-19 Thread Michael Hall via Cocoa-dev


> On Aug 19, 2020, at 10:04 PM, Ben Kennedy  wrote:
> 
> 
>> On 19 Aug 2020, at 7:45 pm, Michael Hall via Cocoa-dev 
>>  wrote:
>> 
>> Something else I’m curious about is doesn’t this somehow invalidate any 
>> application signing that’s been done?
> 
> Code signing happens last, even if you put your shell script phase at the 
> very bottom. (Observe the build output in the Report Navigator.)
> 
> b
> 

Thanks.

___

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

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

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

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


Re: Question about Info.plist's

2020-08-19 Thread Michael Hall via Cocoa-dev


> On Aug 19, 2020, at 9:04 PM, Michael Hall  wrote:
> 
> 
> I’m not familiar with the Plistbuddy that’s been mentioned. 

I see that is in fact builtin. Wasn’t aware. Something else I’m curious about 
is doesn’t this somehow invalidate any application signing that’s been done?
___

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: Question about Info.plist's

2020-08-19 Thread Michael Hall via Cocoa-dev


> On Aug 19, 2020, at 11:07 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Question:
> 
> Is there a way to use a key/value that was defined earlier in the plist file
> to define a value for a later key?
> 

Maybe off-topic but this used to be supported for Java applications for pre-set 
variables. I’m not remembering exactly for what . Directories, I think, like 
$APPDIR could be referenced anywhere.

I’m not familiar with the Plistbuddy that’s been mentioned. But I’ve written 
java code to parse, modify and create plist files. If not the bin ones then 
they are XML so a parser for that can be used. It’s been sometimes handy for 
java applications like when Apple’s apps cut over to Oracle ones. I had code 
that could handle simple application conversions or provide a starting 
framework for more complex app’s. 

More off-topic. I was recently looking at that code again. A (java) application 
I sometimes use  had added a nice new Python interface. It didn’t seem to work 
for me because it was trying to use an old python 2, instead of the 3,7.3 I got 
by having Anaconda installed. After some discussion on the app mailing list it 
was mentioned that Anaconda did some things in .bash_profile. 
I found that if I did a Terminal execution of the app like…

/Applications/weka-3-9-3-corretto-jvm.app/Contents/MacOS/JavaAppLauncher

It ran correctly, picking up my current user .bash_profile. Normally OS X 
applications don’t seem to pick this up but get a very stripped down bash 
environment. 

I suspected changes to the PATH environment variable might be all that the new 
app needed. I couldn’t figure out an easy way to change that at execution time. 
So I was thinking of parsing the info.plist and adding LSEnvironment, 
environment variable entries myself for PATH and maybe any other Anaconda 
related. So I would have a script that would do something like…

env | java plistparser

I decided first to try and see if I could use the XCode plist editor to make 
the changes manually. It didn’t work. It seemed like in the past you had to do 
something like duplicate the application to get plist changes to take effect? 
But I didn’t want to get into that. Or it might be that PATH is not an 
environment variable that can be plist changed? I would be sort of curious to 
know if that is the case if anyone knows? 
Anyhow, at that point it seemed easier for my own use simply to have an alias 
in my .bash_profile to the above command line application invocation.


___

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: Thoughts on Cocoa

2019-10-04 Thread Michael Hall via Cocoa-dev


> On Oct 4, 2019, at 2:41 PM, Lars C. Hassing via Cocoa-dev 
>  wrote:
> 
> 
> On 4 Oct 2019, at 21.00, Jens Alfke wrote:
> 
> The people I hear complaining about this are those who, like you, didn't move 
> to Cocoa. Carbon was a _temporary_ transition API*. It was necessary when Mac 
> OS X shipped in March 2001, but even though it wasn't yet formally 
> deprecated, it was clear it would be.
> 
> Carbon might have started as a temporary solution, but it ended up a very 
> good solution,
> which Apple stated in "It’s the Future” (Last updated: 2004-06-28)
> 
>   "Apple is committed to the HIViews, Carbon events, and nib files for Carbon 
> implementations of the user interface.
>All new controls and other features will be based on HIView.
>If you want your application to take advantage of the latest features, you 
> need to adopt the modern HIToolbox.”
> 
> https://web.archive.org/web/20080725021421/http://developer.apple.com/documentation/Carbon/Conceptual/Upgrading_HIToolbox/upgrading_hitoolbox_conc/chapter_2_section_7.html
> 
> 
> When my company was going to the Mac platform (in addition to 
> Sun+AIX+Windows),
> Carbon seemed like a good choice.
> Now we have just wasted several man years going to Cocoa.
> Microsoft is really the good guys, as somebody said, not letting developers 
> down.
> /Lars

Does anyone remember when Cocoa / Carbon / Java were all supposed to be valid 
paths forward on OS X?

A quick search turned up...
http://ec30.org/skills/mac-os-x-carbon-cocoa-development/ 


Notice the application frameworks in the image at the front.

It wasn’t always clear that Cocoa was going to be the last man standing on OS X.

___

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


Dispatch Sources

2016-12-10 Thread Michael Hall
I recently asked if anyone had suggestions concerning a seeming kqueue deadlock 
in writing a OS X native java WatchService.
Someone, I think off-list, did suggest using VDKQueue[1], an updated version of 
Uli Kusterer’s UKKQueue. 
Looking at that the main difference seemed to be that is used GCD for the event 
notification part.
As a quick test I changed my code to do this…


dispatch_async(dispatch_get_main_queue(),^{
[self 
postJava:context about:FILE_MODIFIED withWatchKey:watchKey];
});

This didn’t seem to correct the problem. 

I did notice that Dispatch Sources[2] seem to be a newer feature that is even 
more GCD based. 
I looked for examples of it’s use…
googling
DISPATCH_SOURCE_TYPE_VNODE filetype:m

There do appear to be examples for directories but as near as I’ve been able to 
tell in quick scans of the source they only have an open file descriptor for 
the directory and then sometimes seem to sweep the directory to determine what 
has changed.

Is this correct? Is this the normal use for this code. You would not have open 
fd’s for every file in the directory?
Does anyone know of any full fledged file monitors implemented with this that I 
might of missed in my search?  (open source)
Would my chances be decent that using this might avoid the deadlock issues I 
was running into with kqueue? 

[1] https://github.com/bdkjones/VDKQueue <https://github.com/bdkjones/VDKQueue>
[2] 
https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html#//apple_ref/doc/uid/TP40008091-CH103-SW22
 
<https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html#//apple_ref/doc/uid/TP40008091-CH103-SW22>

Michael Hall



___

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

2016-11-24 Thread Michael Hall
> 
>> On Nov 24, 2016, at 3:27 PM, Alex Zavatone <z...@mac.com> wrote:
>> 
>> 
>> Yeah, I was trying to see if it would be possible for whatever service is 
>> failing to send events to display periodic output that would help you 
>> determine what stops working and why.  
>> 
>> I'll send you some samples offline that might help.

I received your examples. Mac ones could be useful.

Thanks.

Although the code does pass all the Basic JDK WatchService tests, so I think my 
code is pretty much correct.
I would still be interested if anyone had any thoughts on why java going into a 
wait would cause the kqueue to stop posting events?
Or would know of general reasons why kqueue would stop posting events?
I did a lot of googling on that the last time around but pretty much came up 
empty.

Michael Hall





___

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

2016-11-24 Thread Michael Hall
> On Nov 24, 2016, at 2:06 PM, Alex Zavatone <z...@mac.com> wrote:
> 
> How long does it take before it stops?  Is that time consistent?

kqueue seems to stop posting events as soon as the java code starts waiting for 
it to post them.
The kevent wait looks currently looks like this…

n = kevent64( queueFD, NULL, 0, , 1, 0,  ); 

With the timeout included this will return control to my code but with no 
events posted.

> 
> If it is, what is driving the event broadcasting and what conditions are 
> causing it so stop?
> 
See above. There are many events pending but they seem to stop posting once 
java processes it’s first batch and goes into a wait for more.

> Is there a way for your event broadcaster to fire off a useless heartbeat 
> every 15 seconds so that you can see that it's alive and you can monitor the 
> log just for the heartbeat in another window so that you can catch when it 
> stops and see what conditions changed to make it stop?

As above, with no timeout the code never posts. With a timeout it successfully 
returns to my code but no events are posted.
> 
> A few years ago, when running one app in the iOS Simulator, I used to 
> redirect NSLog to a file on my HD that I could tail in the a terminal window.
> 
> Then I'd open up n+1 terminal windows, with each one tail-ing the log file.
> I'd use AWK or SED or something to pattern match and filter the output so 
> that each window would track specific conditions and output.
> 
> This made it convenient to monitor the patient (the app) and keep track of 
> specific conditions on a per window (per readout) basis.

Not sure I’m following. I can output messages fine. But I’m not sure what I can 
put in them that will tell me anything since nothing is actually happening.

Michael Hall



> 
> 
> GL.
> 
> 
> On Nov 24, 2016, at 1:52 PM, Michael Hall wrote:
> 
>> This is not entirely Cocoa, it is java, but it involves ObjectiveC JNI, the 
>> java native interface. 
>> Also a little bit of a long story, my apologies.
>> Specifically the question concerns kqueue, my code is based on the Uli 
>> Kusterer ObjectiveC interface to that. 
>> Java nio.2 introduced the WatchService class, this monitors directories and 
>> tells you of any file system changes.
>> For OS X the implementation is a pure java polling one. Unlike about every 
>> other platform where they are native based.
>> I tried to write a native OS X one based on kqueue.
>> I got it so that it passes the nio.2 Basic WatchService tests. 
>> There is another set of tests for the code under load. LotsOfEvents. I ran 
>> into what seems a deadlock condition between the java code and the kqueue 
>> code. 
>> Left it at that months if not years ago, but the code was sitting up on 
>> github.
>> I noticed someone had recently forked it. I looked at their fork out of 
>> curiosity and they said LotOfEvents ran. 
>> I figured some minor miracle had occurred. I finally sat down and looked at 
>> it today and unfortunately it is just that I left the code in a state where 
>> it didn’t do the actual test to see if it was successful, which it is not, 
>> but instead just runs through and finishes without indicating any errors. So 
>> it just looked like it worked.
>> 
>> What the test code does is fire a lot of events. It processes what it has 
>> and then waits to see if it gets more. 
>> 
>> For some reason while it waits for more events kqueue stops posting events 
>> entirely.  If you check for anything returned the test fails.
>> If you don’t, but let the test to continue to run. kqueue happily resumes 
>> pumping events with the debug messages making it look like it works.
>> 
>> Any thoughts? I thought I’d ask here before I spend a whole lot of time (or 
>> LotsOfTime) spinning wheels back at square 1 again.
>> 
>> Michael Hall
>> 
>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 


___

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

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

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

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

kqueue

2016-11-24 Thread Michael Hall
This is not entirely Cocoa, it is java, but it involves ObjectiveC JNI, the 
java native interface. 
Also a little bit of a long story, my apologies.
Specifically the question concerns kqueue, my code is based on the Uli Kusterer 
ObjectiveC interface to that. 
 Java nio.2 introduced the WatchService class, this monitors directories and 
tells you of any file system changes.
For OS X the implementation is a pure java polling one. Unlike about every 
other platform where they are native based.
I tried to write a native OS X one based on kqueue.
I got it so that it passes the nio.2 Basic WatchService tests. 
There is another set of tests for the code under load. LotsOfEvents. I ran into 
what seems a deadlock condition between the java code and the kqueue code. 
Left it at that months if not years ago, but the code was sitting up on github.
I noticed someone had recently forked it. I looked at their fork out of 
curiosity and they said LotOfEvents ran. 
I figured some minor miracle had occurred. I finally sat down and looked at it 
today and unfortunately it is just that I left the code in a state where it 
didn’t do the actual test to see if it was successful, which it is not, but 
instead just runs through and finishes without indicating any errors. So it 
just looked like it worked.

What the test code does is fire a lot of events. It processes what it has and 
then waits to see if it gets more. 

For some reason while it waits for more events kqueue stops posting events 
entirely.  If you check for anything returned the test fails.
If you don’t, but let the test to continue to run. kqueue happily resumes 
pumping events with the debug messages making it look like it works.

Any thoughts? I thought I’d ask here before I spend a whole lot of time (or 
LotsOfTime) spinning wheels back at square 1 again.

Michael Hall




___

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: What is overwriting 'isa' with 0xbaddc0dedeadbead ?

2015-05-23 Thread Michael Hall
 On May 23, 2015, at 8:18 AM, Scott Ribe scott_r...@elevated-dev.com wrote:
 
 DEADBEEF is what some memory debugging utilities write over memory it's 
 freed. If it’s showing in your isa pointer, then you’re accessing an object 
 which has been dealloc’d.
 

This is probably the main one I was remembering. It looks like it has been used 
for memory as you suggest.

This though
https://en.wikipedia.org/wiki/Magic_number_%28programming%29 
https://en.wikipedia.org/wiki/Magic_number_(programming)
mentions that it is…
 also used in the original Mac OS https://en.wikipedia.org/wiki/Mac_OS 
 operating systems https://en.wikipedia.org/wiki/Operating_system
I thought it was file magic and was thinking it’s use  even pre-dated Mac’s. 
There were, I thought, a couple others as well but my memory is probably not 
the best going back that far.

Michael Hall





___

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: What is overwriting 'isa' with 0xbaddc0dedeadbead ?

2015-05-22 Thread Michael Hall
 On May 22, 2015, at 8:42 PM, Jens Alfke j...@mooseyard.com wrote:
 
  0xbaddc0dedeadbead

Check Google, or duckduckgo?
It seems to come up in a variety of crashes. I’m not sure that I could pick 
Swift out of them, but they pretty exclusively seem to be Yosemite.

 This is obviously a magic value that someone put there to indicate the 
 pointer isn’t valid, but I’ve never seen that particular value before. I’m 
 guessing that it’s something to do with the Swift runtime.

It does seem to sort of have the old Apple thing of using hex to make words 
that are used as magic. But not completely consistently. You would think you 
could be even more creative these days with 64 bit addresses to work with. I 
tried to narrow my search to Apple sites to see if I could find it mentioned in 
doc somewhere but came up empty. 

Michael Hall





___

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: NSMapTable with C strings as keys

2013-05-29 Thread Michael Hall
On May 28, 2013, at 5:55 PM, Greg Parker wrote:

 On May 28, 2013, at 3:39 PM, Michael Hall mik3h...@gmail.com wrote:
 On May 28, 2013, at 5:27 PM, Michael Hall wrote:
 I thought I saw SHA-1 being used as a general purpose hash function 
 somewhere sort of surprising recently but I'm not remembering exactly where.
 
 Ah, sorry to reply to my own but maybe this was it…
 
 https://news.ycombinator.com/item?id=4036878
 SHA-1is still used in applications such as git as a general purpose hash 
 function.
 
 Not this particular article where I saw it but I recently signed up on git 
 and think I may of seen it's use then.
 
 For this sort of use I expect SHA-1 is chosen in part because it computes a 
 bigger value than a typical hash-table hash. (160 bits for SHA-1 and 256+ for 
 SHA-2, versus 32 or 64 for a typical hash table.)
 
 git in particular wants an ID that is as globally unique as possible so 64 
 bits is not enough, is computing a small number of hashes so the extra 
 per-hash setup time for a cryptographic hash is less important, and is 
 probably I/O bound anyway so the extra CPU time of a cryptographic hash is 
 less important.

This is sort of off-topic but I think this is a little tougher to be sure on 
isn't it? 
2*64 if a pretty big number. DES is sort of got on the outs because they were 
coming up with attacks that could go after it non-stop brute force in about 
2*56 tries. The birthday paradox may apply here too where collisions are much 
more likely at something a lot less than 2*64. I don't know. SHA-1 for purposes 
like like Jens suggested, to avoid forgeability, is also I thought sort of on 
the outs due to progress in attackers figuring out how to cause collisions. But 
it has been around a long time and I suppose converting to SHA-2 or something 
else for something like git would be a pretty large effort. If attackers aren't 
the concern I think it might still make a slow and large but tried and true as 
far as it goes general purpose hash, with usually good attributes for collision 
resistance and uniform distribution.

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps 
http://www195.pair.com/mik3hall/index.html#appconverter


___

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: NSMapTable with C strings as keys

2013-05-28 Thread Michael Hall
On May 28, 2013, at 4:10 PM, Jens Alfke wrote:

 CRC is primarily a checksum, not a hash function. It's good for verifying 
 data integrity, e.g. in a network protocol or file format, but more expensive 
 than you’d like for a hash table. There are much faster hash functions: 
 Wikipedia has a good list[1].

http://en.wikipedia.org/wiki/Hash_function

Hashing with cryptographic hash functions [edit]
Some cryptographic hash functions, such as SHA-1, have even stronger uniformity 
guarantees than checksums or fingerprints, and thus can provide very good 
general-purpose hashing functions.
In ordinary applications, this advantage may be too small to offset their much 
higher cost.[5] However, this method can provide uniformly distributed hashes 
even when the keys are chosen by a malicious agent. This feature may help to 
protect services against denial of service attacks.

I thought I saw SHA-1 being used as a general purpose hash function somewhere 
sort of surprising recently but I'm not remembering exactly where. Maybe if the 
collision resistance or hash value uniformity out weigh the performance 
concerns?

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps 
http://www195.pair.com/mik3hall/index.html#appconverter





___

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: NSMapTable with C strings as keys

2013-05-28 Thread Michael Hall
On May 28, 2013, at 5:27 PM, Michael Hall wrote:

 I thought I saw SHA-1 being used as a general purpose hash function somewhere 
 sort of surprising recently but I'm not remembering exactly where.


Ah, sorry to reply to my own but maybe this was it…

https://news.ycombinator.com/item?id=4036878
SHA-1is still used in applications such as git as a general purpose hash 
function.

Not this particular article where I saw it but I recently signed up on git and 
think I may of seen it's use then.

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps 
http://www195.pair.com/mik3hall/index.html#appconverter





___

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: Sharing a file between Mac and iOS

2012-07-19 Thread Michael Hall

On Jul 19, 2012, at 5:16 PM, Dennis wrote:

 It looks like I need to explore using Dropbox.

iCloud? If these are your own application's files. Might be a possibility. 
Haven't tried it.  
___

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: Sharing a file between Mac and iOS

2012-07-19 Thread Michael Hall

On Jul 19, 2012, at 6:40 PM, Mark Munz wrote:

 iCloud? If these are your own application's files. Might be a possibility. 
 Haven't tried it.
 
 According to Apple, apps have to be on the Mac App Store in order to
 use iCloud APIs.
 That makes it an automatic 2nd choice (over something like Dropbox)
 for any dev that isn't going to be MAS-only.

True it does seem tightly coupled with the new application direction.
Thats why Dropbox is on my machine.
I'm a little surprised iCloud doesn't find a little more advocation on this 
list though.



___

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


NSFileManager directory lists and hidden files

2012-07-07 Thread Michael Hall
I am trying to write something using kqueue to monitor a directory. It is my 
understanding that for file creation I will be told a directory has been 
written to and I then have to list the directory myself to determine the file 
added.

I add the original directory path files using 
enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: which I gather 
is the preferred deep, subdirectories included, lister choice.
This seems to have an option to omit hidden files. I am not using it but  still 
do not seem to get .DS_Store

When I receive a kqueue event that a directory has been written to I attempt to 
use contentsOfDirectoryAtPath to get a shallow, no subdirectories, list I can 
check for a file I didn't previously know about. This list does appear to 
include .DS_Store, the result being that I keep thinking this is the file being 
created.

2012-07-07 17:30:56.658 java[1680:5003] UKKQueue: Detected file change: 
/Users/mjh/trz/
 [exec] 2012-07-07 17:30:56.664 java[1680:5003] created .DS_Store
 [exec] 2012-07-07 17:30:56.665 java[1680:5003] UKKQueue: Detected file 
change: /Users/mjh/trz/
 [exec] 2012-07-07 17:30:56.667 java[1680:5003] created .DS_Store

The code based on UK source as you see. 
Although I don't think relevant you might also note the java as this is being 
run off of jni. 
I just created another hidden file just to verify enumeratorAtURL would default 
skip it and it seems to default ignore.

How do I get the enumeratorAtURL to include the .DS_Store files. Or do I have 
to add my own filter to contentsOfDirectoryAtPath to skip hidden files for 
consistency?



 


___

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: NSFileManager directory lists and hidden files

2012-07-07 Thread Michael Hall

On Jul 7, 2012, at 6:48 PM, Ken Thomases wrote:

 On Jul 7, 2012, at 5:58 PM, Michael Hall wrote:
 
 How do I get the enumeratorAtURL to include the .DS_Store files.
 
 It does for me on 10.6.8.  How are you testing for a file you've seen before? 
  Maybe you did actually get it in the enumeration but your logic for 
 determining if a file is new is wrong.
 
 Regards,
 Ken
 
I think this is a never mind. Somewhere in here I'm mixing full and relative 
paths.
___

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 SDK 10.5 on XCode 4?

2012-06-04 Thread Michael Hall
 
 What new GCC? Xcode 4 dropped GCC in favor of LLVM.
 

gcc -version
i686-apple-darwin11-llvm-gcc-4.2: no input files

___

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 SDK 10.5 on XCode 4?

2012-06-04 Thread Michael Hall

On Jun 4, 2012, at 6:45 PM, Nick Zitzmann wrote:

 
 On Jun 4, 2012, at 5:26 PM, Michael Hall wrote:
 
 What new GCC? Xcode 4 dropped GCC in favor of LLVM.
 
 gcc -version
 i686-apple-darwin11-llvm-gcc-4.2: no input files
 
 That's not GCC; that's LLVM-GCC, or LLVM with a GCC front-end. The real GCC 
 was dropped from Xcode 4.
 
Ah, if something is not very complex, and most of what I do isn't, I usually 
use a one line executable file with a gcc compile. I'll try out the clang 
mentioned.
I did have to request command line tools separately with the last Xcode install 
as I remember.


___

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 know if a file has been opened before?

2012-06-04 Thread Michael Hall

On Jun 4, 2012, at 5:50 PM, Antonio Nunes wrote:

 I have implemented window state restauration in an app. This works fine for 
 re-opening documents that were open when the app was last quit. What I now 
 want to do is extend that functionality to files that were not necessarily 
 open when the app was last quit, but simply that have been opened at any time 
 before. I can't put state information into the files themselves, since they 
 are files that need to remain clean and that are not owned by my app.

I was recently looking at some old finder api's. and some of it involves fields 
that are pretty much obsolete. 
I was trying to figure out which flag bit setting corresponded to the locked 
checkbox in FileGet Info. At first I thought it was the name locked flag in 
finder flags. It turned out insted to be the node locked setting of a different 
flag. Name locked apparently had something to do with files in the old classic 
System folders. 
Assuming this bit is now never set, and not contents unpredictable, you could 
abscond with it as a user field associated with every file on the machine. Set 
it to mean whatever you want until someone else has the same 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to know if a file has been opened before?

2012-06-04 Thread Michael Hall

On Jun 4, 2012, at 9:00 PM, Fritz Anderson wrote:

 On 4 Jun 2012, at 8:53 PM, Michael Hall wrote:
 
 I was recently looking at some old finder api's. and some of it involves 
 fields that are pretty much obsolete. 
 I was trying to figure out which flag bit setting corresponded to the locked 
 checkbox in FileGet Info. At first I thought it was the name locked flag in 
 finder flags. It turned out insted to be the node locked setting of a 
 different flag. Name locked apparently had something to do with files in the 
 old classic System folders. 
 Assuming this bit is now never set, and not contents unpredictable, you 
 could abscond with it as a user field associated with every file on the 
 machine. Set it to mean whatever you want until someone else has the same 
 idea.
 
 Um. This is satire, right?
 
   — F
 

Well, probably not the best idea really. But similar fields used to actually be 
used sometime back in real coding. At least on machines I worked with way back. 
The OS even provided them.
Probably why it occurred to me. 
___

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: Bookmark alias files v. Finder alias files

2012-04-15 Thread Michael Hall

On Apr 14, 2012, at 4:39 PM, Shane Stanley wrote:

 Thanks, Charles. I guess that makes it arguably a Finder bug.

Nicely done, what was actually used on the resource forks out of curiosity?

Really, on the arguably a bug? 
I suppose if your sole criteria is minimal size.
Or maybe the criteria is age, where anything older is automatically buggy?
If your criteria is best variety of icons, then current could be argued buggy 
since it only has one icon resource to the Finder's two.
The correct argument would be if either doesn't actually function correctly as 
a file alias only then is it buggy, wouldn't it?
Given that differences in size, icon support, or whatever, aren't really, 
truly, excessive.
___

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: Bookmark alias files v. Finder alias files

2012-04-15 Thread Michael Hall

On Apr 15, 2012, at 7:36 AM, Shane Stanley wrote:

 On 15/04/2012, at 9:23 PM, Michael Hall wrote:
 
 If your criteria is best variety of icons, then current could be argued 
 buggy since it only has one icon resource to the Finder's two.
 
 But the Finder really only has one, twice.

  the Finder has *two* such ‘icns’ resources; one with ID -16496 and one with 
 ID -16455. The two ‘icns’ resources appear to be identical,

Ah, I had remembered the two different id's but missed that the resources 
appear identical. If true possibly a bug. 
A little more checking...

http://static.userland.com/Iowa/sourceListings/macbirdSource/Frontier%20SDK%204.1b1/Toolkits/Applet%20Toolkit/appletfilealias.c.html

#define kCustomAliasIconID -16496

Mention of -16545 here for example
http://www.cocoabuilder.com/archive/cocoa/15858-setting-file-icon.html

Again this seems to relate to custom icon id's so it is still possibly a 
duplicate bug. But you also still might have to do more digging to be sure 
having both id's doesn't have some special meaning to the Finder that is 
arguably non-buggy? Maybe some situation where having both id's means the 
Finder will correctly use the right icon where without the second one it 
wouldn't. Possibly an archaic situation so the newer code can omit it but the 
Finder has never been updated to change the archaic behavior? But it might take 
more verifying to be sure of which. 




___

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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Michael Hall

On Apr 14, 2012, at 5:05 AM, Ken Thomases wrote:

 You can also access the resource fork as a file by appending 
 /..namedfork/rsrc to the path.

Ken beat me to it after I found this...
Work with resource forks in the Terminal 
http://hints.macworld.com/article.php?story=2002022409532098

Ken could very well be right that it is using the resource fork in one instance 
and not the other.

I think for file alias's it actually stuck a 'alis' AppleEvent in the resource 
fork?
For example from http://en.wikipedia.org/wiki/Resource_fork

Name of resource type (actual name) Description
alis (alias)Stores an alias 
to another file, in a resource fork of a file whose alias attribute bit is set

One thing I was wondering about was that I remembered working on this code for 
open document handling...

if ( dirObjType == typeAlias) { // 'alis' ) {// open one 
file

  } else if ( dirObjType == typeAEList) {   // 'list' ) { // open 
many files
aliasHandle = (AliasHandle)NewHandle( 0L ); // get a real Handle; we'll 
resize as needed.
if ( NULL != aliasHandle ) {
int numItems = [dirObj numberOfItems];
docs = [[NSMutableArray alloc] initWithCapacity:numItems];
for ( i = 1; i = numItems; i++ ) {
NSAppleEventDescriptor *thisAlias = [dirObj 
descriptorAtIndex:i];
if ([thisAlias descriptorType] != typeAlias)
// 10.6 bmrk?
thisAlias = [thisAlias 
coerceToDescriptorType:typeAlias];

At 10.6 I found that multiple open files started using the bmrk AppleEvent type 
that I coerced to typeAlias 'alis'.
while a single file still used the 'old' typeAlias.

Seeing yours I wondered if that might apply somehow. Yours using the 'bmrk' 
type written to either the data or resource fork while the Finder still uses 
'alis' to the resource fork?

___

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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Michael Hall

On Apr 14, 2012, at 7:11 AM, Shane Stanley wrote:

 Thanks Ken and Michael. So the Finder-generated alias has a ~96KB resource 
 fork, and the bookmark-generated one has a 48KB resource fork. On comparing 
 them, it looks like the first ~48KB are identical apart from the first and 
 last few bytes -- and the second 48KB of the Finder-generated one is also the 
 same as the first 48KB except for small sections at the beginning and end.

I did a quick google out of curiosity and there doesn't appear to be much 
available anymore to handle actually looking at or working with resource forks. 
If you can examine contents you could scan for the AppleEvent id's 'alis' or 
'bmrk'. You should of course also see a file name in there somewhere. I'm not 
sure what other overhead there might be, length's maybe? 
If I had to guess the Finder is writing copies to both the resource and data 
forks. Are you sure the ~96KB isn't both forks? I can't think of a reason to 
write it twice to the same fork. But I don't think that I ever dissected one.


___

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: Seeding random() randomly

2011-05-27 Thread Michael Hall

On May 26, 2011, at 8:00 PM, Graham Cox wrote:

 I'm using random(), but every time I run my app I get the same sequence, 
 despite having this code in my app delegate's -appDidFinishLaunching method. 
 Clearly I'm not seeding it right, though I can't see why - I get a different 
 value for seed every time. What gives?
 
 
   unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
 1.0);
   
   NSLog(@launched, seed = %ld, seed );
   srandom( seed );

unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
1.0);
sleep(2);
unsigned seed2 = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
.0);
if (seed == seed2)
NSLog(@match %u %u,seed,seed2);
else 
NSLog(@mismatch %u %u,seed,seed2);

2011-05-26 21:24:23.339 SRandom[885:80f] match 4294967295 4294967295

___

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: Seeding random() randomly

2011-05-27 Thread Michael Hall

On May 26, 2011, at 10:32 PM, Jens Alfke wrote:

 
 On May 26, 2011, at 7:15 PM, Kevin Bracey wrote:
 
 srandom(time(NULL));
 
 It’s never a good idea to seed a RNG with something guessable like this. (An 
 old exploit against the Netscape browser’s SSL implementation was made 
 possible in part by doing exactly that.)
 
 All you have to do is call srandomdev() once; that will seed the generator 
 used by random() with some extremely random (“high-entropy”) data read from 
 /dev/random, which is generated by the kernel through all kinds of black 
 magic.

It lacks 'good' confusion.
http://en.wikipedia.org/wiki/Confusion_and_diffusion

Sort of like the OP's seed multiply, which just led to 'bad' confusion.


___

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: Help on Cocoa Class references

2011-01-20 Thread Michael Hall

On Jan 19, 2011, at 9:18 PM, Scott Anguish wrote:

 Apple won’t even be shipping Java with the OS in the future (there was an 
 announcement about this recently). You’ll need to get it from Oracle (who 
 Apple transferred things to as I recall in another announcement)

Announcing: OpenJDK for Mac OS X source repository, mailing list, project home
http://mail.openjdk.java.net/pipermail/macosx-port-dev/2011-January/07.html

Rumors of it's demise might be slightly exaggerated.

However, given it's deprecated status, although I believe it will continue to 
ship and be supported through 10.7, the Apple java-dev or openjdk list above 
might be more appropriate forums for discussing it.

One thing I find a little interesting is that the openjdk project is actually 
targeting a Java 7 first release. Who knows, OS X might become a bleeding edge 
java platform?


___

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


Default keyword selector type

2010-11-13 Thread Michael Hall

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

In looking at NSControl.h there is a NSKeyboardUI category definition  
with the following instance method declaration


- -- (void)performClick:sender;

This category is defined a number of places and at least some of them  
indicate that the type for sender should be (id)sender.

How is it NSControl does nothing to indicate the type?
Is id a default or is it somehow inherited in this situation?

Mike Hallhallmike at att dot net
http://www195.pair.com/mik3hall
http://www195.pair.com/mik3hall/home.html
http://sourceforge.net/projects/macnative




-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iJwEAQECAAYFAkzbYEQACgkQUvk/ZSaThTI0dgP/eQQDjK36WJFsevQWWKnJS5tI
jUbdSOWQsU1j+fF1On5FBsYT6d3CLUlMIwAOQ2NLwBpWCdT+oLcXvf+BEnxbwIM1
c1zihDj62cQ9qlJ8YuRhhBDAzWDM5aHN53mHosR0fDB6Dzgvb55DNwJ+2RivyWA0
HwD/iUbB1Mzrjdk4FRg=
=OTdF
-END PGP SIGNATURE-
___

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

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

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

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


Re: Default keyword selector type

2010-11-13 Thread Michael Hall

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On Nov 13, 2010, at 6:41 AM, Ken Thomases wrote:

From http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Conceptual/ObjectiveC/Articles/ocLanguageSummary.html#//apple_ref/ 
doc/uid/TP30001163-CH3-TPXREF106:


∙ The default return and argument type for methods is id, not int  
as it is for functions. (However, the modifier unsigned when used  
without a following type always means unsigned int.)



Your links busted, redirects to a generic index.
But answers the question. I had seen return type at least sometimes  
defaulted but hadn't seen anywhere yet that argument type defaulted.


Thanks,

Mike Hallhallmike at att dot net
http://www195.pair.com/mik3hall
http://www195.pair.com/mik3hall/home.html
http://sourceforge.net/projects/macnative




-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iJwEAQECAAYFAkzel7kACgkQUvk/ZSaThTI5RAP/Us01/Fhj09Kp1f/axebLbS9R
RHNIeVyy0YimbuvfucfW2gFY1669iJQzjTnKXRW3vpLZb8Lj+FugpVW5t8xOX/39
xzKm0LbOF4b7LgL7pHBmXDWCV2ks3P6z/k+9yDEM0dcxApBFRNPadyxLhXI51kT9
yW+dg5IXRiWrYh6m9Vw=
=3Y4O
-END PGP SIGNATURE-
___

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

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

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

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


Re: Base64 encoding (iPhone)

2010-06-01 Thread Michael Hall

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On Jun 1, 2010, at 3:13 PM, Joshua Tucker wrote:

has anyone got any working sample code for encoding an NSString  
with Base64 on the iPhone?



fwiw,
Cocoa with Love: Base64 encoding options on the Mac and iPhone
http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html

Mike Hallhallmike at att dot net
http://www195.pair.com/mik3hall
http://www195.pair.com/mik3hall/home.html
http://sourceforge.net/projects/macnative




-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)

iJwEAQECAAYFAkwFuokACgkQUvk/ZSaThTLHBgQAvnZEkUrfC3p2PDsoOW2cugdl
GNzYr41Gk9+KCBheruulyF7p5Zq/ZWC9ppBL7T9a8KpucyBsEoA3RN3w06tvK4GT
MXM3x7qSM0Fev/1HBZpKlLMC9ina10gktdGbBNdSSPB4Od0Q+yphR/rbXZrswpmx
Sj9Xye/HB1+nGsl082c=
=US45
-END PGP SIGNATURE-
___

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

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

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

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


Re: FSPathCopyObjectSync and symbolic links?

2009-04-26 Thread Michael Hall


On Apr 26, 2009, at 8:22 AM, Iceberg-Dev wrote:

Is it possible to copy a symbolic link (the symbolic link file and  
not the item it references) using the FSPathCopyObjectSync API?


No valuable info was found in the documentation, the list archive,  
google results.


The File Manager Reference
http://developer.apple.com/documentation/Carbon/Reference/ 
File_Manager/Reference/reference.html#//apple_ref/c/func/ 
FSCopyObjectSync

saying
A pointer to the source object to copy. The object can be a file or  
a directory.




would suggest to me that a symlink file would be OK.

Not sure if your searching came across FSCopyObject - /Sources/ 
FSCopyObject.c

http://developer.apple.com/SampleCode/FSCopyObject/listing3.html

but it might be informative to your question.

I was into these or similar links for a problem of my own yesterday  
but the documentation, the list archive and google results did lead  
to a resolution which they often do. I wasn't aware symlinks might be  
a problem until I started getting -1407 File Manager errors that  
seemed related to these files. Since you are aware in advance they  
might be a concern a little testing might give you a more definite  
answer and save some searching.
(Fwiw, I eliminated the use in one place of an FSSpec since these  
seem to be getting more and more deprecated these days and I used  
FSPathMakeRefWithOptions (10.4+) in another place which looked like  
it would default resolve symlinks and these changes seemed to correct  
my own problem. No -1407 errors).


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: How can I draw an election map?

2009-03-30 Thread Michael Hall


On Mar 30, 2009, at 5:07 PM, Tobias Zimmerman wrote:

I am starting a new project that involves simulating various US  
election
results.  I want to plot the results using an election map similar  
to the
ones that were all over the web during last year’s election.   
However, I

would like to do this in Cocoa/Objective-C rather than having to learn
Python or Java.


I did something, java sorry, based on...
http://www.cs.princeton.edu/introcs/35purple/

which for the mapping uses...

Data sources. We collect state and county border data from the US  
Census TIGER database. [ documentation ] The file USA.txt contains  
each state (in the Continental US) and its corresponding polygon 
(s). There are 104 polygons in total. The files NJ.txt contain each  
county in the given state. There are 3325 polygons in total over  
all states.


If you look at the java you can see how it's routines for drawing and  
filling, etc. the polygons work.
It was a little buggy in translating mouse position to map  
coordinates as I remember. Which I wanted for displaying little  
tooltip type popup windows when you did mouse over states or  
counties. For one thing to display the state or county name which it  
had no provision for and I didn't try to add. You probably would have  
to rework that if you went with ObjC anyhow.


I still haven't finished to final result version of mine but the  
shareware version for the 2008 presidential elections is at...

http://www195.pair.com/mik3hall/

It didn't exactly make me wealthy and I was a little disappointed in  
not even getting much feedback. But it had some downloads and I'd  
still like to find the time to come up with a final 2008 version and  
maybe add some other political content of some sort. Something with  
information on what's up in Washington that would allow for some  
degree of user interaction to make users views and opinions part of  
the software somehow.


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Michael Hall


On Jul 13, 2008, at 8:30 AM, Patrick Walker wrote:


My other problems seems to be -2877334 itself.  To me, that appears  
to be a rather strange value for a floating point number


Tan^-1 on -2877334 on my trusty TI-36X Solar shows that as -89.975

Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Intercepting Apple Events

2008-07-10 Thread Michael Hall


On Jul 10, 2008, at 12:24 PM, Elan Feingold wrote:


Hi,

I'm writing an application that would like to intercept Apple  
Events sent to iTunes, and possibly even reply with its own replies  
(say, if iTunes isn't running). Is such a thing possible?


I just remembered this one from the applescript-implementors list as  
well...

AE Monitor
http://software.oxalyn.com/aemonitor/index.html

Might more automagically do what I was suggesting in my last post.  
Probably still won't let you spoof yourself as another app though.


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Intercepting Apple Events

2008-07-10 Thread Michael Hall


On Jul 10, 2008, at 12:24 PM, Elan Feingold wrote:


Hi,

I'm writing an application that would like to intercept Apple  
Events sent to iTunes, and possibly even reply with its own replies  
(say, if iTunes isn't running). Is such a thing possible?


A very limited way might be with the debug environment variables.
e.g.
macosxhints.com Monitor AppleEvents an application sends and receives
http://www.macosxhints.com/article.php? 
story=20030430145833233query=bugs


The application would need to be running.
You would probably have to parse it's events from the Console. tail  
command or whatever,
If you launch it you could probably control the setting of the  
environment variables and not require the application to be Terminal  
launched?
Or you could possibly change the Info.plist using LSEnvironment.  
Although thats still not a really convenient thing to ask a user to do.


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process app.

2008-06-30 Thread Michael Hall


On Jun 30, 2008, at 3:44 PM, Ken Thomases wrote:


More techniques:

Technical Note TN2050: Observing Process Lifetimes Without Polling
http://developer.apple.com/technotes/tn/tn2050.html


Getting off-topic maybe but I did this from java.
For example...
CmdJHTML: terminated Firefox /Applications/Firefox.app pid = 3932640
CmdJHTML: launched Firefox /Applications/Firefox.app pid = 3.264063e+08

As you can see it is a bit off on getting the pid.
This was a 'real world' example of creating a Cocoa class from java  
on the fly...


public CocoaMonitor() {

if (initsel == nil) {   // Class setup complete?
if (createClassDefinition(CocoaMonitor,NSObject)) {
CocoaMonitor_class = getClass(getName());
}

I liked it enough I added it to my application as a normal  
'automation' type function. I was adding things of that sort in at  
the time.


I'm not familiar enough with loginwindow that I want to test with  
that though. So it may or may not work there.


А потом будет суп с котом!

Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: looking for a crc code

2008-06-14 Thread Michael Hall


On Jun 14, 2008, at 10:25 AM, Jens Alfke wrote:



On 14 Jun '08, at 4:59 AM, Ilan Volow wrote:

No mention at all I can find (in the 20 seconds I scanned the  
first two result pages) of any cocoa CRC implementations. If a  
newbie were to do a search like this and turned up such a  
fruitless list of leads, I wouldn't be surprised in the least   
that they came to the list and asking for a personal  
recommendation of some hard-to-find Cocoa framework from  
experienced Cocoa programmers.


Yes, but what does CRC have to do with Cocoa? It's just a function  
that takes a pointer and a length and returns an int. It'd be  
trivial to use any C implementation in a Cocoa app, so there's no  
reason to restrict the search by adding cocoa as a keyword.


I googled up this one. Might of taken more than a minute I'm afraid.
Checksum, Please
http://yamacdev.blogspot.com/2006/12/checksum-please.html

It suggests zlib which should always be available, shouldn't it?

#import Cocoa/Cocoa.h
# include sys/types.h
#include zlib.h

int main(int argc, const char * argv[]) {
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

 unsigned long crc = crc32(0L, Z_NULL, 0);
 char * test = TEST;

 crc = crc32(crc,test,4);
 fprintf(stdout,crc=%i\n,crc);
}

compiled with...
gcc -framework Cocoa -lz -o testcrc testcrc.m
(Note the -lz for zlib also find some copy of zlib.h for more info on  
the crc32() method or a adler or other zlib supported alternative)


Unfortunately, testing got sort of inconsistent results.
./testcrc
crc=-286616648

doesn't seem to work out quite the same as...
crc32 test.txt
f783d7be
(man crc32, it appears to be the tcl version mentioned in the blog  
above.).


The crc's as far as I know should be the same here, so not quite sure  
what the deal is there, but zlib crc's I think should always be  
available.


Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: looking for a crc code

2008-06-14 Thread Michael Hall

--- Andrew Farmer [EMAIL PROTECTED] wrote:


 
 Yep. There was recently a discussion of this on the
 list, actually.
 
Missed that, sorry.

   fprintf(stdout,crc=%i\n,crc);
 
 Note that this'll print out the CRC as a signed
 integer, which is  
 almost certainly not what you want.
 
  Unfortunately, testing got sort of inconsistent
 results.
  ./testcrc
  crc=-286616648
 
 Like I said. If you convert this to hex, you'll get
 0xeeea93b8, which  

That is what I got.
#-286616648
  $eeea93b8  #286616648 #-286616648 
'#65518;#65514;#65427;#65464;'

 is the correct CRC32 of test.
 
  doesn't seem to work out quite the same as...
  crc32 test.txt
  f783d7be
 
 This is the CRC32 of test\n. Watch your newlines.
 
Huh, turned invisibles on in BBEdit and thought I got
rid of that. 

But then I guess you could run the tcl one and get the
output as another option. Still no need for coding or
having to understand crc. zlib linked is probably
better performance though I'd have to guess.  
___

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

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

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

This email sent to [EMAIL PROTECTED]