Re: Radio buttons as table views

2016-04-27 Thread lorenzo

This ended up off-list. I’m reposting in case this might be of use to anyone.

> On Apr 25, 2016, at 6:26 PM, Quincey Morris 
>  wrote:
> 
> (we’re off-list, as of your last message — not sure if this was accidental, 
> but feel free to repost to list if you wish)
> 
> On Apr 25, 2016, at 12:33 , Lorenzo Thurman  wrote:
>> 
>> I'll have to manually manage the select/unselect. 
> 
> Not necessarily. It’s possible to bind the value of the checkboxes to a Bool 
> property of your ‘objectValue’ object. 
> 
> All you need is for this to be a “derived” property — one whose value is 
> dependent on the value of a property in a different object (e.g. in your view 
> controller, or your data source or delegate), and is made KVO compliant by 
> the ‘keyPathsForValuesAffecting’ mechanism, or something equivalent.
> 
> 


___

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

DirWatch

2008-05-22 Thread Lorenzo
Hi,
I need to watch at a given folder and check whenever a new file has been
copied therein. At the beginning, I fired a timer periodically getting the
list of the contents of that folder with

directoryContentsAtPath

But soon I discovered that the list includes files still in copying (not yet
the whole file). So I switched to

NewFNSubscriptionUPP
FNSubscribe

Here I get the notification only "after" a file has been totally copied into
the folder, but I can't yet find the way to know which file has been copied.
Do you know how to get that info? Thanks.


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


NSMailDelivery deliverMessage Deprecated

2008-05-22 Thread Lorenzo
Hi,I have just seen that the API

[NSMailDelivery deliverMessage:...

As been deprecated in Leopard. Is anyone know about a replacement?
I know that I can still use it, but you know, just in case...


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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

2008-05-22 Thread Lorenzo
I can't.
Think about the FNSubscribe tells me that there is something new because the
user copied 2 new files into that folder, but only one file is totally
copied, the other one is still in copying. So now I scan the folder with
directoryContentsAtPath
I compare with the previous list and I know that there are 2 new files.
Well, one file is totally copied and the other one could be still in
copying.


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Jens Alfke <[EMAIL PROTECTED]>
> Date: Thu, 22 May 2008 16:35:01 -0700
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: DirWatch
> 
> 
> On 22 May '08, at 3:32 PM, Lorenzo wrote:
> 
>> Here I get the notification only "after" a file has been totally
>> copied into
>> the folder, but I can't yet find the way to know which file has been
>> copied.
>> Do you know how to get that info? Thanks.
> 
> Just remember the previous list of files as an NSSet, then get the
> current set of files and subtract the old one to see what's new.
> 
> ‹Jens

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: DirWatch

2008-05-23 Thread Lorenzo
Thank you so much Ken,
I would like to use the BSD/POSIX file access routines.
May you give me a pointer?

Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Ken Thomases <[EMAIL PROTECTED]>
> Date: Thu, 22 May 2008 23:42:00 -0500
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: Jens Alfke <[EMAIL PROTECTED]>, Cocoa Development
> 
> Subject: Re: DirWatch
> 
> On May 22, 2008, at 10:56 PM, Ken Thomases wrote:
> 
>> On May 22, 2008, at 6:57 PM, Lorenzo wrote:
>> 
>>> I can't.
>>> Think about the FNSubscribe tells me that there is something new
>>> because the
>>> user copied 2 new files into that folder, but only one file is
>>> totally
>>> copied, the other one is still in copying. So now I scan the folder
>>> with
>>>   directoryContentsAtPath
>>> I compare with the previous list and I know that there are 2 new
>>> files.
>>> Well, one file is totally copied and the other one could be still in
>>> copying.
>> 
>> You can try FSGetCatalogInfo() and the kFSNodeForkOpenBit of the
>> nodeFlags field of the FSCatalogInfo structure to test if the file
>> is still open.  I'm not sure if this is supported on all filesystems
>> that Mac OS X supports.  It's actually very unusual for an OS or
>> filesystem implementation to keep that sort of information in
>> application-accessible form.
>> 
>> The problem on a preemptively multi-tasking system is that the
>> file's status can change between when you test and when you act on
>> the results of the test.  Generally speaking, sometimes the solution
>> to a race condition like that is to attempt to grab the contended
>> resource for exclusive access.  If you succeed, you know that nobody
>> else was using the resource, nor will they be able to start using it
>> while you're using it.
>> 
>> Again, it's quite unusual for modern OSes to support mandatory
>> locking of files in this way.  Most only provide advisory locking.
>> However, Mac OS X's File Manager still maintains provisions for it.
>> Once again, they may not work on all filesystems.  In addition to
>> the File Manager Reference, you can check out Technical Note FL37
>> <http://developer.apple.com/technotes/fl/fl_37.html
>>> , although it's nearly archaic.  (Not as archaic as the date it
>> claims, though! :)
> 
> 
> OK, so none of the above actually works in the general case on Mac OS
> X.  I checked the nodeFlags thing myself with a little test program
> and it doesn't work.  The bits indicating if forks are open are never
> set.  Also, I found a more recent technote regarding exclusive file
> access: <http://developer.apple.com/technotes/tn/tn2037.html>.
> 
> That technote, though, does indicate that the frameworks perform and
> respect advisory locking.  So, this is pretty good.  It covers the
> most common cases.  The exception would be a program using the BSD/
> POSIX file access routines directly.
> 
> Regards,
> Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTimer and NSLock

2008-07-13 Thread Lorenzo
Hi,
I need to execute a method only after a thread has been executed.
I guess I have to lock that thread but I don't know how.
The thread I should lock comes from a timer

timer = [[NSTimer scheduledTimerWithTimeInterval:timeInterval
target:self selector:@selector(UpdateWindow:)
userInfo:nil repeats:YES] retain];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSEventTrackingRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:NSModalPanelRunLoopMode];


So only when UpdateWindow as been executed I have to delete an object and
prevent to work with a null pointer. Any suggestion?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


QCView openGLContext

2008-03-13 Thread Lorenzo
Hi,
I build my app against 10.4 SDK. The compiler says that there are no errors.
My app runs on Leopard very well. But on Tiger I get this error all the time
and my app won't launch.
--
[MYQCView openGLContext] : selector not recognized [self = 0x1492fee0]
--

If I comment this line below
[[qcView openGLContext] flushBuffer];
my app launches and runs well, but of course I can't see the QCView contents
properly. I have seen that this API is available in 10.5 and later. Anyway
my compiler doesn't protest when I build my app against 10.4 SDK. This a
part, how can I make this work on Tiger too? Any workaround?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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: QCView openGLContext

2008-03-13 Thread Lorenzo
Thank you Sam,
Your code looks promising. One question, should the renderView be a simple
NSView, a QCView or an NSOpenGLView?
If not a QCView, should I fire a timer each 1/60 sec in order to render with
renderAtTime into the NSView or OpenGLView?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]
> 
> From: Sam McDonald <[EMAIL PROTECTED]>
> Date: Thu, 13 Mar 2008 19:23:35 -0500
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: QCView openGLContext
> 

> I have programmed cocoa for less than a year, so if I say something stupid
> please bare with me.  Of the programming I have done most of it has been with
> QC apps.  From what I remember the openGLContext was added in 10.5 (and made
> me very excited).
> 
> In my 10.4 application I created a glcontext, set its view, and rendered to it
> using a QCRenderer.  Here is what that looked like, please don't laugh at my
> ugly code, this is some of the first objective-c I wrote:
> 
> //Create OpenGL context used to render the QCRenderers and attach it to the
> rendering view
> NSOpenGLPixelFormatAttribute attributes[] = {NSOpenGLPFAAccelerated,
> NSOpenGLPFANoRecovery, NSOpenGLPFADoubleBuffer, NSOpenGLPFADepthSize, 24, 0};
> 
> glPixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
> _glContext = [[NSOpenGLContext alloc] initWithFormat:glPixelFormat
> shareContext:nil];
> [_glContext setView:_renderView];
> 
> // Create QCRenderers from composition file
> compositionPath = [bundle pathForResource:_compositionName ofType:@"qtz"];
> renderer = [[QCRenderer alloc] initWithOpenGLContext:_glContext
> pixelFormat:glPixelFormat file:compositionPath];
> 
> 
> 
> This will allows you to flush your buffer, but doesn't produce nearly as nice
> code as what the 10.5 stuff allows you to do.
> 
> Sam McDonald
> Trimonix
> 
> 
> On Mar 13, 2008, at 6:53 PM, Lorenzo wrote:
> 
>> Hi,
>> I build my app against 10.4 SDK. The compiler says that there are no errors.
>> My app runs on Leopard very well. But on Tiger I get this error all the time
>> and my app won't launch.
>> --
>> [MYQCView openGLContext] : selector not recognized [self = 0x1492fee0]
>> --
>> 
>> If I comment this line below
>> [[qcView openGLContext] flushBuffer];
>> my app launches and runs well, but of course I can't see the QCView contents
>> properly. I have seen that this API is available in 10.5 and later. Anyway
>> my compiler doesn't protest when I build my app against 10.4 SDK. This a
>> part, how can I make this work on Tiger too? Any workaround?
>> 
>> 
>> Best Regards
>> -- 
>> Lorenzo
>> email: [EMAIL PROTECTED]
>> 
>> ___
>> 
>> 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/sammcd%40trimonix.com
>> 
>> This email sent to [EMAIL PROTECTED]
> 
> 


___

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: QCView openGLContext

2008-03-14 Thread Lorenzo
David,
In my application I have several openGLViews running in turn their drawRect
method at 60 FPS. So in the drawRect method of each openGLView I set the
current context to the openGLView context. These openGLViews have nothing to
do with the QCView.

Well, when I call [qcView reanderAtTime...
I get a freeze all the time. I have to reboot my machine.
I guessed that there was a conflict between the openGLView current context
and the qcView context when I called renderAtTime. So I tried to set the
qcView context as current before calling renderAtTime. And this worked.
The bug has gone. I have built a small project to verify that. I can send it
to you. Let me know.

Of course I can't use this solution on Tiger because [qcView openGLContext]
is available on 10.5 or higher. I mentioned that because the compiler, when
building against 10.4 SDK, doesn't advise me, unlikewise it does when I try
to use other APIs reserved for 10.5. I supposed that this was an XCode's
minor bug, so I mentioned it here in order to get some feedback about it. If
other developers confirm that, I will file a bug.
I run XCode 3.0 - Xcode IDE: 921.0 - Xcode Core: 921.0 - ToolSupport: 893.0

Actually I have adopted the solution posted by Sam, here in the list.
I render the qc composition into an openGLView using a timer.
It works well. I still get some garbage when resizing this view, but I hope
to fix it soon with the reshape and update APIs.

Thanks for your support.


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: David Duncan <[EMAIL PROTECTED]>
> Date: Fri, 14 Mar 2008 10:49:18 -0700
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: QCView openGLContext
> 
> On Mar 13, 2008, at 4:53 PM, Lorenzo wrote:
> 
>> If I comment this line below
>>[[qcView openGLContext] flushBuffer];
>> my app launches and runs well, but of course I can't see the QCView
>> contents
>> properly. I have seen that this API is available in 10.5 and later.
>> Anyway
>> my compiler doesn't protest when I build my app against 10.4 SDK.
>> This a
>> part, how can I make this work on Tiger too? Any workaround?
> 
> 
> To answer the original question however, a QCView doesn't respond to
> the -openGLContext message until 10.5, so that is why on 10.4 you get
> that message. You shouldn't need to flush the buffer for your content
> to appear correctly however, so you might want to elaborate more on
> what issue your having specifically.
> --
> David Duncan
> Apple DTS Animation and Printing
> [EMAIL PROTECTED]
> 
> 
> 

___

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: QCView openGLContext

2008-03-14 Thread Lorenzo
Thanks David,

> As for the garbage, it is likely that your QC Compositions are missing
> a Clear Patch. Adding one should prevent the garbage.
I already clear the color buffer with glClear.
If you meant something different, please let me know.

NSOpenGLContext*cContext = [NSOpenGLContext currentContext];
[[self openGLContext] makeCurrentContext];

glClear(GL_COLOR_BUFFER_BIT);
[mRenderer renderAtTime:time arguments:nil];
[[self openGLContext] flushBuffer];

[cContext makeCurrentContext];

The qc-openGLView is nested within a series of NSSplitViews. I don't get the
garbage when I resize the splitView "A" (left-right), instead I get the
garbage when I resize the splitView "B" (up-down). Maybe the trouble comes
from the
splitView resizeSubviewsWithOldSize
Of the splitView "B", which redraws the openGLView too earlier.
I will investigate on this issue.


As far as the multiple contexts, I already share the context when I initiate
the 2nd, the 3rd... openGLViews

self = [self initWithFrame:frame]
NSOpenGLContext*aContext = [[NSOpenGLContext alloc]
initWithFormat:pixelFormat shareContext:[m1stGLView
openGLContext]];
[self setOpenGLContext:aContext];
[aContext setView:self];

I get a new context for each new openGLView, I suppose.
Do you think it is right?

P.S. I didn't know you were from the DTS Animation and Printing. Great!


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: David Duncan <[EMAIL PROTECTED]>
> Date: Fri, 14 Mar 2008 13:39:42 -0700
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: QCView openGLContext
> 
> On Mar 14, 2008, at 12:56 PM, Lorenzo wrote:
> 
>> I will file a bug.
>> I run XCode 3.0 - Xcode IDE: 921.0 - Xcode Core: 921.0 -
>> ToolSupport: 893.0
> 
> Please file it, its always good to know what will help our
> developers :).
> 
>> Actually I have adopted the solution posted by Sam, here in the list.
>> I render the qc composition into an openGLView using a timer.
>> It works well. I still get some garbage when resizing this view, but
>> I hope
>> to fix it soon with the reshape and update APIs.
> 
> 
> From what it sounds it seems like thats a good solution, although I'd
> also wonder why you have multiple GL contexts in a single window, as
> this is not the best route for performance. You might want to look
> into merging all of your OpenGL content into a single context instead
> of the multiple contexts you have.
> 

> --
> David Duncan
> Apple DTS Animation and Printing
> [EMAIL PROTECTED]
> 
> 
> 

___

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]


Leopard on PPC

2008-03-26 Thread Lorenzo
Hi,
I have compiled my Cocoa application against SDK 10.4.
While my application runs well on both Leopard and Tiger on Intel machines,
It run on PPC machines only with Tiger. On PPC machines with Leopard it
won't launch. Any idea about the origin of the trouble?

Some of my settings:
ARCHS = ppc i386
VALID_ARCHS = ppc64 ppc7400 ppc970 i386 x86_64 ppc
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
MACOSX_DEPLOYMENT_TARGET = 10.4
GCC_MODEL_TUNING = G4
GCC_FAST_OBJC_DISPATCH = YES


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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: Leopard on PPC

2008-03-26 Thread Lorenzo
Thanks,
actually I get this crash log on the Console

Path:/Applications/MyApp 1.2.3/MyApp.app/Contents/MacOS/MyApp
Identifier:  com.myapp.myapp
Version: 1.2.3 (1.2.3)
Code Type:   PPC (Native)
Parent Process:  launchd [104]

Date/Time:   2008-03-26 20:33:19.245 +0200
OS Version:  Mac OS X 10.5.2 (9C31)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0014
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.CoreFoundation  0x91ef3354
_CFStringCreateWithFormatAndArgumentsAux + 112
1   com.apple.CoreFoundation  0x91ef33e8 CFStringCreateWithFormat +
44
2   com.apple.CoreFoundation  0x91ea0da0
__CFDictionaryHandleOutOfMemory + 56
3   com.apple.CoreFoundation  0x91ea2510 __CFDictionaryGrow + 452
4   com.apple.CoreFoundation  0x91ea3830 CFDictionaryAddValue + 252
5   com.apple.CoreFoundation  0x91ea3f60 CFDictionaryCreate + 104
6   com.apple.CoreFoundation  0x91f37c0c -[__NSPlaceholderDictionary
initWithObjects:forKeys:count:] + 972
7   com.apple.CoreFoundation  0x91f3a7d4 +[NSDictionary
dictionaryWithObjectsAndKeys:] + 692
8   com.apple.AppKit  0x9462362c -[NSTableColumn
_postColumnDidResizeNotificationWithOldWidth:] + 384
9   com.myapp.myapp   0x00120d48 0x1000 + 1178952
10  com.myapp.myapp   0x00120b30 0x1000 + 1178416
11  com.apple.AppKit  0x9462f034 -[NSTableView numberOfRows]
+ 180
12  com.apple.AppKit  0x94619774 -[NSTableView
_verifySelectionIsOK] + 100
13  com.apple.AppKit  0x946196e8 -[NSTableView
_tileAndRedisplayAll] + 244
14  com.apple.AppKit  0x946193d8 -[NSTableView
setDataSource:] + 260
15  com.apple.AppKit  0x94525a94 -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 1048
16  com.apple.AppKit  0x9451d170 loadNib + 224
17  com.apple.AppKit  0x9451cb14 +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] + 840
18  com.apple.AppKit  0x9451c6f0 +[NSBundle(NSNibLoading)
loadNibNamed:owner:] + 336
19  com.apple.AppKit  0x9451c3d8 NSApplicationMain + 332
20  com.myapp.myapp   0x2ed8 0x1000 + 7896
21  com.myapp.myapp   0x2bdc 0x1000 + 7132

Thread 0 crashed with PPC Thread State 32:
  srr0: 0x91ef3354  srr1: 0xf030   dar: 0x0014 dsisr: 0x4000
r0: 0x91ef334cr1: 0xb060r2: 0x0078r3: 0x
r4: 0x0003r5: 0xr6: 0x002cr7: 0x0e03
r8: 0xr9: 0x   r10: 0x9308009c   r11: 0x84044422
   r12: 0x   r13: 0x0021bfa0   r14: 0x   r15: 0xa09bf4f8
   r16: 0xa099567c   r17: 0x1407f040   r18: 0xa099567c   r19: 0x
   r20: 0xffdfc070   r21: 0x   r22: 0xa057c174   r23: 0x
   r24: 0x0002   r25: 0xa057c174   r26: 0x   r27: 0xb144
   r28: 0x   r29: 0xffdfc030   r30: 0xa058476c   r31: 0x91ef32ec
cr: 0x24044422   xer: 0x2000lr: 0x91ef334c   ctr: 0x92f66970
vrsave: 0x



Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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: Leopard on PPC

2008-03-26 Thread Lorenzo
Hi Laurent,
I am going to debug and let you know. Right now I have found these lines.
Might they cause the trouble on Leopard && PPC?

number = CFNumberCreate(NULL, kCFNumberFloatType, &destSize.width);
options = [NSDictionary dictionaryWithObjectsAndKeys:
(id) kCFBooleanTrue,   (id) kCGImageSourceShouldCache,
(id) kCFBooleanTrue,   (id)
kCGImageSourceCreateThumbnailFromImageIfAbsent,
(id) number,   (id) kCGImageSourceThumbnailMaxPixelSize,
NULL];



options = [NSDictionary dictionaryWithObjectsAndKeys:
(id) kCFBooleanTrue,(id) kCGImageSourceShouldCache,
(id) kCFBooleanTrue,(id) kCGImageSourceShouldAllowFloat,
NULL];


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Laurent Cerveau <[EMAIL PROTECTED]>
> Date: Wed, 26 Mar 2008 21:29:45 +0100
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: "cocoa-dev@lists.apple.com" , Jean-Daniel Dupas
> <[EMAIL PROTECTED]>
> Subject: Re: Leopard on PPC
> 
> It seems to be debuggable by yourself. Can you start up in XCode on
> PPC? If not you can simply launch the app under gdb and put a
> breakpoint at +[NSDictionary dictionaryWithObjectsAndKeys:] with br.
> From then it would be interesting to check the passed argument (on
> PPC the argument of a method function are in register $r3, $r4, be
> careful that an objective-C call will have implicit $r3 being self and
> $r4 being the selector). You can also also crash and simply go up in
> the backtrace. Then you can find which arguments is bogus (and then why)
> 
> HTH
> 
> laurent
> 
> On Mar 26, 2008, at 9:02 PM, Lorenzo wrote:
> 
>> Thanks,
>> actually I get this crash log on the Console
>> 
>> Path:/Applications/MyApp 1.2.3/MyApp.app/Contents/MacOS/
>> MyApp
>> Identifier:  com.myapp.myapp
>> Version: 1.2.3 (1.2.3)
>> Code Type:   PPC (Native)
>> Parent Process:  launchd [104]
>> 
>> Date/Time:   2008-03-26 20:33:19.245 +0200
>> OS Version:  Mac OS X 10.5.2 (9C31)
>> Report Version:  6
>> 
>> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
>> Exception Codes: KERN_PROTECTION_FAILURE at 0x0014
>> Crashed Thread:  0
>> 
>> Thread 0 Crashed:
>> 0   com.apple.CoreFoundation  0x91ef3354
>> _CFStringCreateWithFormatAndArgumentsAux + 112
>> 1   com.apple.CoreFoundation  0x91ef33e8
>> CFStringCreateWithFormat +
>> 44
>> 2   com.apple.CoreFoundation  0x91ea0da0
>> __CFDictionaryHandleOutOfMemory + 56
>> 3   com.apple.CoreFoundation  0x91ea2510 __CFDictionaryGrow
>> + 452
>> 4   com.apple.CoreFoundation  0x91ea3830
>> CFDictionaryAddValue + 252
>> 5   com.apple.CoreFoundation  0x91ea3f60 CFDictionaryCreate
>> + 104
>> 6   com.apple.CoreFoundation  0x91f37c0c -
>> [__NSPlaceholderDictionary
>> initWithObjects:forKeys:count:] + 972
>> 7   com.apple.CoreFoundation  0x91f3a7d4 +[NSDictionary
>> dictionaryWithObjectsAndKeys:] + 692
>> 8   com.apple.AppKit  0x9462362c -[NSTableColumn
>> _postColumnDidResizeNotificationWithOldWidth:] + 384
>> 9   com.myapp.myapp   0x00120d48 0x1000 + 1178952
>> 10  com.myapp.myapp   0x00120b30 0x1000 + 1178416
>> 11  com.apple.AppKit  0x9462f034 -[NSTableView
>> numberOfRows]
>> + 180
>> 12  com.apple.AppKit  0x94619774 -[NSTableView
>> _verifySelectionIsOK] + 100
>> 13  com.apple.AppKit  0x946196e8 -[NSTableView
>> _tileAndRedisplayAll] + 244
>> 14  com.apple.AppKit  0x946193d8 -[NSTableView
>> setDataSource:] + 260
>> 15  com.apple.AppKit  0x94525a94 -[NSIBObjectData
>> nibInstantiateWithOwner:topLevelObjects:] + 1048
>> 16  com.apple.AppKit  0x9451d170 loadNib + 224
>> 17  com.apple.AppKit  0x9451cb14 +
>> [NSBundle(NSNibLoading)
>> _loadNibFile:nameTable:withZone:ownerBundle:] + 840
>> 18  com.apple.AppKit  0x9451c6f0 +
>> [NSBundle(NSNibLoading)
>> loadNibNamed:owner:] + 336
>> 19  com.apple.AppKit  0x9451c3d8 NSApplicationMain +
>> 332
>> 20  com.myapp.myapp   0x2ed8 0x1000 + 7896
>> 21  com.myapp.myapp   0x2bdc 0x1000 + 7132
>> 
>> Thread 0 crashed with PPC Thread State 32:
>>  srr0: 0x91ef3354  srr1: 0xf030   dar: 0x0014 dsisr:
>> 0x4000
>>r0: 0x91ef334cr1: 0xb060r2: 0x0078r3:
>> 0x
>>  

NSShadow on a raster image

2008-04-05 Thread Lorenzo
As I understand, NSShadow works on vectorial paths only.
If so, how can I apply a shadow to a raster image with alpha? The image has
an irregular border with a half-a-transparence. On Photoshop of course this
can be done.



Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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: NSShadow on a raster image

2008-04-05 Thread Lorenzo
You are right, it worked even with images.


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Jean-Daniel Dupas <[EMAIL PROTECTED]>
> Date: Sat, 05 Apr 2008 15:06:22 +0200
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: NSShadow on a raster image
> 
> 
> Le 5 avr. 08 à 13:42, Lorenzo a écrit :
> 
>> As I understand, NSShadow works on vectorial paths only.
>> If so, how can I apply a shadow to a raster image with alpha? The
>> image has
>> an irregular border with a half-a-transparence. On Photoshop of
>> course this
>> can be done.
>> 
>> 
>> 
>> Best Regards
>> -- 
>> Lorenzo
> 
> What make you think that shadows apply only to path ? I'm often using
> shadow with image.
> 
> [myShadow set];
> [myImage drawAtPoint:...];
> 
> 
> 

___

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]


Image Processing

2008-04-06 Thread Lorenzo
Still working with image-processing...
I have a source image 1680 x 1050 with (just a case) 240 dpi.
I load it with

sourceImage  = [[NSImage alloc] initWithContentsOfFile:path]];

But when I ask for its size with

NSSize imageSize = [sourceImage size];

I don¹t get the real pixel size (1680 x 1050), but I get (504 x 315) so when
I do some task (like mixing this image with another image), using a
temporary image

NSImage  *tempImage = [[NSImage alloc] initWithSize:imageSize];
[tempImage lockFocus];
[sourceImage draw...
[watermarkImage draw...
[tempImage unlockFocus];

I end with a smaller tempImage (504 x 315) at 72 dpi. Too bad.
I even tried to get the real image pixels with

NSImageRep*imRep = [sourceImage bestRepresentationForDevice:nil];
NSSizeimageSize = NSMakeSize([imRep pixelsWide],
  [imRep pixelsHigh]);

Now imageSize is really 1680 x 1050 so I try to create the tempImage with
that imageSize, and mix the 2 images with

NSImage  *tempImage = [[NSImage alloc] initWithSize:imageSize];
[tempImage lockFocus];
[sourceImage draw...
[watermarkImage draw...
[tempImage unlockFocus];

but it didn't help at all. In this case I get a destination image with the
same size as the original (1680 x 1050), but the original image is drawn
therein in a smaller area (504 x 315) in the letf-bottom corner.

So, please how should I work to always get a destination tempImage which has
the original imageSize at 72 dpi or the original imageSize at 240 dpi?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


mouseDown on NSScrollView

2008-04-09 Thread Lorenzo
I have subsclassed a NSScrollView and overrided the mouseDown: method.
Then I create the MYScrollView programmatically and add it to the window's
contentView. I can quite see it but when I click on it, the method
mouseDown: gets never invoked. What do I miss?

Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


Multiple NSViews

2008-04-11 Thread Lorenzo
I have defined an NSView "info view" on IB.
This view contains several NSTextFields.
Now I want to programmatically create copies of this view and attach them to
the objects on my window. So if on my window I have 10 objects, I should see
the 10 objects, each one having its "info view". Each view reports
information about each object on the screen.
What's the best way to do that?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


dataWithPDFInsideRect doesn't clip

2008-04-12 Thread Lorenzo
I have subclassed an NSView (myView) and added it within a pageView. Within
myView's drawRect method I draw myImage using

[myImage drawInRect:mInRect fromRect:mFromRect

Even when mInRect is larger than myView's bounds I properly get the clipped
image on the screen, but when I get
[pageView dataWithPDFInsideRect:[pageView bounds]];
the image is not clipped at all. Its frame is just equal to the mInRect on
the pageView. I give you some data.

pageView frame {{0, 0}, {640, 400}}
myImage  size  {1500, 1000}
myView   frame {{20, 70}, {600, 300}}
mInRect{{0, -50}, {600, 400}}
mFromRect  {{0, 0}, {1500, 1000}}

The strange thing is that on the screen I get the right result while
dataWithPDFInsideRect gives me the wrong result. Do I miss something?
Should I specify to clip myView someway?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


dataWithPDFInsideRect doesn't clip

2008-04-18 Thread Lorenzo
I rotate a NSView with setFrameCenterRotation. It looks perfect on the
screen. Then I call [superview dataWithPDFInsideRect:[superview bounds]];

On the pdf, the view is properly rotated but it looks larger than the real
one. It seems that dataWithPDFInsideRect didn't clip the view.
What should I do to print my superview as WYSYWYG?



Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


Cannot find an icon

2008-04-21 Thread Lorenzo
When I compile then launch my app, I get this message on the Console
Could not find image named 'icnabcd'.

Now, there is no such an icon named that way on my nib file.
Anyway I started a search on the project and found the following lines in
the Nib file



icnabcd


So I tried to replace the string icnabcd with icn_onOff which really exists
on my interface, but my app still keeps on saying

Could not find image named 'icnabcd'.

I cleaned, quit Xcode 3.0, deleted my app's pref file, delete the build
folder, relaunched Xcode, compiled... unsuccessfully.
Also, there is no trace now on my project about icnabcd, nor spotlight finds
anything. Any idea???



Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


One pixel width. One.

2008-04-25 Thread Lorenzo
I am trying to draw a line with 1 pixel width. No matter whether the view is
scaled or scrolled, I want to see a 1 pixel thick line. I scale the view
with

NSRect frameSize = [self frame].size;
NSSize newSize = NSMakeSize(frameSize.width / mScaleFactor,
 frameSize .height / mScaleFactor);
[self setBoundsSize:newSize];


In the drawRect method I code

[[NSGraphicsContext currentContext] setShouldAntialias:NO];
[NSBezierPath setDefaultLineWidth:1.0 / mScaleFactor];
[NSBezierPath strokeLineFromPoint:NSMakePoint(0.0, 10.0
  toPoint:NSMakePoint(10.0, 10.0)];

I works pretty well, but sometimes, depending on the scroll position or the
mScaleFactor, I get a line with 2 pixels width. Even with a mScaleFactor =
1, if I scroll the view, sometimes it looks with 2 pixels width. I even
tried to always set the width to 0.1 and mScaleFactor to always 1. Same
result. And I even tried to always set bounds Origin and bounds Size to
(int) values. Same result.

What do I miss?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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: One pixel width. One.

2008-04-25 Thread Lorenzo
Joe, thank you. That page helps. I succeeded, but I had to set the width to
0.01 because if I set it to zero I get a 2 pixels thick line when the scale
is different than 1.0. Don't know why. Please follow me.

After scaling the view with

  scale = 1.33;
  [self setBoundsSize:NSMakeSize((int)([self frame].size.width  / scale),
 (int)([self frame].size.height / scale))];

I get these logs in the drawRect method

scale 1.33
frame {{0, 0}, {1166, 1253}},
bounds {{-140, -50}, {875, 941}}

As you can see the frame and bounds values are all integers now.
Now I draw a vertical line

[NSBezierPath setDefaultLineWidth:0.0];
bot = NSMakePoint(0.5, 0.5);
top = NSMakePoint(0.5, 9.5);
[NSBezierPath strokeLineFromPoint:bot toPoint:top];

And the lines looks 2 pixels thick. Dam! So I tried to set

[NSBezierPath setDefaultLineWidth:0.01 / scale];

And it worked at any scale. Can't guess why! With 0.001 I don't see any
line. Strange story, it works with zero, with 0.01/1.33 and it doesn't work
with 0.001 / 1.33. Any idea?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Joe Goh <[EMAIL PROTECTED]>
> Date: Fri, 25 Apr 2008 17:31:17 +0800
> To: cocoa-dev@lists.apple.com, Lorenzo <[EMAIL PROTECTED]>
> Subject: Re: One pixel width. One.
> 
> On 4/25/08, Lorenzo <[EMAIL PROTECTED]> wrote:
>>  I am trying to draw a line with 1 pixel width. No matter whether the view is
>>  scaled or scrolled, I want to see a 1 pixel thick line.
> 
> I highly, highly recommend reading this article:
> http://wincent.com/a/about/wincent/weblog/archives/2007/01/offbyone.php
> 
> I wanted to do the exact same thing in my app last year and this
> article saved the day for me.
> 
> HTH,
> Joe Goh
> FunkeeMonk Technology
> http://www.funkeemonk.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 [EMAIL PROTECTED]


Re: Leopard on PPC

2008-04-28 Thread Lorenzo
Hi Clark,
I had time to go back on this trouble again. My client, who has never been
able to run my app on his PPC with Leopard, sent me a new crash log. This
time I didn't use CFNumberRef but I used just NSNumber.

NSNumber*width = [NSNumber numberWithInt:(int)(size.width)];
options = [NSDictionary dictionaryWithObjectsAndKeys:
  [NSNumber numberWithBool:YES],  (id) kCGImageSourceShouldCache,
  [NSNumber numberWithBool:YES],
  (id)kCGImageSourceCreateThumbnailFromImageIfAbsent,
  width,(id)kCGImageSourceThumbnailMaxPixelSize,
  nil];

As I explained, this crash never occurs on Intel machines with Leopard nor
on PPC machines with Tiger. It occurs only with PPC and Leopard.


The crash log
-
Code Type:   PPC (Native)
Parent Process:  launchd [139]

Date/Time:   2008-04-27 11:04:07.866 +0100
OS Version:  Mac OS X 10.5.2 (9C7010)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib 0x8944 __memcpy + 420
1   libobjc.A.dylib   0x942cfec4 fixupSelectorsInMethodList
+ 100
2   libobjc.A.dylib   0x942d152c _class_getMethodNoSuper +
204
3   libobjc.A.dylib   0x942c62e8
_class_lookupMethodAndLoadCache + 192
4   libobjc.A.dylib   0x942d8104 objc_msgSend + 260
5   libobjc.A.dylib   0x942c7d30 _class_initialize + 456
6   libobjc.A.dylib   0x942c628c
_class_lookupMethodAndLoadCache + 100
7   libobjc.A.dylib   0x942d8104 objc_msgSend + 260
8   com.apple.Foundation  0x951a1ba0 _NSOutOfMemoryErrorHandler
+ 60
9   com.apple.CoreFoundation  0x95549e08
__CFStringChangeSizeMultiple + 1196
10  com.apple.CoreFoundation  0x9554a674 __CFStringAppendBytes + 856
11  com.apple.CoreFoundation  0x95552ab8
_CFStringAppendFormatAndArgumentsAux + 5232
12  com.apple.CoreFoundation  0x95553370
_CFStringCreateWithFormatAndArgumentsAux + 140
13  com.apple.Foundation  0x9507c504 -[NSPlaceholderString
initWithFormat:locale:arguments:] + 148
14  com.apple.Foundation  0x950e7f7c -[NSString
initWithFormat:locale:] + 52
15  com.apple.Foundation  0x950e7c40 -[NSNumber
descriptionWithLocale:] + 648
16  com.myapp.myapp   0x00124884 0x1000 + 1194116
17  com.myapp.myapp   0x001246f0 0x1000 + 1193712
18  com.apple.AppKit  0x947d3034 -[NSTableView numberOfRows]
+ 180
19  com.apple.AppKit  0x947bd774 -[NSTableView
_verifySelectionIsOK] + 100
20  com.apple.AppKit  0x947bd6e8 -[NSTableView
_tileAndRedisplayAll] + 244
21  com.apple.AppKit  0x947bd3d8 -[NSTableView
setDataSource:] + 260
22  com.apple.AppKit  0x946c9a94 -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 1048
23  com.apple.AppKit  0x946c1170 loadNib + 224
24  com.apple.AppKit  0x946c0b14 +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] + 840
25  com.apple.AppKit  0x946c06f0 +[NSBundle(NSNibLoading)
loadNibNamed:owner:] + 336
26  com.apple.AppKit  0x946c03d8 NSApplicationMain + 332
27  com.myapp.myapp   0x29dc 0x1000 + 6620
28  com.myapp.myapp   0x26e0 0x1000 + 5856




Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Clark Cox <[EMAIL PROTECTED]>
> Date: Thu, 27 Mar 2008 08:29:58 -0700
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: Laurent Cerveau <[EMAIL PROTECTED]>, "cocoa-dev@lists.apple.com"
> 
> Subject: Re: Leopard on PPC
> 
> On Wed, Mar 26, 2008 at 4:04 PM, Lorenzo <[EMAIL PROTECTED]> wrote:
>> Hi Laurent,
>>  I am going to debug and let you know. Right now I have found these lines.
>>  Might they cause the trouble on Leopard && PPC?
>> 
> 
> No, but this line will cause problems when/if you build for 64-bit:
>> number = CFNumberCreate(NULL, kCFNumberFloatType, &destSize.width);
> 
> Use kCFNumberCGFloatType instead of kCFNumberFloatType, and make sure
> that you later CFRelease(number). Or just use NSNumber.
> 
>> options = [NSDictionary dictionaryWithObjectsAndKeys:
>> (id) kCFBooleanTrue,   (id) kCGImageSourceShouldCache,
>> (id) kCFBooleanTrue,   (id)
>> kCGImageSourceCreateThumbnailFromImageIfAbsent,
>> (id) number,   (id) kCGImageSourceThumbnailMaxPixelSize,
>> NULL];
>> 
>> 
>> 
>> options = [NSDictionary dictionaryWithObjectsAndKeys:
>> (id) kCFBooleanTrue,(id) kCGImageSourceShouldCache,
>> (id) kCFBooleanTrue,(id) kCGImageSourceShouldAllowFloat,
&g

Re: Leopard on PPC

2008-04-28 Thread Lorenzo
Hi Nick, my client sent me this info about his machine.

Model Name:Power Mac G4 (Mirror Door)
Model Identifier:  PowerMac3,6
Processor Name:PowerPC G4  (3.2)
Processor Speed:   1.25 GHz
Number Of CPUs:2
L2 Cache (per CPU):256 KB
L3 Cache (per CPU):2 MB
Memory:2 GB
Bus Speed: 167 MHz
Boot ROM Version:  4.4.8f2
Graphics Card  ATI Radeon 9800 Pro
GPU Chipset Model  ATY,R350
GPU VRAM (Total):  256 MB
System Version:Mac OS X 10.5.2 (9C7010)
Kernel Version:Darwin 9.2.2

And I compiled my app with
ARCHS = ppc i386
VALID_ARCHS = ppc64 ppc7400 ppc970 i386 x86_64 ppc
MACOSX_DEPLOYMENT_TARGET = 10.4
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
GCC_MODEL_TUNING = G4

And no, my app gets just a few MB of RAM.
Never got a crash on a Intel machine.


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Nick Zitzmann <[EMAIL PROTECTED]>
> Date: Mon, 28 Apr 2008 01:34:46 -0600
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: Leopard on PPC
> 
> 
> On Apr 28, 2008, at 1:31 AM, Lorenzo wrote:
> 
>> 8   com.apple.Foundation  0x951a1ba0
>> _NSOutOfMemoryErrorHandler
>> + 60
> 
> 
> Are you sure your program is not trying to exceed the 4 GB memory
> limit? Does this happen on PPC64 as well?
> 
> Nick Zitzmann
> <http://www.chronosnet.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 [EMAIL PROTECTED]


Working with svg

2008-05-04 Thread lorenzo

Hi,
I'm using web-kit for loading an svg map in my application, I want to  
store the map data in memory for redisplay with some mods (like  
changing the colors at given population data etc.).
I'm thinking to trasform svg data in xml plain data and managing an  
nsxmldocument for storing changes but I don't know how render the web- 
view with xml
Perhaps I shouldn't convert data to xml but working directly with svg  
format, how can I store the whole file in memory for editing?

I'm a rookie programmer I'm not sure my question has sense :)
Bye

 
 
___


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

2008-02-26 Thread Lorenzo
Thank you David,
I have already a QCRenderer class to create OpenGL Textures from a QC, but
in this case (a simple file browser) I have found the QCView useful enough.
I have got the snapshot using my OpenGL routines (using the OpenGL context
from the QCView) and it worked fine.
Thanks for replying.


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: David Duncan <[EMAIL PROTECTED]>
> Date: Tue, 26 Feb 2008 09:57:09 -0800
> To: [EMAIL PROTECTED]
> Cc: cocoa-dev@lists.apple.com
> Subject: Re: QCView
> 
> On Feb 26, 2008, at 7:03 AM, [EMAIL PROTECTED] wrote:
> 
>> I am building on 10.4 and I would like to get a preview of a Quartz
>> Composition. The API snapshotImage works only on Leopard. So I have
>> tried
>> unsuccessfully to lockFocus drawRect and unlockFocus then save the
>> TIFFRepresentation, which results in an empty image.
>> The line pdfData = [oQCView dataWithPDFInsideRect:[oQCView bounds]];
>> returns a white image.
>> 
>> Any idea? Should I work with the QCRenderer?
> 
> QC renders via OpenGL, so yes you should try using the QCRenderer
> instead.
> 
>> Also, I have found pauseRendering and resumeRendering working on
>> Leopard
>> only too. So how to perform this actions on Tiger? The API
>> stopRendering
>> erases the QCView.
> 
> You will probably have to resort to the QCRenderer for this as well.
> 
>> My target is (on Tiger): I have a text list of QC files with their
>> icons. I
>> click on a row of the list and I see a static preview of the first
>> frame of
>> the QC in a QCView. I double click and I play the QC. Other double
>> click and
>> I pause the QC (still visible). May I have a pointer? Thanks.
> 
> 
> For specific details, you might want to consul the QuartzComposer-Dev
> list, as the QC engineers monitor that list more so than this one.
> --
> David Duncan
> Apple DTS Animation and Printing
> [EMAIL PROTECTED]
> 
> 
> 

___

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]


QTMovieView and glView crash

2008-02-27 Thread Lorenzo
Hi,
I can quite load a QT movie on a QTMovieView with setMovie: and play it.
This works well unless I simultaneously refresh an openGL view at 60 FPS.
The 2 views are on 2 different windows of my Cocoa application, built on
10.4 SDK.

So if I don't call the [glView drawRect:rect]; the QT movie plays properly
in the QTMovieView. If I call the [glView drawRect:rect]; the QT movie looks
black and if I try to play it, my machine freezes. I have to reboot.

In the drawRect method I do stuffs like
glClear(mClearMask);
[[NSOpenGLContext currentContext] flushBuffer];

Could this flushBuffer conflict with the QTMovieView methods?
Any idea?


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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]


CoreData error after moving to Xcode 5

2013-11-15 Thread lorenzo
I'm returning to a project after having upgraded to Xcode 5 a couple of
weeks ago and I'm getting this error:

"iCloud sync fails with “CoreData: Ubiquity: Invalid option: the value for
NSPersistentStoreUbiquitousContentNameKey should not contain periods"

I never saw this in later versions of Xcode 4.

I've found a couple of stackoverflow posts on this, but no one seems to
have a definitive answer as to why I get this error now and how I can fix
it.
Can someone enlighten me?
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: Automatically resize parent view when subviews resize

2014-04-14 Thread lorenzo

On 2014-04-14 09:28, Fritz Anderson wrote:
On 13 Apr 2014, at 11:01 PM, Lorenzo Thurman  
wrote:


I have an NSView with two subviews (A & B) placed horizontally with 
respect to each other. The subviews can take a variable number of 
uniformly sized subviews. I’ve placed these constraints on subviews A 
& B, (all done in IB):

(They should both have the same height)

Top space to container
Bottom space to container
Horizontal spacing between A & B
Intrinsic View -> Placeholder -> Width checked to None
Horizontal content hugging priority set to 1

The left has:
Leading space to container

The right has:
Trailing space to container

The parent view has:
Intrinsic View -> Placeholder -> Width checked to None
Horizontal content hugging priority set to 1

With these constraints, I would expect the parent view to resize 
itself horizontally as the subviews (A & B) try to expand to 
accomodate the addition of more subviews. But instead, the parent view 
does not resize at all, subviews A & B do not resize and their 
subviews are crammed together as more are added. If I remove the 
Horizontal spacing between A & B, they both resize horizontally, and 
if I add enough subviews to each, they extend beyond the right edge of 
the parent view.


So, how what mojo do I need to apply to get the parent to resize 
horizontally?
I’m really just getting started with Auto layout, and it seems more 
confusing than it probably really is or should be.

Thanks


What constraints are you putting on the subviews you add dynamically to 
A and B?


— F


The subviews, a subclass of NSView, are made up of three views, a 
vertical NSSlider, an NSTextfield rotated 90 degrees and pinned
to the left side of the slider and another textfield pinned to the 
bottom of the slider. This subview returns a height of 150.0 and width 
of 50 for its inrtinsic size.


The subviews set top/bottom space to container, with 5px between each.



___

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: Automatically resize parent view when subviews resize

2014-04-14 Thread lorenzo

On 2014-04-14 12:39, Kyle Sluder wrote:

On Mon, Apr 14, 2014, at 10:20 AM, lorenzo wrote:

On 2014-04-14 09:28, Fritz Anderson wrote:
>
> What constraints are you putting on the subviews you add dynamically to
> A and B?

The subviews, a subclass of NSView, are made up of three views, a
vertical NSSlider, an NSTextfield rotated 90 degrees and pinned
to the left side of the slider and another textfield pinned to the
bottom of the slider. This subview returns a height of 150.0 and width
of 50 for its inrtinsic size.

The subviews set top/bottom space to container, with 5px between each.


Did you remember to call
-setTranslatesAutoresizingMaskIntoConstraints:NO on all your
dynamically-added subviews?

--Kyle Sluder


Yes I do. I call it on on the various subviews, but not on the parent 
view.

___

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

Auto layout and re-sizing subviews.

2014-05-06 Thread lorenzo
I posted this on SO, but got no answers, so I'm trying here and mabe I 
can get some help.:


I have a window into which I horizontally add two subviews. Into each 
subview, I place a variable number of subviews made up of a vertical 
slider, a text field rotated 90 degrees and placed to the left of the 
slider and another textfield, placed just under the slider. The slider 
subview's constraints are done in code, the parent views are both done 
in IB. When I add more slider views to the left window than the subview 
can handle in its default size, it resizes horizontally and forces the 
window's content view (and window) to also resize horizontally. Great, 
that's just what I want. But if I add more slider subviews than can fit 
in the right subview, they just get squeezed together and the subview 
does not expand as the left. I layout the slider views using code with 
this category converted to support NSViews, instead of UIVews:


UIView+AutoLayout1: https://github.com/jrturton/UIView-Autolayout

The constraints for the left and right subviews are more or less the 
same. I can't figure out why the right view does not resize as the left 
view does.


Here is a link to a sample project that demonstrates the problem: 
http://www.spikesoft.net/wp-content/uploads/2014/05/SliderTest.zip


Can someone point me in the right direction?
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: Cocoa-dev Digest, Vol 14, Issue 7

2017-01-04 Thread Lorenzo Thurman

> On Jan 4, 2017, at 2:00 PM, cocoa-dev-requ...@lists.apple.com wrote:
> 
> Hi all
> I would like to get your experience of using tableViewSelectionDidChange 
> notification of NSTableView. I have 2 table using in my application. When I 
> click first table row, it is selected and row shown as blue. When I click 
> second table row, first table row color becomes gray but still selected. When 
> I select the same row (selected gray row) in first table, 
> tableViewSelectionDidChange method is not called because it is the same row.
> What is the best way to get still notification to click the same row? Is it 
> possible to use NSTableView action property using Selector? If so, is there 
> any side effect of using the NSTableView#action?
> func onAction(sender : NSTAbleView){//This is called irrespective of row 
> is selected before or not
> }

What you have to do is when you get the didselect notification in the one 
table, you need to unselect from the other table. There are a couple of small 
issues with this still, and you lose the selection in the first table, if that 
matters. I'll send you a link to some old code where I had a similar issue. 
It's ObjC, but should be adaptable to Swift.

___

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


NSStatusItem launches twice when checking launch at login

2014-10-31 Thread Lorenzo Thurman
I have an NSStatusItem app that I’ve had to migrate to a sandboxed app for 
release in the MAS. In its preferences window, there is a checkbox for “Launch 
at login”. If I launch the app with no preferences set (i.e. defaults delete 
my.bundle.identifier, rm ~/Library/Container/my.bundleIdentifier), open the 
preferences and check the login checkbox. the app behaves as expected in that 
the checkbox gets checked and if I logout/login, the app is launched. If I open 
the app’s preferences now, the checkbox is checked as it should be, but if I 
uncheck it and then check it again, I get a second instance of my app in the 
menu bar. Clearing the preferences again, starts the cycle over. The really odd 
thing is that I’ve only noticed this on a brand new MB Pro 15”. I also have an 
iMac that is ~2010 and another MB Pro ~2008, neither of which exhibit this 
behavior. All machines are running Yosemite. I’ve yet to test this on older 
OS’s. I never get more than two instances no matter how many times I 
uncheck/check the checkbox.  Now there are actually two separate processes, Top 
shows two different PID’s.  I thought Launch Services was supposed to prevent 
this. Since this is a sandboxed app, I added a helper app to the project which 
launches the app depending on if the checkbox was checked. I’ve added code to 
that helper to check if the app is already running. (look through 
NSRunningApplications and check for my bundle identifier). This doesn’t prevent 
the second instance from occurring. So anyone have any ideas why this might be 
happening? 

On a side note. how does one debug the helper app within the context of the 
main application? I can launch the helper app through its subproject and step 
through it with the debugger. If I have the main app already running when I do 
this, the helper quits without attempting to launch another instance of the 
main app. But I don’t even get NSLogs from the helper when its running from the 
main app.

Here is the code in the window controller for the preferences window:

(IBAction)toggleLoginStatus:(NSButton*)sender{


if(!SMLoginItemSetEnabled((__bridge 
CFStringRef)@“my.bundle.Identifier", (BOOL)[sender state])){
NSLog(@“Crap!");
}
}

Here is the code for the helper app:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

NSString * path;

BOOL alreadyRunning = NO;
   
NSArray *running = [[NSWorkspace sharedWorkspace] runningApplications];

for (NSRunningApplication *app in running) {
if ([[app bundleIdentifier] 
isEqualToString:@“my.bundle.Identifier"]) {
alreadyRunning = YES;
}
}

if(!alreadyRunning){
path = [[NSBundle mainBundle] bundlePath] 
stringByDeletingLastPathComponent]

stringByDeletingLastPathComponent]

stringByDeletingLastPathComponent]

stringByDeletingLastPathComponent];
[[NSWorkspace sharedWorkspace] launchApplication:path];
}

[NSApp terminate:nil];
}

- 
(And a slight rant:
The LSSharedFileList method worked just perfectly to create a startup 
item. Such a shame I had to dump perfectly good working code because of 
sandboxing.)

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

NSMenuItem's selectors messages not sent

2009-08-31 Thread Lorenzo Thurman
I have two applications, both NSStatusItems. Upon upgrading to Snow Leopard
(from 10.5), I've found that none of the messages associated with the menu
items are called. As near as I can tell, the messages are never dispatched,
at least the breakpoints in the methods are never hit. I can't find anything
in the release notes to provide a clue. Can someone provide me with some
guidance as to what may be wrong? And as a side note, how can I use the
debugger to detemine if a message is even dispatched.Thanks

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: NSMenuItem's selectors messages not sent

2009-09-01 Thread Lorenzo Thurman
I don't have GC turned on, I checked and they are not set to auto-enable. I
added this to see if the message is even being dispatched and the target
message is never sent: [[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(itemSelected:)
name:NSMenuWillSendActionNotification object:[NSApp mainMenu]]; My app
already subscribes to NSMenuDidEndTrackingNotification and its target
message is still sent, so there's something wonky with my menu items. The
menu items are added dynamically in response to user events. I initialize
the menu items in my init method and add them to the menu later. This all
worked just fine in 10.4 and 10.5. I was inclined to think there was a bug
in 10.6 that caused this, but I can't google any other similar issues. If I
inspect the menu items is gdb, they all seem to be configured correctly. The
parent menu is valid, the target(delegate) is valid, etc. I guess I'll have
to keep looking until I find out what's going on. Thanks for the reply.
On Mon, Aug 31, 2009 at 6:44 PM, Steven Degutis wrote:

> Lorenzo,
> My first guess would be that you must have turned on garbage collection at
> some point, and have a controller object that's not strongly referenced by
> other objects, floating about in your NIB. If this is the case, the object
> would deallocate pretty soon after your NIB loads, and no messages
> associated with your menu items would get sent.
>
> However, when menu items can find no targets matching their selector in the
> responder chain, they usually are disabled, rather than enabled and doing
> nothing. However, if you don't have them set to auto-enable themselves, this
> isn't the case.
>
> In any event, you can use gdb to trace the program's execution flow to find
> out exactly when certain things are happening, and put breakpoints on
> questionable lines of code.
>
> --
> Steven Degutis
> http://www.thoughtfultree.com/
> http://www.degutis.org/
>
>
> On Mon, Aug 31, 2009 at 4:20 PM, Lorenzo Thurman wrote:
>
>> I have two applications, both NSStatusItems. Upon upgrading to Snow
>> Leopard
>> (from 10.5), I've found that none of the messages associated with the menu
>> items are called. As near as I can tell, the messages are never
>> dispatched,
>> at least the breakpoints in the methods are never hit. I can't find
>> anything
>> in the release notes to provide a clue. Can someone provide me with some
>> guidance as to what may be wrong? And as a side note, how can I use the
>> debugger to detemine if a message is even dispatched.Thanks
>>
>> --
>> "My break-dancing days are over, but there's always the funky chicken"
>> --The Full Monty
>> ___
>>
>> 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/steven.degutis%40gmail.com
>>
>> This email sent to steven.degu...@gmail.com
>>
>
>
>
>


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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


Intercept tap on URL in UITextView

2009-10-14 Thread Lorenzo Thurman
I have text in a UITextView which *may* contain a URL. I would like to
intercept any tap on the URL and display the html page in an UIWebView in my
app. Can anyone point me to some sample code that does this? Or is it even
possible?Thanks!

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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


Enabling keyboard shortcuts in nswindow

2009-11-16 Thread Lorenzo Thurman
I have an NSStatusItem where I am using an NSWindow as it's About Box.  
When displayed, I can close the window via a mouse click, but not with  
the cmd w shortcut. I've looked In Apple documents about this, but the  
documentation assumes a document based app where this action is tied  
to the file->close window menuitem. How do I get this behavior for an  
NSStatusItem? Pardon me if this is basic, but I can't find the answer.  
My window uses a subclass of NSWindowController and from what I've  
found, I should be able to make it the first responder and then  
override it's (nsresponder) keyDown method to handle this event, but  
no dice; all I get is a beep. So, if someone can point me in the right  
direction, I'd appreciate it.


--"My break-dancing days are over, but there's always the funky chicken"
The Full Monty
___

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: Re: Why I can't see my localized nib?

2010-05-17 Thread Lorenzo Thurman




Sorry for the late reply..

I will try it today, but something weird is that I did a fresh new  
test project and didn't work either.


Just a stab in dark, but does your Language and Text setup match the  
localization?For example, you have a French localization (fr_FR), but  
are you setup for another variant, fr_CA maybe? 
___


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: Setting focus on NSSearchField...

2010-07-09 Thread Lorenzo Thurman

-It's better now and the menu stays after a --slight flickering

In case no one has responded to the flickering issue yet (on 10.5?).  
It may be a known bug. You'll have to disable screen updates just  
before the call that causes the flickering. And re-enable it just  
after. I think the macros are called NSDisableScreenUpdates/

NSEnableScreenUpdates  (it's been a while).
The important thing to note is that you must reenable screen updates  
within 1 sec or the OS will do it itself. HTH


--"My break-dancing days are over, but there's always the funky chicken"
The Full Monty

On Jul 8, 2010, at 5:03 PM, cocoa-dev-requ...@lists.apple.com wrote:


It's better now and the menu stays after a slight flickering

___

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: Sending email with attachments

2011-02-01 Thread Lorenzo Thurman
Thanks for the reply. Yep, I know there are a variety of mail clients out
there, so not everyone uses Mail. And that sucks. This program is actually a
port of an iPhone application for which, different mail clients are not a
problem. But at least to start, I'm only going to support Mail. I'll likely
just copy the attachment to the desktop and let the non-Mail.app users
handle it from there. For now at least.

On Tue, Feb 1, 2011 at 4:18 PM, John Joyce <
dangerwillrobinsondan...@gmail.com> wrote:

>
> On Feb 2, 2011, at 7:13 AM, lorenzo7...@gmail.com wrote:
>
> > How can one go about doing this and support 10.4-10.6? There are links
> all over the place pointing to deprecated API's (NSMailDelivery) or
> frameworks that are 10.5+ (EDMessage, Scripting Bridge), but nothing I can
> use. All I want to do is open the default mail application, create a new
> message, attach a file and then allow the user to address it and send. That
> should not be too difficult, I should think. Is an Automator action the way
> to go? Can someone help me out?
> > Thanks
> > 
>  HI Lorenzo,
>
> If you need to support multiple versions of the OS have 3 options really :
>
> 1)
> Use compiler directives with #ifdef to check the os version number and
> utilize the frameworks appropriate for the version found.
>
> 2)
> Use AppleEvents (AppleScript or other means of interfacing with
> AppleEvents)
>
> 3)
> Role your own means of sending the mail.
>
> *** Keep in mind some users may not use the Mail application at all. They
> may be using another email client app, OR they may use webmail, OR (rare) no
> email at all.
>
>
>


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Sending email with attachments

2011-02-01 Thread Lorenzo Thurman
Thanks for the reply. I'll likely go this route for now and just exclude
support for all non-Mail.app clients.

On Tue, Feb 1, 2011 at 4:33 PM, Tim Schröder  wrote:

> Lorenzo,
>
> at least with Thunderbird I have found it impossible to communicate with
> from a Cocoa app. Mail.app, Entourage, Outlook 2011 and Postbox should work
> with AppleScript which you can address from within your app with the
> NSAppleScript class. In principle, you just need to give an instance of
> NSAppleScript the name of the email application and the script code
> necessary to create a new message and to attach a file to it. The path to
> the file to be attached can be part of the script code. For example, the
> script code to accomplish that with Postbox should be like "tell application
> "Postbox" .. activate .. send message attachment [path to file] .. end
> tell". However, for scriptable clients you will need different script code
> as they all use their own 'dialects' of AppleScript.
>
> On how to determine the default mail application, I usually use
> LSGetApplicationForURL passing "mailto:";.
>
> Best,
>
> Tim
>
>
>
> Am 01.02.2011 um 23:13 schrieb lorenzo7...@gmail.com:
>
> > How can one go about doing this and support 10.4-10.6? There are links
> all over the place pointing to deprecated API's (NSMailDelivery) or
> frameworks that are 10.5+ (EDMessage, Scripting Bridge), but nothing I can
> use. All I want to do is open the default mail application, create a new
> message, attach a file and then allow the user to address it and send. That
> should not be too difficult, I should think. Is an Automator action the way
> to go? Can someone help me out?
> > 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:
> > http://lists.apple.com/mailman/options/cocoa-dev/tim%40timschroeder.net
> >
> > This email sent to t...@timschroeder.net
>
>


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: NSSearchfield help

2011-02-10 Thread Lorenzo Thurman




On Feb 10, 2011, at 8:55 AM, Dave Reed  wrote:

> 
> On Feb 9, 2011, at 9:44 PM, lorenzo7...@gmail.com wrote:
> 
>> I have a NSTableView populated by an NSArrayController. Above the table, I 
>> have an NSToolbar, to which I would like add the ability to search. I have 
>> found a couple of examples of implementing search using an NSSearchField, 
>> but the two that I have found both display the results in a dropdown 
>> attached to the NSSearchField. I would like the table to display the results 
>> live as the user types characters. And when the search field is cleared, the 
>> table should repopulate with the original entries. First, is this even 
>> possible? I can't think of an application that even does this. If so, is 
>> there any sample code that demonstrates this?
>> Thanks
> 
> Yes, it's possible. See the relevant examples here:
> 
> http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
> 
> I think the example there requires you to press  in the search field, 
> but it's possible to do with requiring that.
> 
> Dave
> 

Thanks for the reply. But I actually figured it out. I filter the array 
controller using an NSPredicate in controlTextDidChange. I get the filtering I 
need "on the fly". I was able to prevent the dropdown from appearing by 
returning nil in 
control:textView:completions:forPartialWordRange:indexOfSelectedItem:

Works just fine. I hope that's where the example would take 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Binding to an NSMutableArray

2011-02-15 Thread Lorenzo Thurman
I have an object, Student, that contains firstName and lastName as instance
variables. Student also contains an NSMutableArray of infraction objects
that contains NSString's for the infraction name, location, punishment and
an NSDate. I want to bind these infraction objects to the columns of an
NSTableView. What I've done to make this work is copy the infraction object
to another NSArray when the Student is loaded and binding the table columns
to the NSArrayController associated with this new array. Obviously, this is
suboptimal. It seems to me that I should be able to bind directly to the
infraction as it resides in the Student object, but I just can figure out
how to bind to a particular index within the NSMutableArray within the
Student object. I've looked at some examples here:
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

but I didn't find anything quite like what I'm doing. I've gone back through
the KVC/KVO documents to see if I'm missing something. Does anyone have any
pointers on how I can go about this? If its possible at all.
TIA
___

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: Binding to an NSMutableArray

2011-02-15 Thread Lorenzo Thurman




On Feb 15, 2011, at 10:42 PM, "Stephen J. Butler"  
wrote:

> On Tue, Feb 15, 2011 at 10:37 PM, Lorenzo Thurman  
> wrote:
>> I have an object, Student, that contains firstName and lastName as instance
>> variables. Student also contains an NSMutableArray of infraction objects
>> that contains NSString's for the infraction name, location, punishment and
>> an NSDate. I want to bind these infraction objects to the columns of an
>> NSTableView. What I've done to make this work is copy the infraction object
>> to another NSArray when the Student is loaded and binding the table columns
>> to the NSArrayController associated with this new array. Obviously, this is
>> suboptimal. It seems to me that I should be able to bind directly to the
>> infraction as it resides in the Student object, but I just can figure out
>> how to bind to a particular index within the NSMutableArray within the
>> Student object. I've looked at some examples here:
>> http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
>> 
>> but I didn't find anything quite like what I'm doing. I've gone back through
>> the KVC/KVO documents to see if I'm missing something. Does anyone have any
>> pointers on how I can go about this? If its possible at all.
> 
> Assuming that your Students are in an NSArray themselves, and that
> there exists a Students Array Controller, did you try binding the
> Infractions Array Controller to the Students Array
> Controller.selection.infractions?

Yes, the Student objects are in an array themselves managed by an array 
controller. I did try the keypath you suggest above, but the app crashes on 
startup with "...not key value compliant..." errors. I've tried various 
combinations of controller .selectedIndex.infractions, controller 
selectedIbject.infractions,  but nothing works. 

I should add that there are 2 tables side by side in the app. On the left, 3 
columns, fname, lname bound directly to Student object as 
controller.fname/lname and the count of infractions in the third column using 
infractions.@count 
On the right, when a student from the left is highlighted, I want to display 
the infraction name and description for each infraction in the array. So, if it 
were possible, I would expect the keypath to look something like this:
Controller.selection.infractions.@index.infractionName/description
But clearly that can't be 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Binding to an NSMutableArray

2011-02-16 Thread Lorenzo Thurman
On Wed, Feb 16, 2011 at 12:23 AM, Stephen J. Butler <
stephen.but...@gmail.com> wrote:

> On Wed, Feb 16, 2011 at 12:05 AM, Stephen J. Butler
>  wrote:
> > It works, I just wrote up an example. But unfortunately my
> > universities file storage is crapping out and I can't share it at the
> > moment.
>
> Ahh ha, figured it out. Here's my example:
>
> https://netfiles.uiuc.edu/xythoswfs/webui/_xy-40162946_2-t_hawvqdYX
>


Binding an arraycontroller to an arraycontroller, nice!
Thanks, its working perfectly now.

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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


Binding multiple NSTableView and NSPopupButton to an NSArrayControler

2011-04-29 Thread Lorenzo Thurman
I have an NSTableView column bound to an NSArrayController which itself
is bound to an NSMutableArray. The mutable array resides in a different XIB.
The data is displayed as expected, but when I remove an item, although it
does disappear from the table, the
change is not written to disk when the application quits. I use
NSKeyedArchiver to persist the array to disk upon quitting. When the
application quits, the original array including the removed items is
written to disk.

I did some debugging and found that after the items are removed from the
array controller, the underlying array does indeed reflect the removal,
but something happens between there and quitting the application that
brings the removed items back into the array.

My application also uses an NSPopupButton to display these same items.
It is also bound to the same array controller as the table view column and
resides
in the same XIB as the array and controller.
Can someone enlighten me as to what's happening?

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Binding multiple NSTableView and NSPopupButton to an NSArrayControler

2011-05-02 Thread Lorenzo Thurman
On Fri, Apr 29, 2011 at 3:18 PM, Quincey Morris  wrote:

> Your description of the problem is a bit fuzzy. Let me nitpick at your
> description -- it may be that if you straighten out your terminology you'll
> solve your problem:
>
> On Apr 29, 2011, at 12:56, Lorenzo Thurman wrote:
>
> > I have an NSTableView column bound to an NSArrayController which itself
> > is bound to an NSMutableArray.
>
> No, it's not bound to a NSMutableArray. It's bound to an array *property*
> of some object. If the array controller is in the XIB file, it's typically
> bound to one of File's Owner's properties.
>
> > The mutable array resides in a different XIB.
>
> Almost certainly not. At least, I hope not. Why would you put a mutable
> array in a XIB? A mutable array is likely used as the backing store of an
> array property of an object in your data model (or possibly of a controller
> object).
>
> > The data is displayed as expected, but when I remove an item, although it
> > does disappear from the table, the
> > change is not written to disk when the application quits. I use
> > NSKeyedArchiver to persist the array to disk upon quitting. When the
> > application quits, the original array including the removed items is
> > written to disk.
>
> Which array? We haven't actually located the array yet. You might
> inadvertently have 2 arrays where you only intend there to be one.
>
> > I did some debugging and found that after the items are removed from the
> > array controller, the underlying array does indeed reflect the removal,
> > but something happens between there and quitting the application that
> > brings the removed items back into the array.
>
> Another possibility is that you really did put an array into a XIB, which
> means the *same* array contents will be reloaded from the XIB every time
> that XIB is loaded. Are you sure "the array" isn't being written correctly
> to your persistent store? Perhaps it is, but the written value isn't being
> reloaded next time?
>
> > My application also uses an NSPopupButton to display these same items.
>
> Is this just additional information, or are you saying there's an issue
> with the the popup button too?
>
>
> My apologies for not being clearer. I spent some time over the weekend, but
still couldn't figure it out, so here goes:
I have an NSPopupButton whose content is bound to an NSArrayController's
(controller A) arrangeObjects controller Key. This NSArrayController is
bound to an NSMutableArray which holds the items for display. The contents
of the NSPopuButton display as expected.

In another XIB (NSWindowController subclass), I have an NSTableView whose
only column's value is bound to an NSArrayController's (controller B)
arrangedObjects. This NSArrayController resides in the same XIB as the
NSTableView and is bound via an NSObject proxy in that same XIB to the same
NSMutableArray as controller A. These items display as expected in the
NSTableView. I can remove an item from the NSTableView, and in the debugger,
I can see that the item is indeed removed from the NSMutableArray. But when
I save the array on quitting the application, I see the removed item has
somehow made it back into the array.

I've also noticed that the NSPopupButton continues to display the removed
item. I would expect it would have updated itself, but clearly, I'm missing
something.
Thx

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Binding multiple NSTableView and NSPopupButton to an NSArrayControler

2011-05-03 Thread Lorenzo Thurman
On Mon, May 2, 2011 at 3:15 PM, Quincey Morris
wrote:

> On May 2, 2011, at 12:47, lorenzo7...@gmail.com wrote:
>
> > anotherItemController
> > Content Array
> > Bind to: MyAppsClass (added an NSObject from palette and set its class to
> MyAppsClass)
> > Controller Key: myMutableArray
>
> If this is what you were calling a "proxy" earlier, it isn't. It's a
> separate instance of MyAppsClass that's (re-)created when the nib is loaded.
>
> I'm assuming that MyAppsClass represents an app delegate singleton. The
> normal way to create it is to place an instance in the MainMenu nib, and
> connect the Application proxy's delegate outlet to it.
>
> If the nib file you're referring to above is actually the MainMenu nib,
> then that's fine. If not, then you've created a second instance -- you
> shouldn't have added a NSObject from the palette, but should have bound to
> the Application proxy instead, using the "delegate" key to get to the
> existing singleton object.
>
> > If I set a breakpoint after the item has been removed and then in gdb: po
> (NSArray*)[mycontroller arrangedObjects] . The removed item is not in the
> array. If during archiving, I do the same, the removed item is back.
>
> You kind of sidestepped the question here. There are, if I understand
> correctly, 2 different array controllers (one for each NIB), both of which
> are supposed to use the same underlying data model array for their content.
> You're not saving the array controllers (at least I hope not), but you're
> saving the underlying data model. Therefore looking at the array controller
> (or even their arrangedObjects) doesn't tell you anything about what's being
> saved.
>
> What you should be trying to resolve, using the debugger, is the question
> of whether there are 2 underlying data model arrays when there should be
> only one. To do that, you need to be looking at the object address of the
> mutable array(s).
>
>
>
So, I finally figured it out, and yes there were two array instances. I
removed what I referred to as the "Proxy object" representing the class that
actually has the mutable array (MyAppsClass) and just changed the File's
Owner to MyAppsClass.  My window controller subclass was initially the
File's Owner for that NIB. The bindings for the NSPopupButton are the same
as before. For the Window holding the NSTableView, these are the bindings:

myArrayController Content Array
Bind To:
Files's Owner
Model Key Path
mutable array

NSTableViewColumn Value
Bind To:
myArrayController
Model Key Path
arrangedObjects

I see the error of my ways now. These latest changes were what I initially
setup when building the interface. When I ran the app, I got an error saying
my window controller subclass was not key value compliant for my mutable
array. That sent me down the rat hole of adding an NSObject and changing its
class to MyAppsClass, to give me a path to the mutable array. This felt a
bit hinky anyway.

What I had overlooked was how I was initializing the window controller
subclass. I was using -(id)initWithWindowNibName, which, of course, sets the
owner to the window controller subclass, thus the key value error. What I
needed to do all along was simply use -(id) initWithWindowNibName: owner:.
Setting owner to MyAppsClass. Now File's Owner->mutable array gives me the
correct Key Path and items removed from the table are removed from the popup
button and everything is written out to disk correctly.

One should always RTFM, even if one thinks he/she understands the FM.

Oh well, lesson learned.
Thanks for making me look a bit harder.



-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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


iPhone and GC

2009-12-21 Thread Lorenzo Thurman
Why can't iPhone apps use GC? Is it resources? Performance? Some  
combination of the two or other reasons altogether?

Just curious, thanks.

--"My break-dancing days are over, but there's always the funky chicken"
The Full Monty
___

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: iPhone: validate a NSString for US zipcode

2010-01-07 Thread Lorenzo Thurman
>
>
> I've been googling but haven't seen yet how to best validate a 5-digit
> zipcode for use in the US (without using a webservice).
>
> I have the NSString, I just need to validate it. I know zero RegExp, is
> there a formatter I can use?
>
>
> I actually ran into a similar issue with one of my programs (Weather Vane)
early on when it only supported US zip codes. I decided to use a free SOAP
service to validate the zip code since it removed that as a maintenance
burden. You've received a lot replies with the same suggestion, but
unfortunately I can't find that service anymore. Everything else out there
seems fee based. Maybe someone out there can point you to a free service.
Maybe this question was already asked in one of the earlier replies, but
I'll ask anyway: What does your application do? Why do YOU need to validate
the zip? I use accuweather for my forecasts. If my app sends an invalid zip
code, the query fails; that's my validation.
___

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: Instruments and over released objects

2009-06-09 Thread Lorenzo Thurman



--"My break-dancing days are over, but there's always the funky chicken"
The Full Monty

On Jun 9, 2009, at 5:28 PM, Dave Keck  wrote:


Personally, I've found zombies to be perfect in tracking down
over-releases. Check out 'NSZombieEnabled'.


I did have that enabled. Apologies for not putting that in my original  
post. 
___


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


NSColorWell and bindings

2009-06-10 Thread Lorenzo Thurman
I've just added an NSColorWell to my application. I bound it to my
NSUserDefaultsController with a controller key of values, model key path
values and a value transformer of NSUnarchiveFromData. When I run my program
and click on the color well, I get this error in the console:

 Assertion failure in -[NSColorPanelColorWell setColor:],
/SourceCache/AppKit/AppKit-949.46/AppKit.subproj/NSColorWell.m:496*

*Invalid parameter not satisfying: aColor != nil*

*I checked COcoaBuilder and google, but could not find and answer to this,
but I did find this tutorial at Stanford U:*

*CocoaBindingsTutorial.pdf
*

*This suggests what I've done is correct, but clearly, I've either missed
something or there is a bug somewhere. Can someone provide me with some
insight? I've running XCode 3.1 on Leopard.*

*Thanks*

*
*

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: NSColorWell and bindings

2009-06-10 Thread Lorenzo Thurman
On Wed, Jun 10, 2009 at 1:55 PM, Alexander Spohr  wrote:

> Your NSUserDefaults do not contain a default for the color. Hence the
> complaining of the color well. Provode a default color and it will work.
>
>atze
>
> ps. what are all those ** doing in your mail?
>
>
> Am 10.06.2009 um 18:13 schrieb Lorenzo Thurman:
>
>  I've just added an NSColorWell to my application. I bound it to my
>> NSUserDefaultsController with a controller key of values, model key path
>> values and a value transformer of NSUnarchiveFromData. When I run my
>> program
>> and click on the color well, I get this error in the console:
>>
>>  Assertion failure in -[NSColorPanelColorWell setColor:],
>> /SourceCache/AppKit/AppKit-949.46/AppKit.subproj/NSColorWell.m:496*
>>
>> *Invalid parameter not satisfying: aColor != nil*
>>
>> *I checked COcoaBuilder and google, but could not find and answer to this,
>> but I did find this tutorial at Stanford U:*
>>
>> *CocoaBindingsTutorial.pdf<
>> http://www.stanford.edu/class/cs193e/Downloads/CocoaBindingsTutorial.pdf>
>> *
>>
>> *This suggests what I've done is correct, but clearly, I've either missed
>> something or there is a bug somewhere. Can someone provide me with some
>> insight? I've running XCode 3.1 on Leopard.*
>>
>> *Thanks*
>>
>> *
>> *
>>
>> --
>> "My break-dancing days are over, but there's always the funky chicken"
>> --The Full Monty
>> ___
>>
>> 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/atze%40freeport.de
>>
>> This email sent to a...@freeport.de
>>
>
> I use +initialize to provide a default value for the color well.

NSColor * color = [NSColor selectedMenuItemColor];

[defaults setObject:[NSArchiver archivedDataWithRootObject:color] forKey:
@"textColor"];

NSData * colorData = [defaults objectForKey:@"textColor"];


// Other default values


[[NSUserDefaultsController sharedUserDefaultsController] setInitialValues
:defaults];


There is a Data value in the preferences file, so there must be something
else going on.


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Cocoa-dev Digest, Vol 6, Issue 855

2009-06-10 Thread Lorenzo Thurman
>
>
>  http://developer.apple.com/documentation/Cocoa/
> Conceptual/DrawColor/Tasks/StoringNSColorInDefaults.html
>
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty

Thanks, this page helped.
___

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: NSColorWell and bindings

2009-06-13 Thread Lorenzo Thurman
The link to storing NSColor in defaults was helpful. It reinforced what I
thought I already knew, but it appears that real problem was storing a
system color, [NSColor selectedMenuItemColor], instead of a color constant
such as [NSColor blueColor]. I created a simple project just to help
troubleshoot the issue. Here is the code if anyone wants to take a look.
you'll need window with an NSColorWell bound to NSUserDefaults
"values.textColor". If anyone can provide some insight as to why I can't use
[NSColor selectedMenuItemColor] as it should just return an NSColor which
should be suitable for the colorwell, I'd appreciate it. One thing I did
notice in gdb is that when I print the color's description, I get this for
selectedMenuItemColor:

*NSNamedColorSpace System selectedMenuItemColor*

*But for blueColor, I get this:*

**
*

NSCalibratedRGBColorSpace 0 0 1 1

But I would think that any NSColor should work just fine.
*

Thanks

@implementation ColorBindings

+(void)initialize{


 NSMutableDictionary *defaults = [NSMutableDictionary dictionary];



NSColor * color = [NSColor selectedMenuItemColor];

[defaults setObject:[NSArchiver archivedDataWithRootObject:color] forKey:
@"textColor"];

 [[NSUserDefaultsController sharedUserDefaultsController] setInitialValues
:defaults];

[[NSUserDefaultsController sharedUserDefaultsController]
setAppliesImmediately:YES];

 }


-(id)init{

 return (self = [super init]);

}


-(IBAction)changeTextColor:(id)sender{


 [self setTextColor:[sender color]];

NSData * colorData = [NSArchiver archivedDataWithRootObject:[self textColor
]];

[[[NSUserDefaultsController sharedUserDefaultsController] values]
setValue:colorData
forKey:@"textColor"];

 [[[NSUserDefaultsController sharedUserDefaultsController] defaults]
synchronize];


}


-(void)setTextColor:(NSColor *)newColor{


 if(textColor != newColor){

[textColor release];

textColor = [newColor retain];

}

}


-(NSColor *) textColor{

return textColor;

}

@end
___

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


Base SDK and deployment target Q

2009-06-27 Thread Lorenzo Thurman
I have a program which needs to run under 10.4, but I used a method that

is only defined for 10.5. No biggie, it was easy enough to replace it

with something that works for 10.4. The problem is that I didn't find

this out until I ran the app under 10.4. My apps deployment target is

set to 10.4, and the base SDK is set for 10.5. My question is:

If I inadvertently use a 10.5 only method, is there a way for me to be

warned at compile time? I know I can use define's to use what's

appropriate for a given target, but what if I overlook the fact that a

method is only for 10.5? is there a compiler switch or something that I

can enable to tell me this?

Thanks

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Base SDK and deployment target Q

2009-06-27 Thread Lorenzo Thurman
Thanks for your reply. I wasn't sure that switching the SDK would be good
enough to test. My 10.4 box died a couple of weeks ago, so I
have to have someone else run the app under 10.4. It's kind of a pain,
but if I can just switch the SDK and run it under Leopard, that's
fine.
Thanks again.

On Sat, Jun 27, 2009 at 8:42 PM, Steve Christensen  wrote:

> I don't believe such a switch exists since it's not really a compiler
> issue: using a 10.5+ method is completely legal for your configuration. A
> quick way to check what 10.5 methods you're using would be to set the SDK to
> 10.4 temporarily and see what errors you get. You can then make sure you're
> doing the appropriate runtime checks.
>
> steve
>
>
>
> On Jun 27, 2009, at 6:34 PM, Lorenzo Thurman wrote:
>
>  I have a program which needs to run under 10.4, but I used a method that
>> is only defined for 10.5. No biggie, it was easy enough to replace it
>> with something that works for 10.4. The problem is that I didn't find
>> this out until I ran the app under 10.4. My apps deployment target is
>> set to 10.4, and the base SDK is set for 10.5. My question is:
>> If I inadvertently use a 10.5 only method, is there a way for me to be
>> warned at compile time? I know I can use define's to use what's
>> appropriate for a given target, but what if I overlook the fact that a
>> method is only for 10.5? is there a compiler switch or something that I
>> can enable to tell me this?
>>
>
>


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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


NSTimer firedate randomly changes

2010-11-17 Thread Lorenzo Thurman
I use two NSTimers in my app. One runs a "mini" data fetch at regular
intervals. I use another to run a "full" data fetch every 4 hours. The
problem I'm running into is that while the mini fetch runs as scheduled, the
full fetch never runs. I put some NSLog statements in the code to output the
firedate for both timers whenever the either fetch runs. What I see is that
only the mini timer fires, always on schedule, but the full fetch timer's
firedate is always offset forward by some random value in minutes so far
(+35, +42, +72, etc.) and as a consequence, it never fires. I would expect
its firedate to remain constant until it fires. I reset the mini timer after
it fires as it needs to check if the user has changed the interval, but
there is no code that resets the full fetch timer; no need, it should run
every 4 hours.

Here is the code I use to initialize the mini timer:

miniTimer = [[NSTimer scheduledTimerWithTimeInterval:[[self fetchInterval]
floatValue] * 60.0

  target:self selector:@selector(myMethod) userInfo:nil repeats:NO] retain];

This code gets called after every mini fetch to ensure the timer is set

The full fetch timer is setup in init as:

fullFetchTimer = [[NSTimer scheduledTimerWithTimeInterval:14400.00

target:selfselector:
@selector(clearOldData) userInfo:nil repeats:YES] retain];


I also subscribe to the NSWorkSpaceDidWakeNotification to ensure the timers
fire if an interval was missed due to sleep, conditionally. If the full
fetch should run, then the mini fetch does not and vice-versa.



Any have any ideas whats going on?
TIA

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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 data in sync across Mac and iPhone

2010-11-24 Thread Lorenzo Thurman
I have a customer request to sync application preferences between Macs and
iPhone. The user may not have a MobileMe account, so Sync Services is not an
option (or is it?). The user data would be stored in a plist on both
platforms and I'm trying to find the best way to keep those in sync. Any and
all pointers would be appreciated.

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

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


Networking and sleep

2012-04-11 Thread Lorenzo Thurman
I have an app which attempts to make an internet connection after receiving an 
NSWorkspaceDidWake notification. Most of the time, the connection fails with 
the error, "...internet connection appears to be offline (-1009)". My guess is 
the the OS has not yet reinitialized networking before my app attempts to 
connect. So I added a sleepForInterval:10 to make my app wait a bit before 
connecting. This seems to work just fine, but question is:
Is there a more elegant way to handle this? 

TIA


Lorenzo Thurman
lore...@thethurmans.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: Networking and sleep

2012-04-12 Thread Lorenzo Thurman

On Apr 12, 2012, at 9:33 AM, Fritz Anderson wrote:

> On 10 Apr 2012, at 4:41 PM, Lorenzo Thurman wrote:
> 
>> I have an app which attempts to make an internet connection after receiving 
>> an NSWorkspaceDidWake notification. Most of the time, the connection fails 
>> with the error, "...internet connection appears to be offline (-1009)". My 
>> guess is the the OS has not yet reinitialized networking before my app 
>> attempts to connect. So I added a sleepForInterval:10 to make my app wait a 
>> bit before connecting. This seems to work just fine, but question is:
>> Is there a more elegant way to handle this? 
> 
> Use the (C-level) SCNetworkReachability API to register for callbacks to 
> notify you of loss and acquisition of network availability. Search for 
> SCNetworkReachabilitySetCallback, and work outward from there.
> 
>   — F
> 


Great, I'll do that. Thanks!

"...Business! Mankind was my business. The common welfare was my business; 
charity, mercy, forbearance, and benevolence, were all my business. The 
dealings of my trade were but a drop of water in the comprehensive ocean of my 
business!"

Marly's ghost - A Christmas Carol


Lorenzo Thurman
lore...@thethurmans.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: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:

> On Apr 20, 2012, at 6:08 AM, Lorenzo Thurman wrote:
> 
>> On Apr 19, 2012, at 10:18 PM, Keary Suska wrote:
>> 
>>> 
>>> Perhaps this excerpt from the API doc is key: "Do not use these constants 
>>> if you want an exact format." Why, might be academic, but if you require a 
>>> specific style, you may want to specify the style specifically.
>>> 
>> I have tried using strings to specify the styles, but no luck.
> 
> It is next to impossible that specifying a fixed format will not render the 
> precisely requested results, except programmer error. We can't tell you what 
> you are doing wrong if you don't show us what you are doing.
> 
>> Is there a way to reset the Language and Text Preferences? Is there an 
>> associated Preferences I can throw away?
> 
> I think it is part of com.apple.systempreferences.plist in 
> ~/Library/Preferences. You can test that by dragging it to the desktop and 
> restarting.
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 



I agree. This should not happen, but here is my original code:
-(NSString*)formattedDate:(NSDate*)aDate{

NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"mm-dd- hh:mm a"];


NSString * dateString = [formatter stringFromDate:aDate];

return [self stringWithSentenceCapitalization:dateString];
}
and it produces the incorrect format.
It is called like this:

[weathervane formattedDate:[timer fireDate]];

[timer fireDate]
returns a date in this format:
2012-04-20 18:23:43 +

I've also rebuilt the revision of the source for the old build that I have and 
it produces the same flawed results. 
In any case, I'll edit the global prefs and see if it makes a difference. I 
really hope that I made an error somewhere. Thats a problem I can fix.


"...Business! Mankind was my business. The common welfare was my business; 
charity, mercy, forbearance, and benevolence, were all my business. The 
dealings of my trade were but a drop of water in the comprehensive ocean of my 
business!"

Marly's ghost - A Christmas Carol


Lorenzo Thurman
lore...@thethurmans.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: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:

> On Apr 20, 2012, at 6:08 AM, Lorenzo Thurman wrote:
> 
>> On Apr 19, 2012, at 10:18 PM, Keary Suska wrote:
>> 
>>> 
>>> Perhaps this excerpt from the API doc is key: "Do not use these constants 
>>> if you want an exact format." Why, might be academic, but if you require a 
>>> specific style, you may want to specify the style specifically.
>>> 
>> I have tried using strings to specify the styles, but no luck.
> 
> It is next to impossible that specifying a fixed format will not render the 
> precisely requested results, except programmer error. We can't tell you what 
> you are doing wrong if you don't show us what you are doing.
> 
>> Is there a way to reset the Language and Text Preferences? Is there an 
>> associated Preferences I can throw away?
> 
> I think it is part of com.apple.systempreferences.plist in 
> ~/Library/Preferences. You can test that by dragging it to the desktop and 
> restarting.
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 



I agree. This should not happen, but here is my original code:
-(NSString*)formattedDate:(NSDate*)aDate{

NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"mm-dd- hh:mm a"];


NSString * dateString = [formatter stringFromDate:aDate];

return [self stringWithSentenceCapitalization:dateString];
}
and it produces the incorrect format.
It is called like this:

[weathervane formattedDate:[timer fireDate]];

[timer fireDate]
returns a date in this format:
2012-04-20 18:23:43 +

I've also rebuilt the revision of the source for the old build that I have and 
it produces the same flawed results. 
In any case, I'll edit the global prefs and see if it makes a difference. I 
really hope that I made an error somewhere. Thats a problem I can fix.


"...Business! Mankind was my business. The common welfare was my business; 
charity, mercy, forbearance, and benevolence, were all my business. The 
dealings of my trade were but a drop of water in the comprehensive ocean of my 
business!"

Marly's ghost - A Christmas Carol


Lorenzo Thurman
lore...@thethurmans.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: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 11:30 AM, Charles Srstka wrote:

> On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:
> 
>>> Is there a way to reset the Language and Text Preferences? Is there an 
>>> associated Preferences I can throw away?
>> 
>> I think it is part of com.apple.systempreferences.plist in 
>> ~/Library/Preferences. You can test that by dragging it to the desktop and 
>> restarting.
> 
> The com.apple.systempreferences.plist file only determines the settings for 
> the System Preferences app itself. What you want is actually part of 
> .GlobalPreferences.plist, although that file also contains a lot of other 
> settings, so I wouldn’t nuke the whole plist file, but rather open it with 
> Xcode and edit it a bit more surgically.
> 
> The pref keys you are interested in, I believe, would be AppleLocale, 
> AppleICUDateFormatStrings, and AppleICUTimeFormatStrings.
> 
> Charles
> 


[formatter setFormatterBehavior:NSDateFormatterBehavior10_4]

this fixed it. 

Thanks for the help

"Yes Virginia, there is a Chaminade"
--unknown

Lorenzo Thurman
lore...@thethurmans.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: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 11:30 AM, Charles Srstka wrote:

> On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:
> 
>>> Is there a way to reset the Language and Text Preferences? Is there an 
>>> associated Preferences I can throw away?
>> 
>> I think it is part of com.apple.systempreferences.plist in 
>> ~/Library/Preferences. You can test that by dragging it to the desktop and 
>> restarting.
> 
> The com.apple.systempreferences.plist file only determines the settings for 
> the System Preferences app itself. What you want is actually part of 
> .GlobalPreferences.plist, although that file also contains a lot of other 
> settings, so I wouldn’t nuke the whole plist file, but rather open it with 
> Xcode and edit it a bit more surgically.
> 
> The pref keys you are interested in, I believe, would be AppleLocale, 
> AppleICUDateFormatStrings, and AppleICUTimeFormatStrings.
> 
> Charles
> 


[formatter setFormatterBehavior:NSDateFormatterBehavior
"Yes Virginia, there is a Chaminade"
--unknown

Lorenzo Thurman
lore...@thethurmans.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: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman


"My Break-Dancing days are over, but there's always the Funky Chicken" -- The 
Full Monty

On Apr 20, 2012, at 3:47 PM, Keary Suska  wrote:

> 
> On Apr 20, 2012, at 12:16 PM, Lorenzo Thurman wrote:
> 
>> I agree. This should not happen, but here is my original code:
>> -(NSString*)formattedDate:(NSDate*)aDate{
>>
>>NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
>>[formatter setDateFormat:@"mm-dd- hh:mm a"];
>>
>>
>>NSString * dateString = [formatter stringFromDate:aDate];
>>
>>return [self stringWithSentenceCapitalization:dateString];
>> }
>> and it produces the incorrect format.
>> It is called like this:
>> 
>> [weathervane formattedDate:[timer fireDate]];
>> 
>> [timer fireDate]
>> returns a date in this format:
>> 2012-04-20 18:23:43 +
> 
> This may be because the format is invalid, although I wouldn't have thought 
> so. It should be: @"MM-dd-yyy hh:mm a". Might be worth a try.
> 
> For giggles, what does -[formatter formatterBehavior] return? Does setting it 
> explicitly to NSDateFormatterBehavior10_4 change anything?
> 
>> I've also rebuilt the revision of the source for the old build that I have 
>> and it produces the same flawed results. 
>> In any case, I'll edit the global prefs and see if it makes a difference. I 
>> really hope that I made an error somewhere. Thats a problem I can fix.
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 

I just got this one after I changed the behavior. And yes indeed, the format is 
wrong. Thanks again. 
___

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


NSTimezone and offset

2013-09-04 Thread Lorenzo Thurman
Im working with NSTimezone and I need to get the current timezone offset, but 
I'm finding this more difficult than I think it should be. I thought it might 
just  be the way I'm looking at things, but I don't think so. 

If create an NSTimezone object and then send that object a 
daylightSavingTimeOffset message, I get back, for Chicago, 3600. This is wrong, 
at least for my purposes, for two reasons:
1) The offset should negative.
2) Chicago is currently observing DST

The value I would expect to see returned should be -3000. I get why the value 
3600 is correct at least with respect to the magnitude, as I can see I have 
this link setup for my system:
/etc/localtime -> /usr/share/zoneinfo/America/Chicago

But, why is it not negative? How do I get the correct offset.
TIA
___

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: NSTimezone and offset

2013-09-05 Thread Lorenzo Thurman
Thank you for clearing that up. I have it now.

On Sep 4, 2013, at 11:49 PM, dangerwillrobinsondan...@gmail.com wrote:

> You are confusing the method with secondsFromGMT
> 
> CDT is 3600 seconds is one hour ahead of CST and the docs could be more clear 
> about this method being self referential rather than GMT referential. 
> 
> Sent from my iPhone
> 
> On 2013/09/05, at 13:21, Lorenzo Thurman  wrote:
> 
>> Im working with NSTimezone and I need to get the current timezone offset, 
>> but I'm finding this more difficult than I think it should be. I thought it 
>> might just  be the way I'm looking at things, but I don't think so. 
>> 
>> If create an NSTimezone object and then send that object a 
>> daylightSavingTimeOffset message, I get back, for Chicago, 3600. This is 
>> wrong, at least for my purposes, for two reasons:
>> 1) The offset should negative.
>> 2) Chicago is currently observing DST
>> 
>> The value I would expect to see returned should be -3000. I get why the 
>> value 3600 is correct at least with respect to the magnitude, as I can see I 
>> have this link setup for my system:
>> /etc/localtime -> /usr/share/zoneinfo/America/Chicago
>> 
>> But, why is it not negative? How do I get the correct offset.
>> TIA
>> ___
>> 
>> 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:
>> 


___

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

NSTableViews, NSArraycontrollers and table selection question

2008-03-07 Thread Lorenzo Thurman
I have two NSTableviews each bound to their own NSArrayControllers. The
tables site side by side in a window and are populated simultaneously. That
works all well and good. The problem I have is that the first row in each
table is selected, but grayed out and clicking on those rows does not fire a
selection changed notification. I guess this make sense since its already
selected, so there's no real change, but I have two other textfields that
are bound to the selections, so the texfields are not populated until I
click another row. I've played around with the settings in IB 3 (all the
bindings were setup in IB3), but I can't figure out how to make this work. I
tried setting the selection index to -1 after the tables are poulated, but
that did not help. I thought I could also fire my own
tableselectiondidchange notification using the notification center, but that
didn't work either. Does anyone have any pointers?Thanks

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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]


Reformatting percent string to two decimal places

2008-04-08 Thread Lorenzo Thurman
I have the string representation of a percentage value, that goes to 6
places beyond the decimal point. Something like this:
64.123456%. I want to round that to 2 places and keep the percent sign at
the end e.g. 64.12% and return it as an NSString. I was playing around with
NSNumberFormatter (in code not IB) and was not able to either, keep the
percent sign or round properly, depending on the value passed to setStyle of
my NSNumberFormatter object. What I initially did was convert the string I
was passed into an NSNumber using NSString floatValue. This would loose the
percent sign at the end, but I could restore it by passing
setStyle:NSFormatterPercentStyle to the formatter. But when I did this, the
decimal was lost, so the number would end up like this:
64,1234%. I played around with my formatter using NSFormatterDecimalStyle or
NSFormatterPercentStyle, but never get what I wanted. Can these be used
together in the same formatter? or'd maybe? The docs don't say, it doesn't
work in any case, so I assume no. What I ended up doing was this:

// Takes a string containing a decimal percent
// rounds it off toNumPlaces and returns the
// resulting string
-(NSString*) roundValue:(NSString*)valueToRound toNumPlaces:(unsigned
int)places{

NSLocale* locale = [NSLocale currentLocale];
NSDecimalNumberHandler* roundingBehavior =[NSDecimalNumberHandler
decimalNumberHandlerWithRoundingMode:NSRoundPlain scale:places
raiseOnExactness:NO

 raiseOnOverflow:NO raiseOnUnderflow:NO
raiseOnDivideByZero:NO];
NSDecimalNumber* fv = [[NSDecimalNumber
decimalNumberWithString:valueToRound ]
decimalNumberByRoundingAccordingToBehavior:roundingBehavior];

NSNumberFormatter* formatter = [[NSNumberFormatter alloc] init];
[formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
[formatter setLocale:locale];

NSString* newValue = [formatter stringFromNumber:fv ];
[formatter release];

return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", newValue, @"%"];
}

Is this the best way to do this? It works just fine, but I was wondering if
there was a better way.
Thanks
-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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]


Tips to deploy applications to multiple Mac OS X versions

2008-04-09 Thread Lorenzo Bevilacqua

Hi,

I'm trying to build a Cocoa application so that it can run on Mac OS X  
from version 10.3.9 to 10.5.
I have 10.5 installed so the application runs fine on my system and on  
other Leopard systems.
I haven't build a project for multiple platforms yet, so I tried to  
duplicate the main Xcode target and set different deployment target  
settings like


myApp for Leopard   MACOSX_DEPLOYMENT_TARGET set to 10.5
myApp for Tiger MACOSX_DEPLOYMENT_TARGET set to 10.4
myApp for Panther   MACOSX_DEPLOYMENT_TARGET set to 10.3

The SDK I use is the Leopard one.

Till now all Ok, but when I try to compile for example the Tiger  
target I get some errors (mainly about fast enumeration). Thus I have  
some questions:


- It is correct to proceed like I described above?
- Does the Objective-C 2.0 fast enumeration make sense to be used? I  
mean, if I don't use it, will my application perform worse on Leopard?
- Is there a way to differentiate part of code by platform? I remember  
I saw in some files lines like this


#if MACOSX_DEPLOYMENT_TARGET == MAC_OS_X_VERSION_10_4
#endif

is this correct?


Thanks,

Lorenzo Bevilacqua
___

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]


Binding NSButton enabled state

2008-04-19 Thread Lorenzo Thurman
I have two NSTableViews, tableA and tableB, each managed by separate
NSArrayControllers. When a selection is made in either table, an instance
variable is set. I want to have an NSButton's enabled state to 'YES'
whenever the instance variable is set. I've tried binding the button to the
instance variable through my controller, but
the button becomes enabled only when there is selection in tableA, but it
does not enable when a selection s made in tableB. As a matter of fact, if
the button is enabled and I make a selection in tableB, the button will
disable. It will re-enable by clicking in tableA, but then disable again
when clicking in tableB. Does anyone have any pointers on how I can make
this work?

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Binding NSButton enabled state

2008-04-20 Thread Lorenzo Thurman
On Sat, Apr 19, 2008 at 11:55 PM, Chris Hanson <[EMAIL PROTECTED]> wrote:

> On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
>
>  I have two NSTableViews, tableA and tableB, each managed by separate
> > NSArrayControllers. When a selection is made in either table, an
> > instance
> > variable is set. I want to have an NSButton's enabled state to 'YES'
> > whenever the instance variable is set.
> >
>
> Don't think of it as an instance variable, think of it as a property.
>  Restating your problem, you want your "Do Something" button's enabled
> property to be bound to your window controller's "can do something"
> property.
>
> What this means is that you need to manipulate your window controller's
> "can do something" property in a way that things bound to it can notice --
> in other words, in a way that will post key-value observing notifications.
>  Thus instead of manipulating it as an instance variable, you should just
> always invoke its setter.
>
> You haven't said how you're actually noticing that the selection in one of
> your tables has changed; I assume you're either using an NSTableView
> delegate method or a notification to do so.
>
>  -- Chris
>
>
Here's my code:I register to receive these notifications when the selection
changes.

-(void)applicationDidFinishLaunching:(NSNotification*)not{


 [[NSNotificationCenter defaultCenter]  addObserver:self selector:@selector(
usTableViewSelectionDidChange:) name:
NSTableViewSelectionDidChangeNotification object:usCityTable];

[[NSNotificationCenter defaultCenter]  addObserver:self selector:@selector(
intlableViewSelectionDidChange:) name:
NSTableViewSelectionDidChangeNotification object:intlTable];

}


These are the messages sent when  a selection is changed (Is there a way to
use just one?):

-(void) usTableViewSelectionDidChange:(NSNotification*)not{

NSArray* selObjs = [usTableContent selectedObjects];

 if([selObjs count] > 0) {

[intlTable deselectAll:self];

NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];

[self setValue:[selectedDictionary objectForKey:@"location"] forKey:
@"location"];

[self setSelectedItem:selectedDictionary];

}

}

-(void) intlableViewSelectionDidChange:(NSNotification*)not{

NSArray* selObjs = [intlTableContent selectedObjects];

 if([selObjs count] > 0){

[cityTable deselectAll:self];

NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];

[self setValue:[selectedDictionary objectForKey:@"location"] forKey:
@"location"];

[self setSelectedItem:selectedDictionary];

}


}


The "location" instance variable is what should trigger a change in the
button state. There are also two labels in the window that are bound to two
other items in "selectedDictionary", city & state. These labels change as
expected when clicking between tableviews. My "Save" button is misbehaving.
When I select an item in the usCityTable, the button enables, but will
disable when I select from the intlTable. The "Save" button is bound to
mycontroller.location. The two labels are bound to
mycontroller.selectedItem.city and mycontroller.selectedItem.state. I've
tried binding the button to mycontroller.selectedItem.location, but the
behavior is the same and using [EMAIL PROTECTED] does not provide the
desired behavior as the button is enabled even when no selection is made.


This, I think, is all the relevant code and bindings. I've reduced this a
small project and code post the entire project, if you want to take a look.

Thanks



-

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Binding NSButton enabled state

2008-04-21 Thread Lorenzo Thurman
> Message: 1
> Date: Sun, 20 Apr 2008 14:02:52 -0600
> From: Keary Suska <[EMAIL PROTECTED]>
> Subject: Re: Binding NSButton enabled state
> To: "Cocoa-Dev (Apple)" 
> Message-ID: <[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> >
> Content-Type: text/plain;   charset="US-ASCII"
>
> on 4/20/08 11:47 AM, [EMAIL PROTECTED] purportedly said:
>
> > On Sat, Apr 19, 2008 at 11:55 PM, Chris Hanson <[EMAIL PROTECTED]> wrote:
> >
> >> On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
> >>
> >>  I have two NSTableViews, tableA and tableB, each managed by separate
> >>> NSArrayControllers. When a selection is made in either table, an
> >>> instance
> >>> variable is set. I want to have an NSButton's enabled state to 'YES'
> >>> whenever the instance variable is set.
> >>>
> >>
> >> Don't think of it as an instance variable, think of it as a property.
> >>  Restating your problem, you want your "Do Something" button's enabled
> >> property to be bound to your window controller's "can do something"
> >> property.
> >>
> >> What this means is that you need to manipulate your window controller's
> >> "can do something" property in a way that things bound to it can notice
> --
> >> in other words, in a way that will post key-value observing
> notifications.
> >>  Thus instead of manipulating it as an instance variable, you should
> just
> >> always invoke its setter.
> >>
> >> You haven't said how you're actually noticing that the selection in one
> of
> >> your tables has changed; I assume you're either using an NSTableView
> >> delegate method or a notification to do so.
> >>
> >>  -- Chris
> >>
> >>
> > Here's my code:I register to receive these notifications when the
> selection
> > changes.
> >
> > -(void)applicationDidFinishLaunching:(NSNotification*)not{
> >
> >
> >  [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > usTableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:usCityTable];
> >
> > [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > intlableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:intlTable];
> >
> > }
> >
> >
> > These are the messages sent when  a selection is changed (Is there a way
> to
> > use just one?):
>
> Yes, if instead you make your controlling object the delegate to both
> tableviews and implement -tableViewSelectionDidChange:.
>
> > -(void) usTableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [usTableContent selectedObjects];
> >
> >  if([selObjs count] > 0) {
> >
> > [intlTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> > }
> >
> > -(void) intlableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [intlTableContent selectedObjects];
> >
> >  if([selObjs count] > 0){
> >
> > [cityTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> >
> > }
>
> Note that when you call -deselectAll:, that triggers an
> NSTableViewSelectionDidChangeNotification, so you may want to watch out.
> Your checks probably avoid loops, but the notifications will get sent more
> often than is necessary.
>
> Anyway, what kind of object is "location"? Are you applying any
> transformers? If not, how are you considering how your object will get
> coerced into a boolean?
>
> HTH,
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
>
>
> I'll look at the tableview deleegates again. I looked at those before, but
reasoned that they might not work as I would like, but I can't remember why.
Thanks for pointing out the potential for looping and the extra
notifications that

Re: Binding NSButton enabled state

2008-04-21 Thread Lorenzo Thurman
> Message: 1
> Date: Sun, 20 Apr 2008 14:02:52 -0600
> From: Keary Suska <[EMAIL PROTECTED]>
> Subject: Re: Binding NSButton enabled state
> To: "Cocoa-Dev (Apple)" 
> Message-ID: <[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> >
> Content-Type: text/plain;   charset="US-ASCII"
>
> on 4/20/08 11:47 AM, [EMAIL PROTECTED] purportedly said:
>
> > On Sat, Apr 19, 2008 at 11:55 PM, Chris Hanson <[EMAIL PROTECTED]> wrote:
> >
> >> On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
> >>
> >>  I have two NSTableViews, tableA and tableB, each managed by separate
> >>> NSArrayControllers. When a selection is made in either table, an
> >>> instance
> >>> variable is set. I want to have an NSButton's enabled state to 'YES'
> >>> whenever the instance variable is set.
> >>>
> >>
> >> Don't think of it as an instance variable, think of it as a property.
> >>  Restating your problem, you want your "Do Something" button's enabled
> >> property to be bound to your window controller's "can do something"
> >> property.
> >>
> >> What this means is that you need to manipulate your window controller's
> >> "can do something" property in a way that things bound to it can notice
> --
> >> in other words, in a way that will post key-value observing
> notifications.
> >>  Thus instead of manipulating it as an instance variable, you should
> just
> >> always invoke its setter.
> >>
> >> You haven't said how you're actually noticing that the selection in one
> of
> >> your tables has changed; I assume you're either using an NSTableView
> >> delegate method or a notification to do so.
> >>
> >>  -- Chris
> >>
> >>
> > Here's my code:I register to receive these notifications when the
> selection
> > changes.
> >
> > -(void)applicationDidFinishLaunching:(NSNotification*)not{
> >
> >
> >  [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > usTableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:usCityTable];
> >
> > [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > intlableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:intlTable];
> >
> > }
> >
> >
> > These are the messages sent when  a selection is changed (Is there a way
> to
> > use just one?):
>
> Yes, if instead you make your controlling object the delegate to both
> tableviews and implement -tableViewSelectionDidChange:.
>
> > -(void) usTableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [usTableContent selectedObjects];
> >
> >  if([selObjs count] > 0) {
> >
> > [intlTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> > }
> >
> > -(void) intlableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [intlTableContent selectedObjects];
> >
> >  if([selObjs count] > 0){
> >
> > [cityTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> >
> > }
>
> Note that when you call -deselectAll:, that triggers an
> NSTableViewSelectionDidChangeNotification, so you may want to watch out.
> Your checks probably avoid loops, but the notifications will get sent more
> often than is necessary.
>
> Anyway, what kind of object is "location"? Are you applying any
> transformers? If not, how are you considering how your object will get
> coerced into a boolean?
>
> HTH,
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
>
>
> I'll look at the tableview deleegates again. I looked at those before, but
reasoned that they might not work as I would like, but I can't remember why.
Thanks for pointing out the potential for looping and the extra
notifications that get sent, but the problem I ran into without the
deselectAll, was that if I made a selection in tableA, my interface updated
correctly, then made a selection in tableB, my interface updated correctly,
but then made the same selection again in tableA, my interface did not
update correctly, since there was not change in selection
___

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]


Proper way to revert with NSUserDefaultsController

2008-04-21 Thread Lorenzo Thurman
I've run into some trouble using revert with NSUserDefaultsController:
It doesn't work. My settings do not revert to their previous settings. I'm
working on a prefs window and what I want to have happen is if a user clicks
the cancel button, any changes made are reverted to their previous setting.
I have programmatically set [[NSUserdefaultsController
sharedUserDefaultsController] setAppliesImmediately:NO]. My understanding
was that this was required for revert to work. I found a post at
cocoabuilder that said using this pair of messages would work to revert
settings:

dictionaryWithValuesForKeys (to get the current state of the user prefs)
setValuesForKeysWithDictionary (to restore the user prefs)

This actually works for me and I'm OK with this as a solution, but I'd still
like to know how revert should work. There are a number of posts about
revert at cocoabuilder. Many people seem to have issues with it, so it's use
does not appear to be as straightforward as implied by the docs.
Thanks


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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]


Sheet window as firstResponder

2008-04-25 Thread Lorenzo Bevilacqua

Hi,

I'm trying to get keyDown events from the contentView of a sheet window.
I overrided the acceptsFirstResponder method to return YES, and added  
a - (void) keyDown: (NSEvent *) event.


The problem is that when the sheet becomes visible and I press a key I  
hear a system alert and the keyDown isn't called.
I checked what's the nextResponder for that view (the window) and  
added keyDown method also for it, but same thing, beep and no keyDown.


I think that this problem is related to the fact that the window is  
modal.
I found something about modal windows looking in the documentation,  
but the informations aren't clear.


"NSWindow objects are passive participants in the modal-window  
mechanism; it's the application that programmatically initiates and  
manages modal behavior. To run a window modally, NSApp uses its normal  
event loop machinery but restricts input to a specific window or  
panel. In the loop, it fetches events but if the events do not meet  
certain criteria—most importantly their association with the modal  
window—it tosses them." (from Cocoa Fundamentals Guide - The Core  
Application Architecture - Windows - Modal windows)


How should I proceed?

Thanks,

Lorenzo Bevilacqua___

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]


Tiger bug on NSXMLParser?

2008-04-28 Thread Lorenzo Thurman
I'm using NSXMLParser to read an XML document from a server via
initiWithContentsOfURL. This works just fine under Leopard. I can read and
parse the data just fine, but under Tiger, I get an empty document error:
NSXMLParserErrorDomain = 4 (Empty document). There are several posts in the
archives about problems with NSXMLParser, but nothing suggesting a Tiger bug
leading to an empty document. (Actually one thread about it, but referring
to initWithData and not calling it a bug) Unless someone thinks there's
something wrong with my code, I'm going to file a bug with Apple.


Here is my code:

NSString* urlString = [str stringByAddingPercentEscapesUsingEncoding:
NSUTF8StringEncoding];

NSXMLParser* locationData = [[[XMLParser alloc] initWithContentsOfURL:[NSURL
URLWithString:urlString]]  autorelease];

[locationData setDelegate:self];

[locationData parse];

NSError* err = [locationData parseError]; <---Empty document error



str is the url as an NSString.


The documents encoding is actually Latin1, I pasted the last one I tried
here. I've tried a few encodings, but they all fail with the same error.

Any ideas?



-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Tiger bug on NSXMLParser?

2008-04-28 Thread Lorenzo Thurman
On Mon, Apr 28, 2008 at 8:57 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:

>
> On 28 Apr '08, at 6:42 PM, Lorenzo Thurman wrote:
>
>  NSString* urlString = [str stringByAddingPercentEscapesUsingEncoding:
> > NSUTF8StringEncoding];
> >
>
> You shouldn't need this step if 'str' is already a string representation
> of the URL. For example, it would convert a "?" or "#" in the URL into a
> percent-escaped sequence.
>
Understood, I just thought that was good practice.

>
>  NSXMLParser* locationData = [[[XMLParser alloc]
> > initWithContentsOfURL:[NSURL
> > URLWithString:urlString]]  autorelease];
> >
>
> Have you tried loading the data first, and then parsing it? Does the data
> look reasonable, i.e. can you convert it to an NSString using the expected
> encoding?
>
> Also, are you sure the XML is valid? XML parsers are very picky, by design
> (unlike Web browsers), and will fail if there are any syntax errors.
>
I'll try these suggestions and get back to you.

>
> If your app doesn't need to run on pre-10.4 systems, you could consider
> using NSXMLDocument instead, which is a newer and more powerful API. It lets
> you use XPath and XQuery to search through the DOM, and it integrates
> libTidy, which will clean up invalid XML and HTML for you.
>

Actually NSXMLDocument will work, and if I have to use it, I will, but the
data I need is all in the attributes and NSXMLParser will give them to me
all nicely wrapped in an  NSDictionary for each element, saving a few steps.

Thanks for the reply.

>
> —Jens




-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Tiger bug on NSXMLParser?

2008-04-29 Thread Lorenzo Thurman
Have you tried loading the data first, and then parsing it? Does the data
> > look reasonable, i.e. can you convert it to an NSString using the expected
> > encoding?
> >
>
I tried loading the XML into an NSString using
initWithContentsOfURL:encoding:error using Latin1 encoding. Under Leopard,
the XML is read in just fine. I can output the resulting string in the
debugger and it looks good and is parsed just fine. Under Tiger, the string
is just a bunch of unicode escape sequences and results in another empty
document error after running through NSXMLParser. I'm running on PPC with
10.4.11, if that matters at all.



-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Tiger bug on NSXMLParser?

2008-04-29 Thread Lorenzo Thurman
On Tue, Apr 29, 2008 at 7:36 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:

>
> On 29 Apr '08, at 6:27 AM, Lorenzo Thurman wrote:
>
>  I tried loading the XML into an NSString using
> > initWithContentsOfURL:encoding:error using Latin1 encoding. Under Leopard,
> > the XML is read in just fine. I can output the resulting string in the
> > debugger and it looks good and is parsed just fine. Under Tiger, the string
> > is just a bunch of unicode escape sequences and results in another empty
> > document error after running through NSXMLParser. I'm running on PPC with
> > 10.4.11, if that matters at all.
> >
>
> Sounds like the document is not actually in ISO-Latin-1. It may be that
> Leopard is detecting that you gave the wrong encoding and using the correct
> one specified by the server instead, whereas Tiger just uses what you gave
> it.
>
> It's pretty rare that you need to force an encoding when downloading text
> from a URL. Try using this NSString method, which will try to determine the
> encoding automatically (either from the HTTP headers or by sniffing the
> bytes):
>
> + (id)stringWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding
> *)enc error:(NSError **)error;
>
> —Jens


I finally found a way to get it working. I did it this way:

NSXMLDocument* theDoc = [[[NSXMLDocument alloc] initWithContentsOfURL:[NSURL
URLWithString:urlString] options:NSXMLDocumentTidyXML error:&err]
autorelease];

NSData* xmlData = [theDoc XMLData];

NSXMLParser* parser = [[[NSXMLParser alloc] initWithData:xmlData]
autorelease];

[parser setDelegate:self];

[parser parse];


I tried an earlier suggestion of saving the data to a file and then running
tidy on it. tidy reported about 300 errors. That gave me the idea to try
using NSXMLDocument, since it has the tidyXML option. This works perfectly
under both 10.5 and 10.5. I'll try what you suggest above, just to see what
happens, but I'm happy again.


Thanks for the help.

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Messaging framework

2008-12-25 Thread Lorenzo Thurman
> I've heard good things about pantomime though haven't used it myself
> (and I understand it has a few gotchas related to international
> characters).

> It might also be worth looking into solutions accessible via the
> scripting bridge as my experience has been that languages such as
> Python offer more flexibility in handling network-related tasks.

Thanks, hadn't considered this. It might give me an opportunity to play
around with Python some more.
___

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


Bindings problem

2008-02-21 Thread Lorenzo Thurman
I've been using bindings for user preferences, but now I've gotten a little
more into the whole kvc/kvo thing, but have run into a problem:I have two
array controllers. Each bound to my controller (not an nscontroller, just my
main class), with a model key path pointing to  arrays that are populated by
one of the delegate methods of NSXMLParser
When these arrays are populated, (their contents is an nsdictionary), the
values in the dictionarys are used to populate the rows of two table views.
This works just fine it seems, the data is displayed as expected, but that I
get this error when clicking on any of the rows in either table:

*2008-02-21 19:06:11.171 TableTest[518:10b] Cannot remove an observer
 for the key path "state" from
 because it is not registered as an observer.*

Two questions:
Why do I get this error and how do I fix it? I did some searching for
various combinations of "Cannot remove an observer" and "because it is not
registered as an observer" and "for the key path" but couldn't find anything
relevant except for this at apple:
http://developer.apple.com/releasenotes/Cocoa/Foundation.html#KVCKVO
This kind of suggests that this is a bug.

Why don't I get this error for each key in the dictionary? There are three
keys, in the dictionary.
That's actually 3 questions. Thanks
-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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]


Auto center within a custom NSView

2014-03-01 Thread Lorenzo Thurman
I have to add a variable number of NSSliders to a custom view, (although, 
probably no more than eight). I’d like these items centered within the view, 
but am unsure how to achieve this. I know I could probably “do the math” and 
just calculate the position of each as its added, but I thought I would ask on 
the list and see if anyone had any ideas as to how to go about this. Given 
issues such as spacing between the sliders and padding from the edges make the 
math route seem problematic. 
Any ideas greatly appreciated.


___

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: Auto center within a custom NSView

2014-03-01 Thread Lorenzo Thurman
Thanks, I should have known that.

On Mar 1, 2014, at 11:55 PM, Kyle Sluder  wrote:

> On Sat, Mar 1, 2014, at 09:19 PM, Lorenzo Thurman wrote:
>> I have to add a variable number of NSSliders to a custom view, (although,
>> probably no more than eight). I’d like these items centered within the
>> view, but am unsure how to achieve this. I know I could probably “do the
>> math” and just calculate the position of each as its added, but I thought
>> I would ask on the list and see if anyone had any ideas as to how to go
>> about this. Given issues such as spacing between the sliders and padding
>> from the edges make the math route seem problematic. 
>> Any ideas greatly appreciated.
> 
> This is exactly why Auto Layout was invented.
> 
> https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/Introduction/Introduction.html
> 
> --Kyle Sluder


___

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

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

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

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

Automatically resize parent view when subviews resize

2014-04-13 Thread Lorenzo Thurman
I have an NSView with two subviews (A & B) placed horizontally with respect to 
each other. The subviews can take a variable number of uniformly sized 
subviews. I’ve placed these constraints on subviews A & B, (all done in IB):
(They should both have the same height)

Top space to container
Bottom space to container
Horizontal spacing between A & B
Intrinsic View -> Placeholder -> Width checked to None
Horizontal content hugging priority set to 1

The left has:
Leading space to container

The right has:
Trailing space to container

The parent view has:
Intrinsic View -> Placeholder -> Width checked to None
Horizontal content hugging priority set to 1

With these constraints, I would expect the parent view to resize itself 
horizontally as the subviews (A & B) try to expand to accomodate the addition 
of more subviews. But instead, the parent view does not resize at all, subviews 
A & B do not resize and their subviews are crammed together as more are added. 
If I remove the Horizontal spacing between A & B, they both resize 
horizontally, and if I add enough subviews to each, they extend beyond the 
right edge of the parent view.

So, how what mojo do I need to apply to get the parent to resize horizontally? 
I’m really just getting started with Auto layout, and it seems more confusing 
than it probably really is or should be.
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: Auto layout and re-sizing subviews.

2014-05-06 Thread Lorenzo Thurman

On May 6, 2014, at 5:31 PM, Daniel Höpfl  wrote:

> Hi,
> 
> On 06.05.2014 23:32, lorenzo wrote:
>> I posted this on SO, but got no answers, so I'm trying here and mabe I
>> can get some help.:
>> 
>> I have a window into which I horizontally add two subviews. Into each
>> subview, I place a variable number of subviews made up of a vertical
>> slider, a text field rotated 90 degrees and placed to the left of the
>> slider and another textfield, placed just under the slider. The slider
>> subview's constraints are done in code, the parent views are both done
>> in IB. When I add more slider views to the left window than the subview
>> can handle in its default size, it resizes horizontally and forces the
>> window's content view (and window) to also resize horizontally. Great,
>> that's just what I want. But if I add more slider subviews than can fit
>> in the right subview, they just get squeezed together and the subview
>> does not expand as the left. I layout the slider views using code with
>> this category converted to support NSViews, instead of UIVews:
>> 
>> UIView+AutoLayout1: https://github.com/jrturton/UIView-Autolayout
>> 
>> The constraints for the left and right subviews are more or less the
>> same. I can't figure out why the right view does not resize as the left
>> view does.
>> 
>> Here is a link to a sample project that demonstrates the problem:
>> http://www.spikesoft.net/wp-content/uploads/2014/05/SliderTest.zip
>> 
>> Can someone point me in the right direction?
> 
> In your MainMenu.xib, there is a constraint "[Left view]-(233)-|" that
> needs to be "[Left view]-(>=233)-|".
> 
> (Also, in SliderController's intrinsicSize you use
> _counterField.frame.size.height when calculating size.width. Not sure if
> this is correct.)
> 
> Bye,
>   Daniel

I had this at some point in the past, as I was adjusting the constraints to 
achieve the desired behavior and just overlooked this one through the 
troubleshooting process. I’m still rather new to Auto Layout so I guess 
sometimes you can see the forest for the trees. Thanks for pointing out my 
error and I’ll take care of the slider’s intrinsic view size.

___

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