Re: populating radio stations like iTunes

2010-06-02 Thread Uli Kusterer
On 02.06.2010, at 00:26, Abhinav Tyagi wrote:
> I want to know that how can i get the data and populate a list of stations
> similar to that. I think it sends some request to apple server which returns
> an xml or a plist which can be further parsed to fetch the stations and
> their details. But i dont know what actually i need to send and to which
> server address.

 Make your own list, put it on a server as an XML or plist file or so, use 
NSURLRequest to download it, NSPropertyListSerialization to create an array of 
it again?

 Collecting such lists and keeping them up-to-date is work and costs money, I 
doubt Apple would appreciate you leeching off their servers (might not even be 
legal, depending on what country you live in, and Apple may shut it down or 
change the URL at any time, breaking your app).

 That said, I don't know what you're trying to do, but there are tools to dump 
the raw requests (like IPNetMonitorX or CharlesProxy), which could probably be 
used to figure out what iTunes is actually doing. But that's like using 
undocumented API: It may break in spectacular ways at any time.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

___

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

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

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

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


Re: populating radio stations like iTunes

2010-06-02 Thread Uli Kusterer
On 02.06.2010, at 00:26, Abhinav Tyagi wrote:
> I want to know that how can i get the data and populate a list of stations
> similar to that. I think it sends some request to apple server which returns
> an xml or a plist which can be further parsed to fetch the stations and
> their details. But i dont know what actually i need to send and to which
> server address.

Oh, two more notes:

1) There are companies that sell/rent out lists of such radio station URLs. I 
think Rogue Amoeba's RadioShift app has licensed such a list.

2) Also, the iTunes Radio station list thing seems to be disabled in current 
versions of iTunes (or maybe that's just in some countries?), at least I can't 
turn on the checkbox anymore to show it in my sidebar. That means it's even 
more likely that this feature will go away in the future.

But this is getting off-topic from Cocoa, so I'll stop here.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

___

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

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

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

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


NSTreeController method removeObjectAtArrangedObjectIndexPath

2010-06-02 Thread Tony Romano
Overview:

I am implementing DnD using the NSOutlineview as my UI and the NSTreeController 
as my "store front" to the file system. If none of the files exist at the drop 
target both move and copy operations work fine. The case where there is a file 
in the target that conflicts with one of the files in the source, I need to 
remove both the file and the node in the controller.  All the file operations 
are happening on a another thread.  Once I have determine which node needs to 
be removed, I am doing a performSelectorOnMainThread to instruct the 
treecontroller to remove the node.  Note:  The copy and move work this way as 
well.  The scenario I have outlined is really a special case in a move 
operation that will remove the node at the target and continues as if it were a 
simple move.
 
The issue is this, most of the time, removeObjectAtArrangedObjectIndexPath, 
will NOT remove the code and I wind up with a duplicate in the tree at the 
target drop point. The files in the filesystem are correct.

Here are some snippets of code:

// File Operations are complete at this time
if (rr == kReplaced_MacFileMoveOrCopy) 
{
// We are doing a move and the target was both in the file system AND 
the outlineview.
// At this point, the file got moved but we now need to remove it from 
the tree so we can 
// continue with a normal MOVE operation
// The node to remove will be under the targetItem in the treecontroller
NSMutableArray *targetItemChildren = [targetItem mutableChildNodes];

// I have also done this as well instead of the line directly above.
// NSArray * targetItemChildren = [targetItem childNodes];
// NSMutableArray * tc = [targetItemChildren copy];


// Create a temporary URL to retarget the URL we want to move, to have 
the path of the destination node
NSURL * u = [[[targetItem representedObject] nodeURL] 
URLByStandardizingPath];
NSURL * lookingForURL = [u URLByAppendingPathComponent:[[node nodeURL] 
lastPathComponent]];
NSURL * lookingAtURL = nil;

for(NSTreeNode * childTn in targetItemChildren) {
lookingAtURL = [[childTn representedObject] nodeURL]

if ([lookingAtURL isEqual:lookingForURL] == YES) {

[self performSelectorOnMainThread: 
@selector(removeNode:) 
withObject:childTn waitUntilDone:YES];

break; // found it, we're done.
}
}

[targetItemChildren release];
}



// This function is call on the main thread
-(void)removeNode:(NSTreeNode *)tn
{
NSLog(@"Main Thread RemoveNode(%d)", [NSThread isMainThread]);
NSIndexPath *objPath = [tn indexPath];
[treeController removeObjectAtArrangedObjectIndexPath:objPath];
}

Does anyone have experience using an NSTreeController with an NSOutlineview in 
this fashion and can shed some light on this?  I've spent the better part of 
the day looking at this.  In all cases my internal nodes are correct by looking 
at them from the debugger.

TIA,
-Tony

___

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: -[NSDocument fileURL] is observable (KVO). Documented?

2010-06-02 Thread Mike Abdullah

On 1 Jun 2010, at 23:25, Jerry Krinock wrote:

> 
> On 2010 Jun 01, at 15:07, Mike Abdullah wrote:
> 
>> I'd advise subclassing to add your own notification posting code.
> 
> Yuck.  Unless someone knows a better way, that means setting up either a 
> kqueue or FSEvents thingy for the document to watch its own path.  Does 
> anyone know an easier way?  Because of the way that a document window's title 
> changes instantly when its file is moved in Finder, apparently Apple has this 
> already built in to NSDocument.  Does anyone know how to hook into that, 
> ahead of setFileURL:?

er, I meant just override -setFileURL: to post a notification.

___

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


Trouble embedding a framework in an application

2010-06-02 Thread Tito Ciuro
Hello,

I'm having some trouble embedding a framework in my app. I've done that 
countless times before in other projects and it worked fine, but for some 
reason, it doesn't work this time around. I don't know what I'm missing and I 
get the feeling I'm running in circles. The app launches (and works) fine if I 
launch it from Xcode. However, if I launch from Finder I see the following in 
Console.app

> 6/2/10 11:05:46 AM[0x0-0x192192].com.yourcompany.RichEmailSender[4390]
> dyld: Library not loaded: 
> @executable_path/../Frameworks/EDCommon.framework/Versions/A/EDCommon
> 6/2/10 11:05:46 AM[0x0-0x192192].com.yourcompany.RichEmailSender[4390]
>   Referenced from: 
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
> 6/2/10 11:05:46 AM[0x0-0x192192].com.yourcompany.RichEmailSender[4390]
>   Reason: image not found
> 6/2/10 11:05:46 AMcom.apple.launchd.peruser.501[143]  
> ([0x0-0x192192].com.yourcompany.RichEmailSender[4390]) Job appears to have 
> crashed: Trace/BPT trap
> 6/2/10 11:05:46 AMReportCrash[4393]   Saved crash report for 
> RichEmailSender[4390] version ??? (???) to 
> /Users/tciuro/Library/Logs/DiagnosticReports/RichEmailSender_2010-06-02-110546_TurboMonkey.crash
> 6/2/10 11:08:34 AMRichEmailSender[4441]   *** Assertion failure in 
> -[MessageExample createMessage], 
> /Users/tciuro/Desktop/RichEmailSender/MessageExample.m:23
> 6/2/10 11:08:34 AMRichEmailSender[4441]   could not load image

The crash referenced above shows:

> Process: RichEmailSender [4390]
> Path:
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
> Identifier:  com.yourcompany.RichEmailSender
> Version: ??? (???)
> Code Type:   X86 (Native)
> Parent Process:  launchd [143]
> 
> Date/Time:   2010-06-02 11:05:46.302 +0200
> OS Version:  Mac OS X 10.6.3 (10D573)
> Report Version:  6
> 
> Exception Type:  EXC_BREAKPOINT (SIGTRAP)
> Exception Codes: 0x0002, 0x
> Crashed Thread:  0
> 
> Dyld Error Message:
>   Library not loaded: 
> @executable_path/../Frameworks/EDCommon.framework/Versions/A/EDCommon
>   Referenced from: 
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
>   Reason: image not found


I have googled for info and I've seen a lot of info (and misinformation as 
well), so I tried the following:

1) Drag the frameworks (EDMEssage + EDCommon) to my Xcode project
2) Added a Copy Files Build Phase to the target
3) Selected Frameworks from the popup and checked Copy only when installing 
(info window of the Copy Files Build Phase)
4) Set the Runpath Search Paths to @loader_path/../Frameworks/

Running otool -l shows the following:

> TurboMonkey:~ tciuro$ otool -L 
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender
>  
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app/Contents/MacOS/RichEmailSender:
>   /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa 
> (compatibility version 1.0.0, current version 15.0.0)
>   @executable_path/../Frameworks/EDCommon.framework/Versions/A/EDCommon 
> (compatibility version 34.0.0, current version 34.0.0)
>   @executable_path/../Frameworks/EDMessage.framework/Versions/A/EDMessage 
> (compatibility version 17.0.0, current version 17.0.0)
>   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
> version 125.0.1)
>   /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 
> 227.0.0)
>   
> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 
> (compatibility version 150.0.0, current version 550.19.0)
>   /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 
> (compatibility version 300.0.0, current version 751.21.0)
>   /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 
> (compatibility version 45.0.0, current version 1038.29.0)
> TurboMonkey:~ tciuro$

The contents of the built app show:

> Last login: Wed Jun  2 11:11:14 on ttys000
> TurboMonkey:~ tciuro$ cd 
> /Users/tciuro/Desktop/Builds/Debug/RichEmailSender.app 
> TurboMonkey:RichEmailSender.app tciuro$ cd Contents/
> TurboMonkey:Contents tciuro$ ls -al
> total 16
> drwxr-xr-x  7 tciuro  staff  238 Jun  2 11:08 .
> drwxr-xr-x  3 tciuro  staff  102 Jun  2 11:08 ..
> drwxr-xr-x  4 tciuro  staff  136 Jun  2 11:08 Frameworks
> -rw-r--r--  1 tciuro  staff  906 Jun  2 11:08 Info.plist
> drwxr-xr-x  3 tciuro  staff  102 Jun  2 11:08 MacOS
> -rw-r--r--  1 tciuro  staff8 Jun  2 11:08 PkgInfo
> drwxr-xr-x  4 tciuro  staff  136 Jun  2 11:08 Resources
> TurboMonkey:Contents tciuro$ cd Frameworks/
> TurboMonkey:Frameworks tciuro$ ls -al
> total 0
> drwxr-xr-x  4 tciuro  staff  136 Jun  2 11:08 .
> drwxr-xr-x  7 tciuro  staff  238 Jun  2 11:08 ..
> drwxr-xr-x  6 tciuro  staff  204 Jun  2 11:08 EDCommon.framework
> drwxr-xr-x  6 tciuro  staff  204 

PMSessionSetCurrentPMPrinter crashes on 64 bit Mac (with x86_64 build architecture)

2010-06-02 Thread Shilpi Aggarwal
PMSessionSetCurrentPMPrinter crashes on 64 bit Mac (with x86_64 build 
architecture)

Please find below the crash stack:

EXC_BAD_EXCESS

OpaquePMPrinter::PJCValidPrinterKey ()
PMSessionSetCurrentPMPrinter ()


___

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


ANN: Syntax highlighting editor view

2010-06-02 Thread jonat...@mugginsoft.com
From time to time the issue of syntax highlighting/colouring is raised on the 
list.

Fragaria is framework based on Smultron (now Fraise) that provides a simple way 
of embedding a syntax aware editor in an application.

The project includes a simple demo application that illustrates how to embed a 
Fragaria view into an existing hostview.

The project can be downloaded and forked at:

http://github.com/mugginsoft/Fragaria

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







___

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

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

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

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


Re: -[NSDocument fileURL] is observable (KVO). Documented?

2010-06-02 Thread Jerry Krinock

On 2010 Jun 02, at 02:15, Mike Abdullah wrote:

> er, I meant just override -setFileURL: to post a notification.

But that doesn't solve the possibility of some future OS release changing 
fileURL in a non-KVO-compliant manner when another process changes the path of 
this document.  Not likely, I realize.

But anyhow, I realized later that I also need to watch the *contents* of this 
file (like BBEdit automatically reloads when a file on disk changes), so I'm 
dusting off my kqueue code anyhow.

Thanks for the ideas, all.


___

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: ANN: Syntax highlighting editor view

2010-06-02 Thread Stephane Sudre
Which license? One file mentions Apache, others don't.

On Wed, Jun 2, 2010 at 12:53 PM, jonat...@mugginsoft.com
 wrote:
> From time to time the issue of syntax highlighting/colouring is raised on the 
> list.
>
> Fragaria is framework based on Smultron (now Fraise) that provides a simple 
> way of embedding a syntax aware editor in an application.
>
> The project includes a simple demo application that illustrates how to embed 
> a Fragaria view into an existing hostview.
>
> The project can be downloaded and forked at:
>
> http://github.com/mugginsoft/Fragaria
___

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: ANN: Syntax highlighting editor view

2010-06-02 Thread jonat...@mugginsoft.com
Smultron was released under the Apache 2.0 licence.
Fragaria will follow suit.

I will add the missing licence file to the repository now.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

On 2 Jun 2010, at 13:11, Stephane Sudre wrote:

> Which license? One file mentions Apache, others don't.
> 
> On Wed, Jun 2, 2010 at 12:53 PM, jonat...@mugginsoft.com
>  wrote:
>> From time to time the issue of syntax highlighting/colouring is raised on 
>> the list.
>> 
>> Fragaria is framework based on Smultron (now Fraise) that provides a simple 
>> way of embedding a syntax aware editor in an application.
>> 
>> The project includes a simple demo application that illustrates how to embed 
>> a Fragaria view into an existing hostview.
>> 
>> The project can be downloaded and forked at:
>> 
>> http://github.com/mugginsoft/Fragaria
> ___
> 
> 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/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.com

___

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

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

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

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


Re: ANN: Syntax highlighting editor view

2010-06-02 Thread Rui Pacheco
BSD would be better for shareware developers.

On 2 June 2010 13:20, jonat...@mugginsoft.com wrote:

> Smultron was released under the Apache 2.0 licence.
> Fragaria will follow suit.
>
> I will add the missing licence file to the repository now.
>
> Regards
>
> Jonathan Mitchell
>
> Developer
> Mugginsoft LLP
> http://www.mugginsoft.com
>
> On 2 Jun 2010, at 13:11, Stephane Sudre wrote:
>
> > Which license? One file mentions Apache, others don't.
> >
> > On Wed, Jun 2, 2010 at 12:53 PM, jonat...@mugginsoft.com
> >  wrote:
> >> From time to time the issue of syntax highlighting/colouring is raised
> on the list.
> >>
> >> Fragaria is framework based on Smultron (now Fraise) that provides a
> simple way of embedding a syntax aware editor in an application.
> >>
> >> The project includes a simple demo application that illustrates how to
> embed a Fragaria view into an existing hostview.
> >>
> >> The project can be downloaded and forked at:
> >>
> >> http://github.com/mugginsoft/Fragaria
> > ___
> >
> > 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/jonathan%40mugginsoft.com
> >
> > This email sent to jonat...@mugginsoft.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/rui.pacheco%40gmail.com
>
> This email sent to rui.pach...@gmail.com
>



-- 
Best regards,
Rui Pacheco
___

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: ANN: Syntax highlighting editor view

2010-06-02 Thread jonat...@mugginsoft.com
On 2 Jun 2010, at 14:03, Rui Pacheco wrote:

> BSD would be better for shareware developers.
> 
I don't see a huge practical difference between BSD and Apache 2.0.
If anything Apache 2.0 gives you more rights.

You can use Apache 2.0 licensed code in commercial products.

Google use it.
http://arstechnica.com/old/content/2007/11/why-google-chose-the-apache-software-license-over-gplv2.ars

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com
> On 2 June 2010 13:20, jonat...@mugginsoft.com  wrote:
> Smultron was released under the Apache 2.0 licence.
> Fragaria will follow suit.
> 

___

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: nibs don't know about protocols?

2010-06-02 Thread Matt Neuburg
On or about 6/1/10 12:01 PM, thus spake "Kyle Sluder"
:

> On Tue, Jun 1, 2010 at 11:00 AM, Matt Neuburg  wrote:
>> So... Are nibs just ignorant of protocols?
> 
> I don't believe the nib loading machinery checks protocol conformance
> when it hooks up outlets. It certainly doesn't check class identity,
> so I wouldn't expect it to check protocol conformance either.

But the nib itself does check class identity; you can't draw an outlet to an
instance of the wrong class. So I'm left wondering, then why are you allowed
to draw an outlet to an instance of a class that doesn't adopt the required
protocol? This feels like a bug to me.

And the fact that you can hook up the UIApplication to a delegate that
doesn't adopt UIApplicationDelegate and run the app and have everything
work, with no complaints at any point, *really* feels like a bug, because in
that case what's the protocol for?

Maybe I should move this over to Xcode-tools list? I started here because
protocols are a Cocoa / language thing, not a tools thing. Wht thnk? m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



___

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

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

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

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


Re: Simulating app termination

2010-06-02 Thread Michael Ash
On Tue, Jun 1, 2010 at 3:34 PM, Kyle Sluder  wrote:
> On Tue, Jun 1, 2010 at 12:26 PM, Michael Ash  wrote:
>> If your goal is to simulate shutdown/restart termination, this won't
>> work; the system does not send signals to your app to kill it during
>> those situations.
>
> TN2083 is ambiguous about this. Here's the relevant section:
>
>> This program is killed because the window server keeps track of the 
>> processes that are using its services. When you log out, the system 
>> (actually loginwindow) tries to quit these. For each GUI process, it sends a 
>> 'quit' Apple event to the process. If any GUI process refuses to quit, 
>> loginwindow halts the logout and displays a message to the user.
>>
>> The situation for non-GUI processes is slightly different: loginwindow first 
>> tries to quit the process using a 'quit' Apple event; if that fails it 
>> terminates the program by sending it a SIGKILL signal. There is no way to 
>> catch or ignore this signal.
>>
>> The upshot of this is that, if your process connects to the window server, 
>> it will not survive a normal logout."
>
> So it's clear that non-GUI apps get a quit event and then a SIGKILL,
> but it doesn't say anything about GUI apps that don't acknowledge the
> quit event.

It's not 100% clear whether it applies, but "refuses to quit" could
certainly be taken as also applying to apps which don't handle the
event at all.

Mike
___

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

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

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

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


Re: nibs don't know about protocols?

2010-06-02 Thread Michael Ash
On Wed, Jun 2, 2010 at 11:00 AM, Matt Neuburg  wrote:
> On or about 6/1/10 12:01 PM, thus spake "Kyle Sluder"
> :
>
>> On Tue, Jun 1, 2010 at 11:00 AM, Matt Neuburg  wrote:
>>> So... Are nibs just ignorant of protocols?
>>
>> I don't believe the nib loading machinery checks protocol conformance
>> when it hooks up outlets. It certainly doesn't check class identity,
>> so I wouldn't expect it to check protocol conformance either.
>
> But the nib itself does check class identity; you can't draw an outlet to an
> instance of the wrong class. So I'm left wondering, then why are you allowed
> to draw an outlet to an instance of a class that doesn't adopt the required
> protocol? This feels like a bug to me.

To be clear on terminology, "the nib" doesn't check anything, it's
just a file. Interface builder checks class identity, and would be the
one to check protocol conformance.

I wouldn't call it a bug, but it's certainly an omission.

> And the fact that you can hook up the UIApplication to a delegate that
> doesn't adopt UIApplicationDelegate and run the app and have everything
> work, with no complaints at any point, *really* feels like a bug, because in
> that case what's the protocol for?

The protocol exists primarily to eliminate the unusual and
difficult-to-discover concept of "informal protocol", and to make
explicit the link between the delegate parameter and the protocol.
ObjC tends to be built around duck typing, so if you defeat the type
system and hook up an object which doesn't declare conformance to
UIApplicationDelegate, but which still implements the requisite
methods, then it's only expected that things would work. The fact that
IB makes it really easy to defeat the type checking is something of a
separate issue.

> Maybe I should move this over to Xcode-tools list? I started here because
> protocols are a Cocoa / language thing, not a tools thing. Wht thnk? m.

Since this is an IB feature, or lack thereof, then definitely.

Mike
___

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

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

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

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


Spotlight-Style search menu

2010-06-02 Thread John Johnson
So I know how to set a view in an NSMenuItem, but my question is how to get it 
to look similar to the Spotlight search menu. For example, if I set the first 
item in a popup menu to a custom view, there is still a thin strip of "white" 
across the top. I want the gradient from the view to fill up the entire 
background. Is this a custom control or is there a way to get an NSMenu to 
behave like this?

John___

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


The Unadopted Protocol

2010-06-02 Thread Matt Neuburg
Here's something I stumbled on by accident. Consider the following:

//  MyClass.h
#import 
@interface MyClass : NSObject {
}
@end

//  MyClass.m
#import "MyClass.h"
@implementation MyClass
- (void) testing {
NSLog(@"testing");
}
@end

//  UnadoptedProtocolAppDelegate.h
#import 
... // skipping irrelevant stuff
@protocol Unadopted
- (void) testing;
@end

//  UnadoptedProtocolAppDelegate.m
#import "UnadoptedProtocolAppDelegate.h"
#import "MyClass.h"
@implementation UnadoptedProtocolAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
MyClass* mc = [[MyClass alloc] init];
[(id)mc testing];
}
@end

This compiles and runs fine, even though MyClass never adopted the protocol
Unadopted. It take it that by casting mc to an id, I cause the compiler to
grasp at the only signature for "testing" that it knows about, namely the
one in the protocol. So it happily uses that signature without complaint,
and at runtime the correct message is sent to the MyClass instance.

So this appears to be a technique for implementing a highly informal
protocol. (The technique is: define a protocol, don't bother adopting it
anywhere, but send messages defined in that protocol to an id.) My question
is, is this technique:

(a) pointless and lazy

(b) sneaky and clever

(c) just a mistake all round

(d) well known; you only just noticed this??

(e) all of the above

(f) none of the above

:) m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: The Unadopted Protocol

2010-06-02 Thread Dave DeLong
Mostly d, but partly f.  It's d in that it's well-known that you can send any 
message you want to an id, but f in that the scenario you came up with is a 
slightly unusual one.

Dave

On Jun 2, 2010, at 9:57 AM, Matt Neuburg wrote:

> Here's something I stumbled on by accident. Consider the following:
> 
> //  MyClass.h
> #import 
> @interface MyClass : NSObject {
> }
> @end
> 
> //  MyClass.m
> #import "MyClass.h"
> @implementation MyClass
> - (void) testing {
>NSLog(@"testing");
> }
> @end
> 
> //  UnadoptedProtocolAppDelegate.h
> #import 
> ... // skipping irrelevant stuff
> @protocol Unadopted
> - (void) testing;
> @end
> 
> //  UnadoptedProtocolAppDelegate.m
> #import "UnadoptedProtocolAppDelegate.h"
> #import "MyClass.h"
> @implementation UnadoptedProtocolAppDelegate
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>MyClass* mc = [[MyClass alloc] init];
>[(id)mc testing];
> }
> @end
> 
> This compiles and runs fine, even though MyClass never adopted the protocol
> Unadopted. It take it that by casting mc to an id, I cause the compiler to
> grasp at the only signature for "testing" that it knows about, namely the
> one in the protocol. So it happily uses that signature without complaint,
> and at runtime the correct message is sent to the MyClass instance.
> 
> So this appears to be a technique for implementing a highly informal
> protocol. (The technique is: define a protocol, don't bother adopting it
> anywhere, but send messages defined in that protocol to an id.) My question
> is, is this technique:
> 
> (a) pointless and lazy
> 
> (b) sneaky and clever
> 
> (c) just a mistake all round
> 
> (d) well known; you only just noticed this??
> 
> (e) all of the above
> 
> (f) none of the above
> 
> :) m.
> 
> -- 
> matt neuburg, phd = m...@tidbits.com, 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.tidbits.com/matt/default.html#applescriptthings
> 
> 
> 
> ___
> 
> 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/davedelong%40me.com
> 
> This email sent to davedel...@me.com



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: The Unadopted Protocol

2010-06-02 Thread Kevin Wojniak
I've used this when compiling code for both 10.6 and below to avoid  
protocol errors. Seems to do the trick.


Kevin


On Jun 2, 2010, at 8:57 AM, Matt Neuburg  wrote:


Here's something I stumbled on by accident. Consider the following:

//  MyClass.h
#import 
@interface MyClass : NSObject {
}
@end

//  MyClass.m
#import "MyClass.h"
@implementation MyClass
- (void) testing {
   NSLog(@"testing");
}
@end

//  UnadoptedProtocolAppDelegate.h
#import 
... // skipping irrelevant stuff
@protocol Unadopted
- (void) testing;
@end

//  UnadoptedProtocolAppDelegate.m
#import "UnadoptedProtocolAppDelegate.h"
#import "MyClass.h"
@implementation UnadoptedProtocolAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *) 
aNotification {

   MyClass* mc = [[MyClass alloc] init];
   [(id)mc testing];
}
@end

This compiles and runs fine, even though MyClass never adopted the  
protocol
Unadopted. It take it that by casting mc to an id, I cause the  
compiler to
grasp at the only signature for "testing" that it knows about,  
namely the
one in the protocol. So it happily uses that signature without  
complaint,

and at runtime the correct message is sent to the MyClass instance.

So this appears to be a technique for implementing a highly informal
protocol. (The technique is: define a protocol, don't bother  
adopting it
anywhere, but send messages defined in that protocol to an id.) My  
question

is, is this technique:

(a) pointless and lazy

(b) sneaky and clever

(c) just a mistake all round

(d) well known; you only just noticed this??

(e) all of the above

(f) none of the above

:) m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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/kainjow%40kainjow.com

This email sent to kain...@kainjow.com

___

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

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

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

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


Re: The Unadopted Protocol

2010-06-02 Thread John Johnson

> This compiles and runs fine, even though MyClass never adopted the protocol
> Unadopted. It take it that by casting mc to an id, I cause the compiler to
> grasp at the only signature for "testing" that it knows about, namely the
> one in the protocol. So it happily uses that signature without complaint,
> and at runtime the correct message is sent to the MyClass instance.

I noticed this, but I assume that by casting it to an id you are discarding the 
protocol conformance. I'd always thought protocol conformance was just to have 
the compiler warn you if you hadn't implemented a particular method. Doesn't it 
only get checked at runtime if conformsToProtocol: is called on it?
By having an id variable, the compiler thinks it can accept any message, and if 
the object can respond to that message at runtime, it's all fine.

So... maybe (d) :)

___

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


Displaying dialog at shutdown

2010-06-02 Thread lorenzo7620
I have a very simple application that runs as an  
LSUIElement/BackgroundOnly. Its only purpose is to display a message and  
play a short sound (3 seconds) to the user whenever it quits, which, since  
its a background only app, is only at shutdown/restart. I can use an  
AppleScript to force the app to quit and when doing that, I see the dialog  
every time, but if I actually restart the computer, I only see the dialog,  
maybe 1 out of 5 times. I use a timer to dismiss the dialog after 5 seconds  
and it seems that it is more likely to appear if the timer has a longer  
duration, say 15 seconds. My code is below. The window is an NSWindow  
instance that's been wired in IB.


//
// TurnOffMouseAppDelegate.m
// TurnOffMouse
//

#import "TurnOffMouseAppDelegate.h"

@implementation TurnOffMouseAppDelegate

@synthesize window;
@synthesize windowController;
@synthesize timer;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application

self.windowController = [[NSWindowController alloc]  
initWithWindow:self.window];

}


- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication  
*)sender{


[self playShutdownMessage:nil];

[self.windowController showWindow:nil];

self.timer = [NSTimer timerWithTimeInterval:5.0 target:self  
selector:@selector(closeWindow:) userInfo:nil

repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSModalPanelRunLoopMode];

return NSTerminateLater;
}

-(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedPlaying{

NSLog(@"Sound finished");
}

-(void)closeWindow:(id)sender{

[self.windowController close];
[NSApp replyToApplicationShouldTerminate:YES];
}

-(IBAction)playShutdownMessage:(id)sender{

BOOL playing;

NSLog(@"Playing sound");

NSSound * shutdown = [NSSound soundNamed:@"Shutdown Voice"];
[shutdown setDelegate:self];

if(![shutdown isPlaying])
playing = [shutdown play];
}
@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


Re: [iPhone] more UIScrollView

2010-06-02 Thread David Duncan
On Jun 1, 2010, at 9:00 PM, Development wrote:

> That's pretty much where I started with this code. However it's still fuzzy.
> I can scale the view itself and it's perfectly clear but the origin is all 
> messed up and it's offset halfway out of it's parent view. thats what I tried 
> here:CGContextScaleCTM(context, scle,scle);
> 
> I've attempted to scale the bounds of the view itself, redraw the content and 
> then adjust the size  of the scrollview's content but that ends up being the 
> same mess as before. I was hoping I could get a little more information on 
> rendering an image.


The tiled layer will generally only be sharp when you have a power of two zoom. 
If you are willing to do a LOT more work you can make this better, and a 
reasonable starting point might be the ScrollViewSuite tiling example. That 
example however scales down larger images, which may still be fuzzy in some 
cases (for example line art). Getting pixel perfect zooming however is 
difficult and to rather performance intensive for something like PDF.

You could also try just using a UIWebView for displaying PDF if it does what 
you need.
--
David Duncan
Apple DTS Animation and Printing

___

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

2010-06-02 Thread Ross Carter
On Jun 1, 2010, at 4:25 PM, Keary Suska wrote:

> On Jun 1, 2010, at 11:18 AM, Erick Pérez wrote:
> 
>> Hi:
>> I manage to bind the text color to a color well, one of those many
>> tutorials you can find online, but what i want is to change the color
>> of the selected text's background. Can i bind that ?
> 
> Bookmark this page: 
> http://developer.apple.com/mac/library/documentation/Cocoa/Reference/CocoaBindingsRef/CocoaBindingsRef.html
>  . It tells you everything you can bind for all Cocoa views.
> 
> You will notice that you can't. Notice that you generally can only bind 
> values that effect the entire view/control. I believe what you are after can 
> be specified using an NSParagraphStyle, but not via bindings.

I think you want to look at NSTextView -selectedTextAttributes

___

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: Displaying dialog at shutdown

2010-06-02 Thread Jens Alfke

On Jun 2, 2010, at 9:13 AM, lorenzo7...@gmail.com wrote:

> I can use an AppleScript to force the app to quit and when doing that, I see 
> the dialog every time, but if I actually restart the computer, I only see the 
> dialog, maybe 1 out of 5 times.

This is on 10.6? Read the system docs about “Sudden Termination”. This is an OS 
optimization that quits apps by simply killing the process unless the app 
registers that it has specific things it needs to do upon quit. Now, I think 
that registering a custom -applicationShouldTerminate: handler would disable 
sudden termination, but I haven’t actually worked with this feature so I don’t 
know for sure; and this seems like the most likely thing to me.

—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 arch...@mail-archive.com


Re: Spotlight-Style search menu

2010-06-02 Thread Kyle Sluder
On Jun 2, 2010, at 8:48 AM, John Johnson   
wrote:


So I know how to set a view in an NSMenuItem, but my question is how  
to get it to look similar to the Spotlight search menu. For example,  
if I set the first item in a popup menu to a custom view, there is  
still a thin strip of "white" across the top. I want the gradient  
from the view to fill up the entire background. Is this a custom  
control or is there a way to get an NSMenu to behave like this?


Currently there is not. You should file an enhancement request at http://bugreport.apple.com 
 asking for this feature. You're certainly not the only one who would  
like it. :)


--Kyle Sluder
___

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

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

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

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


Re: Spotlight-Style search menu

2010-06-02 Thread Chaitanya Pandit

I don't know but if you can set your NSStatusItem as a custom view and 
determine it's location on the screen, you can then show your custom view in a 
borderless window at that position

On Jun 2, 2010, at 9:18 PM, John Johnson wrote:

> So I know how to set a view in an NSMenuItem, but my question is how to get 
> it to look similar to the Spotlight search menu. For example, if I set the 
> first item in a popup menu to a custom view, there is still a thin strip of 
> "white" across the top. I want the gradient from the view to fill up the 
> entire background. Is this a custom control or is there a way to get an 
> NSMenu to behave like this?
> 
> John___
> 
> 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/chaitanya%40expersis.com
> 
> This email sent to chaita...@expersis.com

___

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

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

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

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


Re: Spotlight-Style search menu

2010-06-02 Thread John Johnson

> Currently there is not. You should file an enhancement request at 
> http://bugreport.apple.com asking for this feature. You're certainly not the 
> only one who would like it. :)
> 
> --Kyle Sluder

Hmm that is slightly disappointing. Another couple of subclasses and dozens of 
lines of code for this one feature... I filed the enhancement request as per 
your suggestion, thanks for your quick response.


> I don't know but if you can set your NSStatusItem as a custom view and 
> determine it's location on the screen, you can then show your custom view in 
> a borderless window at that position

This is the solution I've decided on as well. It's actually a button on a 
window that I want to trigger the search field to pop down, and I still want it 
to behave like a menu, i.e. clicking anywhere else on the screen dismisses the 
"menu", and the button get's the pushed in look. What's the best way to achieve 
this behavior? ___

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: Displaying dialog at shutdown

2010-06-02 Thread lorenzo7620

On Jun 2, 2010 11:22am, Jens Alfke  wrote:


On Jun 2, 2010, at 9:13 AM, lorenzo7...@gmail.com wrote:


I can use an AppleScript to force the app to quit and when doing that, I  
see the dialog every time, but if I actually restart the computer, I only  
see the dialog, maybe 1 out of 5 times.


This is on 10.6? Read the system docs about “Sudden Termination”. This is  
an OS optimization that quits apps by simply killing the process unless  
the app registers that it has specific things it needs to do upon quit.  
Now, I think that registering a custom -applicationShouldTerminate:  
handler would disable sudden termination, but I haven't actually worked  
with this feature so I don't know for sure; and this seems like the most  
likely thing to me.




—Jens




Yes, its for 10.6. I'm looking at the “Sudden Termination” as I write this.
Thx
___

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: ANN: Syntax highlighting editor view

2010-06-02 Thread Uli Kusterer
Am Jun 2, 2010 um 3:03 PM schrieb Rui Pacheco:
> BSD would be better for shareware developers.

There's always my http://github.com/uliwitness/UKSyntaxColoredTextDocument/ if 
you want a more liberal license (it's zlib-style).

-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



___

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: Spotlight-Style search menu

2010-06-02 Thread Chaitanya Pandit
> 
> This is the solution I've decided on as well. It's actually a button on a 
> window that I want to trigger the search field to pop down, and I still want 
> it to behave like a menu, i.e. clicking anywhere else on the screen dismisses 
> the "menu", and the button get's the pushed in look. What's the best way to 
> achieve this behavior? ___
> 

Well, you can have the custom view in the status bar to be a NSButton, it's 
action will compute the location and make the window key and visible at that 
location and when the window resigns key, just fade it away

> 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/chaitanya%40expersis.com
> 
> This email sent to chaita...@expersis.com

___

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

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

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

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


Re: Spotlight-Style search menu (SOLVED)

2010-06-02 Thread John Johnson

> Well, you can have the custom view in the status bar to be a NSButton, it's 
> action will compute the location and make the window key and visible at that 
> location and when the window resigns key, just fade it away

Brilliant! Seems the only way to go. Anyhow, thanks for the help 
:)___

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: The Unadopted Protocol

2010-06-02 Thread Quincey Morris
On Jun 2, 2010, at 08:57, Matt Neuburg wrote:

> So this appears to be a technique for implementing a highly informal
> protocol.

What's the problem that this technique is intended to solve?

This is one of several techniques that can be used to send an arbitrary message 
to an arbitrary object without a compiler warning.

Note, though, that in the example you gave, 'testing' is a *private* method of 
MyClass (since MyClass chose not to put the method in its public 
@implementation), so you've violated MyClass's API contract. If 'testing' 
really is private, invoking it externally seems like a bad idea. If it's really 
public, declaring it so (in MyClass.h) seems like a good idea.


___

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

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

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

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


Delayed -dealloc occurs on worker thread if object is "working". How?

2010-06-02 Thread Jerry Krinock
I allocate an object Foo on the main thread.  Then I spin off a secondary 
thread and give it a long task to do there, but immediately release the object, 
on the main thread.  I expect that the -release invoke -dealloc immediately, on 
the main thread.  To my amazement, the object is not deallocced until the task 
is finished, and to my further amazement, the dealloc method runs on the 
secondary thread.

Someone please enlighten me.  This is Mac OS 10.6.3, Objective-C garbage 
collection = unsupported.

Jerry Krinock


#import 

@interface Foo : NSObject {
}
@end

@implementation Foo

- (void)sleep5 {
NSLog(@"Sleeping for 5 on secondary thread") ;
sleep(5) ;
} 


- (void)dealloc {
[super dealloc] ;
NSLog(@"Did dealloc a Foo") ;
}

@end


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

Foo* foo = [[Foo alloc] init] ;
[NSThread detachNewThreadSelector:@selector(sleep5)
 toTarget:foo
   withObject:nil] ;
[foo release] ;

sleep(10) ;

NSLog(@"Terminating") ;
[pool release] ;
return 0 ;
}

RESULT:

10:23:00.879 LittleTool[83071:1103] Sleeping for 5 on secondary thread
10:23:05.884 LittleTool[83071:1103] Will dealloc a Foo
10:23:05.885 LittleTool[83071:1103] Did dealloc a Foo
10:23:10.879 LittleTool[83071:80f] Terminating

___

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: Delayed -dealloc occurs on worker thread if object is "working". How?

2010-06-02 Thread BJ Homer
detachNewThreadSelector:target:withObject: retains both the target and the
object.

-BJ

On Wed, Jun 2, 2010 at 11:39 AM, Jerry Krinock  wrote:

> I allocate an object Foo on the main thread.  Then I spin off a secondary
> thread and give it a long task to do there, but immediately release the
> object, on the main thread.  I expect that the -release invoke -dealloc
> immediately, on the main thread.  To my amazement, the object is not
> deallocced until the task is finished, and to my further amazement, the
> dealloc method runs on the secondary thread.
>
> Someone please enlighten me.  This is Mac OS 10.6.3, Objective-C garbage
> collection = unsupported.
>
> Jerry Krinock
>
>
> #import 
>
> @interface Foo : NSObject {
> }
> @end
>
> @implementation Foo
>
> - (void)sleep5 {
>NSLog(@"Sleeping for 5 on secondary thread") ;
>sleep(5) ;
> }
>
>
> - (void)dealloc {
>[super dealloc] ;
>NSLog(@"Did dealloc a Foo") ;
> }
>
> @end
>
>
> int main(int argc, char *argv[]) {
>NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init] ;
>
>Foo* foo = [[Foo alloc] init] ;
>[NSThread detachNewThreadSelector:@selector(sleep5)
> toTarget:foo
>   withObject:nil] ;
>[foo release] ;
>
>sleep(10) ;
>
>NSLog(@"Terminating") ;
>[pool release] ;
>return 0 ;
> }
>
> RESULT:
>
> 10:23:00.879 LittleTool[83071:1103] Sleeping for 5 on secondary thread
> 10:23:05.884 LittleTool[83071:1103] Will dealloc a Foo
> 10:23:05.885 LittleTool[83071:1103] Did dealloc a Foo
> 10:23:10.879 LittleTool[83071:80f] Terminating
>
> ___
>
> 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/bjhomer%40gmail.com
>
> This email sent to bjho...@gmail.com
>
___

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

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

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

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


Re: The Unadopted Protocol

2010-06-02 Thread Greg Parker
On Jun 2, 2010, at 8:57 AM, Matt Neuburg wrote:
> So this appears to be a technique for implementing a highly informal
> protocol. (The technique is: define a protocol, don't bother adopting it
> anywhere, but send messages defined in that protocol to an id.)

Yep. When the compiler looks for a method declaration matching a message sent 
to `id`, it looks at every declaration encountered up to that point in the file.

That's comparable to the traditional way to create informal protocols: declare 
a category on NSObject, don't bother implementing it anywhere, and send 
messages declared in that category to other objects.

In general we discourage both of these now. The problem is that somebody 
somewhere is likely to declare a method with the same name but different 
parameter types. In these cases - message to `id` and category on NSObject - 
the compiler has no way to know which declaration to use. If it guesses wrong, 
your code may be doomed.


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


___

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

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

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

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


Re: Delayed -dealloc occurs on worker thread if object is "working". How?

2010-06-02 Thread Jens Alfke

On Jun 2, 2010, at 10:39 AM, Jerry Krinock wrote:

> I allocate an object Foo on the main thread.  Then I spin off a secondary 
> thread and give it a long task to do there, but immediately release the 
> object, on the main thread.  I expect that the -release invoke -dealloc 
> immediately, on the main thread.

Why? If that were so, the secondary thread would crash when it messaged the 
now-dealloced object. By telling the object to do something on a secondary 
thread, you’re implicitly requesting that the object stay alive until that 
operation finishes. Right?

>  To my amazement, the object is not deallocced until the task is finished, 
> and to my further amazement, the dealloc method runs on the secondary thread.

It’s really not a good idea to obsess over the details of when objects get 
dealloced, unless of course you’re running into dealloced-object crashes or 
memory leaks.

—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 arch...@mail-archive.com


Re: The Unadopted Protocol

2010-06-02 Thread Matt Neuburg
On or about 6/2/10 11:11 AM, thus spake "Greg Parker" :

> On Jun 2, 2010, at 8:57 AM, Matt Neuburg wrote:
>> So this appears to be a technique for implementing a highly informal
>> protocol. (The technique is: define a protocol, don't bother adopting it
>> anywhere, but send messages defined in that protocol to an id.)
> 
> Yep. When the compiler looks for a method declaration matching a message sent
> to `id`, it looks at every declaration encountered up to that point in the
> file.
> 
> That's comparable to the traditional way to create informal protocols: declare
> a category on NSObject, don't bother implementing it anywhere, and send
> messages declared in that category to other objects.
> 
> In general we discourage both of these now.

Fair enough; now that a protocol can declare some methods @optional, things
are pretty flexible.

But then I would just suggest that if you want to discourage a category on
NSObject as a way of doing informal protocols, you should discourage it; the
docs here teach it in a way that makes it sound perfectly acceptable:



m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



___

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

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

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

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


NSNumberFormatter setLocalizesFormat, docs wrong or implementation wrong?

2010-06-02 Thread Sean McBride
Hi all,

Any NSNumberFormatter experts out there?

The docs for setLocalizesFormat: say "This method is for use with
formatters using NSNumberFormatterBehavior10_0 behavior."  This is
plainly wrong, which you can prove to yourself with a simple test, as I
did.  It applies to NSNumberFormatterBehavior10_4  formatters also.

Are the docs just wrong?

Cheers,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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


Mail Frameworks

2010-06-02 Thread Jeremy Matthews
So...I'm working on an app that needs an email framework to send 
messages...right now I'm using MailCore, and I hear good things about EDMessage 
as well...where I am at now I need to send attachments and neither is very 
forthcoming on support details there (or examples) - so I am reading through 
headers and trying to figure what works and what doesn't.

Is anyone using either of these for attachments?

Any opinions on one or the other? Something else?

Thanks,
jeremy
___

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

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

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

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


How to change color of text in webView

2010-06-02 Thread Nava Carmon
Hi,

Is it possible to change the font color in web view? How do I do it?

Thanks,

Nava Carmon
ncar...@mac.com

"Think good and it will be good!"

___

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


app crashing, some errors in console are related to drawing of UI elements

2010-06-02 Thread Nick Rogers
Hi,
The app sometime (not always) crashes when run on Leopard OS (32-bit) on an old 
mac mini. On Leopard (64-bit) and Snow Leopard, the crash never happens.
The app is GC enabled.

I'm running a separate thread to do some processing, and it does update a few 
text fields and a progress bar on the main window.
The updating of these text fields is done by calling a method 
(updateTreeProgress:) on main thread using performSelectorOnMainThread: 
(waitUntilDone: YES) and passing it an NSMutableDIctionary, the method on main 
thread then picks values from the dictionary and updates the text fields and 
the progress bar.
I have a NSLog at the beginning of this method.
But after its called once, and about to be called second time (an NSLog tells 
me its about to be called using performSelectorOnMainThread:), the NSLog at the 
very beginning of this method doesn't get printed on console.

However, there are other console msgs, that are shown below:

1. updateTreeProgress: called (first time called, only sets min and max value 
of a progress bar and doesn't sets the text fields)
2. : CGContextSetFillColorWithColor: invalid context
3. other NSLog msgs
4. : CGContextSetTextMatrix: invalid context
5. : CGContextSetFont: invalid context
6. : CGContextSetFontSize: invalid context
7. : CGContextGetShouldSmoothFonts: invalid context
8. : CGContextSetFontRenderingStyle: invalid context
9. : CGContextSetFillColorWithColor: invalid context
10. : CGContextSetStrokeColorWithColor: invalid context
11. : CGContextSetTextPosition: invalid context
12. : CGContextShowGlyphsWithAdvances: invalid context
13. : CGContextSetTextPosition: invalid context
14. : CGContextShowGlyphsWithAdvances: invalid context
15. : CGContextSetTextPosition: invalid context
16. : CGContextShowGlyphsWithAdvances: invalid context
17. : CGContextSaveGState: invalid context
18. : CGContextTranslateCTM: invalid context
19. : CGContextScaleCTM: invalid context
20. : CGContextConvertSizeToDeviceSpace: invalid context
21. : CGContextConvertSizeToDeviceSpace: invalid context
22. : CGContextGetCTM: invalid context
23. : CGContextGetAlpha: invalid context
24. : CGContextSaveGState: invalid context
25. : CGContextSetAlpha: invalid context
26. : CGContextGetCompositeOperation: invalid context
27. : CGContextSetCompositeOperation: invalid context
28. : CGContextDrawImage: invalid context
29. : CGContextRestoreGState: invalid context
30. : CGContextRestoreGState: invalid context
31. : CGContextConcatCTM: invalid context
32. updateTreeProgress: about to be called using performSelectorOnMainThread: 
but doesn't get called. and the app crashes here.

There are other NSLog msgs between these msgs.
Also there are similar msgs, as reproduced below, on system log for various 
system apps which say that ATSServer died
Jun  3 00:30:02 ddlabss-mac-mini 
/Applications/TextEdit.app/Contents/MacOS/TextEdit[1396]: received ATSServer 
died message.  (old server pid = 3221, new pid = 3285, session ID = 256)

Any insights, comments would be greatly appreciated.

Wishes,
Nick

___

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


Problem with CGPDFPageRef

2010-06-02 Thread Development
Ok this is bizarre and it's been happening in several apps of mine and I don't 
understand it.
I'm getting scrambled variable data. For instance I pass a float 'float' with a 
value of 1.0 and the receiver gets some weird number like 345783653.0.

Most recently what is happening has me completely perplexed. 
I load a pdf file.
I render the first page. 
I then render the second page.
Now if I attempt to get the first page again the app crashes.

So I logged the PDFPageRef and its not what it should be, what I get back is a 
CALayer. I have no clue how this could be happening but the page is lost. Even 
if I try again to get the page from the document its a CALayer and if I attempt 
to log the document then the app crashes with nothing but EXC_BAD_ACCESS

Can any one help with this?___

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: Mail Frameworks

2010-06-02 Thread Simon Wolf
On 2 Jun 2010, at 19:57, Jeremy Matthews wrote:

> So...I'm working on an app that needs an email framework to send 
> messages...right now I'm using MailCore, and I hear good things about 
> EDMessage as well...where I am at now I need to send attachments and neither 
> is very forthcoming on support details there (or examples) - so I am reading 
> through headers and trying to figure what works and what doesn't.
> 
> Is anyone using either of these for attachments?
> 
> Any opinions on one or the other? Something else?

I'm using EDMessage in a project and it has been good to work with albeit with 
a few quirks.

1. EDMessage and EDCommon both contain some deprecated methods. You can either 
ignore these or do as I did and tidy them up. Essentially it was replacing 
occurrences of 'stringWithContentsOfFile:' with 
'stringWithContentsOfFile:encoding:error:' and replacing 'stringWithCString:' 
with 'stringWithCString:encoding:'. I also replaced an occurrence of 
'stringWithCString:length:' with 'stringWithCharacters:length:'.

2. I had a problem attaching text files because they appeared in-line in the 
emails rather than as attachments. I never really got to the bottom of whether 
this was a problem with mail clients or with the framework. You can read about 
it in my post in their forums at:
http://www.mulle-kybernetik.com/forum/viewtopic.php?f=5&t=58

3. I had a problem with spaces in attachment names. Again, you can read about 
it in their forums at:
http://www.mulle-kybernetik.com/forum/viewtopic.php?f=5&t=59

However the framework is easy to use and has been reliable and I worked around 
the last two issues.

Simon Wolf

Website: http://www.ottersoftware.com
Twitter: http://www.twitter.com/sgaw
iChat: simon.w...@mac.com___

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

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

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

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


Re: Problem with CGPDFPageRef

2010-06-02 Thread David Duncan
On Jun 2, 2010, at 1:11 PM, Development wrote:

> Ok this is bizarre and it's been happening in several apps of mine and I 
> don't understand it.
> I'm getting scrambled variable data. For instance I pass a float 'float' with 
> a value of 1.0 and the receiver gets some weird number like 345783653.0.


What's the code look like here? Are you getting any warnings?

More than likely this is something along the lines of a type mismatch on the 
message send, but without seeing the code it is hard to know how or why that 
might happen.
--
David Duncan
Apple DTS Animation and Printing

___

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: Problem with CGPDFPageRef

2010-06-02 Thread David Duncan
On Jun 2, 2010, at 1:23 PM, Development wrote:

> This is what I use to get the page: CGPDFPageRef thePage = 
> CGPDFDocumentGetPage(self.pdf,1);
> and what is passed back is a CALayer


You previously mentioned that a receiver was getting the incorrect value – this 
code doesn't show any objects or messages. Where are you getting the wrong 
value and where is that code being called from with the correct value?
--
David Duncan
Apple DTS Animation and Printing

___

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: Mail Frameworks

2010-06-02 Thread Laurent Cerveau
Is this on MacOS or iPhoneOS? I think the way to go on MacOS is  
through the scripting bridge


laurent

Sent from my road phone


On Jun 2, 2010, at 8:57 PM, Jeremy Matthews   
wrote:


So...I'm working on an app that needs an email framework to send  
messages...right now I'm using MailCore, and I hear good things  
about EDMessage as well...where I am at now I need to send  
attachments and neither is very forthcoming on support details there  
(or examples) - so I am reading through headers and trying to figure  
what works and what doesn't.


Is anyone using either of these for attachments?

Any opinions on one or the other? Something else?

Thanks,
jeremy
___

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/lcerveau%40me.com

This email sent to lcerv...@me.com

___

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

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

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

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


Re: Mail Frameworks

2010-06-02 Thread Jeremy Matthews

Mac OS...

Sent from my iPhone

On Jun 2, 2010, at 3:25 PM, Laurent Cerveau  wrote:

Is this on MacOS or iPhoneOS? I think the way to go on MacOS is  
through the scripting bridge


laurent

Sent from my road phone


On Jun 2, 2010, at 8:57 PM, Jeremy Matthews   
wrote:


So...I'm working on an app that needs an email framework to send  
messages...right now I'm using MailCore, and I hear good things  
about EDMessage as well...where I am at now I need to send  
attachments and neither is very forthcoming on support details  
there (or examples) - so I am reading through headers and trying to  
figure what works and what doesn't.


Is anyone using either of these for attachments?

Any opinions on one or the other? Something else?

Thanks,
jeremy
___

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/lcerveau%40me.com

This email sent to lcerv...@me.com

___

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

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

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

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


Access ObjC class from PyOBJC

2010-06-02 Thread jonat...@mugginsoft.com
My app is ObjC cocoa based 

It also loads and executes PyObjC classes.

I require my loaded PyObjC code to access an ObjC class (myControllerClass) 
defined within an ObjC framework linked to the main application.

The desired Python looks something like:

#py
import AppKit

taskController = myControllerClass.sharedController()

#py

Do I need to define a py wrapper from my framework and import it to accomplish 
this?
And if so, how is the wrapper constructed.

Or am I missing something simple here.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







___

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

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

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

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


Re: Access ObjC class from PyOBJC

2010-06-02 Thread Bill Bumgarner

On Jun 2, 2010, at 2:16 PM, jonat...@mugginsoft.com wrote:

> My app is ObjC cocoa based 
> 
> It also loads and executes PyObjC classes.
> 
> I require my loaded PyObjC code to access an ObjC class (myControllerClass) 
> defined within an ObjC framework linked to the main application.
> 
> The desired Python looks something like:
> 
> #py
> import AppKit
> 
> taskController = myControllerClass.sharedController()
> 
> #py
> 
> Do I need to define a py wrapper from my framework and import it to 
> accomplish this?
> And if so, how is the wrapper constructed.
> 
> Or am I missing something simple here.

You don't need to define a wrapper or use bridge support metadata *unless* your 
class's API has methods whose arguments and types can't be handled by default 
(most can) *and* you need to call those from Python.

import Foundation
klass = Foundation.NSClassFromString("MyControllerClass")

controller = klass.new()

> 
> Regards
> 
> Jonathan Mitchell
> 
> Developer
> Mugginsoft LLP
> http://www.mugginsoft.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/bbum%40mac.com
> 
> This email sent to b...@mac.com

___

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

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

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

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


NSNumberFormatter and printf-style %g ?

2010-06-02 Thread Sean McBride
Hi all,

Is there a way to make NSNumberFormatter work like printf's %g ?

That is, "print a double in either normal or exponential notation,
whichever is more appropriate for its magnitude."

As best as I can tell from the docs the answer in no.

I know about NSNumberFormatterScientificStyle, but it seems
unconditional.  ex: I'll get "5E0" instead of just "5".  I'd like
numbers like 5 to appear as "5" and numbers like 0.005 to appear as 5E-7.

Cheers,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: Mail Frameworks

2010-06-02 Thread Torsten Curdt
On Wed, Jun 2, 2010 at 22:12, Simon Wolf  wrote:
> On 2 Jun 2010, at 19:57, Jeremy Matthews wrote:
>
>> So...I'm working on an app that needs an email framework to send 
>> messages...right now I'm using MailCore, and I hear good things about 
>> EDMessage as well...where I am at now I need to send attachments and neither 
>> is very forthcoming on support details there (or examples) - so I am reading 
>> through headers and trying to figure what works and what doesn't.
>>
>> Is anyone using either of these for attachments?
>>
>> Any opinions on one or the other? Something else?
>
> I'm using EDMessage in a project and it has been good to work with albeit 
> with a few quirks.
>
> 1. EDMessage and EDCommon both contain some deprecated methods. You can 
> either ignore these or do as I did and tidy them up. Essentially it was 
> replacing occurrences of 'stringWithContentsOfFile:' with 
> 'stringWithContentsOfFile:encoding:error:' and replacing 'stringWithCString:' 
> with 'stringWithCString:encoding:'. I also replaced an occurrence of 
> 'stringWithCString:length:' with 'stringWithCharacters:length:'.

IIRC I fixed that and some other things up as well. I've forked it
over on github

http://github.com/tcurdt/edmessage

Haven't checked if there are any new upstream changes for a while though.

cheers
--
Torsten
___

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: Access ObjC class from PyOBJC

2010-06-02 Thread jonat...@mugginsoft.com

On 2 Jun 2010, at 22:24, Bill Bumgarner wrote:

> 
> On Jun 2, 2010, at 2:16 PM, jonat...@mugginsoft.com wrote:
> 
>> My app is ObjC cocoa based 
>> 
>> It also loads and executes PyObjC classes.
>> 
>> I require my loaded PyObjC code to access an ObjC class (myControllerClass) 
>> defined within an ObjC framework linked to the main application.
>> 
>> The desired Python looks something like:
>> 
>> #py
>> import AppKit
>> 
>> taskController = myControllerClass.sharedController()
>> 
>> #py
>> 
>> Do I need to define a py wrapper from my framework and import it to 
>> accomplish this?
>> And if so, how is the wrapper constructed.
>> 
>> Or am I missing something simple here.
> 
> You don't need to define a wrapper or use bridge support metadata *unless* 
> your class's API has methods whose arguments and types can't be handled by 
> default (most can) *and* you need to call those from Python.
> 
> import Foundation
> klass = Foundation.NSClassFromString("MyControllerClass")
> 
> controller = klass.new()


Thanks.
I should have known that NSClassFromString() would come to the rescue.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com



___

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

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

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

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


Re: UIWebView Background

2010-06-02 Thread Matt James
As it looks like the only way to solve this problem is by using private APIs to 
turn off rubberbanding, I've flagged this as a bug in Radar - #8055256.

-Matt

On Jun 1, 2010, at 9:50 PM, Matt James wrote:

> I'm integrating a UIWebView directly into a design such that it should just 
> sort of sit on top and look to be a part of an underlying graphic.
> 
> After a bit of investigation, I finally got my UIWebView drawing without the 
> gray background.  Unfortunately, when I scroll around the view, it still 
> shows shadows behind it when it reaches the content boundaries.  Does anyone 
> have any idea how to get these shadows to disappear as well?
> 
> Thanks for any help!
> 
> -Matt

___

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: Monster memory leak and I can't figure out why

2010-06-02 Thread Ken Tozier

Thanks all for the replies

Re point #1: I was using Activity Monitor and both the "Real Memory"  
and "Virtual Memory" columns showed this 100+ MB leak every 5-10  
seconds. After a minute or so of running, My app had gobbled up almost  
2 gigs of memory.


Re point #2: All the thumbnail conversion code is contained within  
this one method, so once it enters the loop, it doesn't exit till it's  
done.


I tried using [[NSGarbageCollector defaultCollector]  
collectExhaustively], as Jonathan suggested, tried [image  
setCacheMode: NSImageCacheNever], but neither of those slowed the  
ferocious gobbling of memory.


I finally resorted to using CGxxx functions and the problem  
disappeared. My App now hums along generating 12 to 15 thumbnails per  
second with a memory footprint in the 20 to 30 MB range. Here's what  
worked:


- (NSString *) createJPEGThumbnail:(NSString *) inPath
site:(NSString *) inSite
{
NSDictionary*siteRecord,
*pubRecord;

NSString*sourceName = 
[inPath lastPathComponent],
*sourceRoot 
= [sourceName stringByDeletingPathExtension],
			*destName			= [[sourceRoot  
stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]  
stringByAppendingPathExtension: @"jpg"],

*pubCode
= [self pubCodeFromPath: inPath],
*thumbPath;

NSFileManager   *manager= 
[NSFileManager defaultManager];

siteRecord  = [thumbDirectories 
objectForKey: inSite];

	pubRecord= [[siteRecord objectForKey: @"publications"]  
objectForKey: pubCode];


if (pubRecord == nil)
		pubRecord			= [[siteRecord objectForKey: @"publications"]  
objectForKey: @"~MISCELLANEOUS"];


	thumbPath= [[pubRecord objectForKey: @"thumb_path"]  
stringByAppendingPathComponent: destName];


if (![manager fileExistsAtPath: thumbPath])
{
NSURL   *sourceURL  
= [NSURL fileURLWithPath: inPath],

*destURL= [NSURL fileURLWithPath: thumbPath];

NSString*imageType  
= UtilPreferredUTIForFile(inPath);
NSNumber*maxPixels  
= [NSNumber numberWithInt: maxDimension];
		NSDictionary*sourceOptions	= [NSDictionary  
dictionaryWithObjectsAndKeys:


imageType, 
kCGImageSourceTypeIdentifierHint,

kCFBooleanFalse, 
kCGImageSourceShouldCache,
			kCFBooleanTrue,  
kCGImageSourceCreateThumbnailFromImageAlways,


maxPixels, 
kCGImageSourceThumbnailMaxPixelSize,

nil];


		CGImageSourceRef			imageSourceCG	=  
CGImageSourceCreateWithURL((CFURLRef) sourceURL, (CFDictionaryRef)  
sourceOptions );

if (imageSourceCG != NULL)
{
			NSDictionary			*imageProps		= (NSDictionary *)  
CGImageSourceCopyPropertiesAtIndex(imageSourceCG, 0, NULL);

int w 
  = [[imageProps objectForKey: @"PixelWidth"] intValue],
h 
  = [[imageProps objectForKey: @"PixelHeight"] intValue];

NSRect  thumbRect   
= [self thumbRectWithSize: NSMakeSize(w, h)];

			NSDictionary		*destOptions			= [NSDictionary  
dictionaryWithObjectsAndKeys:
		[NSNumber numberWithInt: thumbRect.size.width],  
kCGImagePropertyPixelWidth,
		[NSNumber numberWithInt: thumbRect.size.height],  
kCGImagePropertyPixelHeight,


  

Re: Mail Frameworks

2010-06-02 Thread Dante Palacios

Hi Jeremy,

You might want to try the MailDelivery.framework, inspired on the  
deprecated methods from the Apple's Message.framework, the  
MailDelivery.framework makes the process of mail deliveries  
ridiculously easy to handle, you do not need to worry about for the  
Keychain and the top level of the framework does not even requires  
configuration. You can send plain text, HTML and rich text messages.



On Jun 2, 2010, at 1:57 PM, Jeremy Matthews wrote:

So...I'm working on an app that needs an email framework to send  
messages...right now I'm using MailCore, and I hear good things  
about EDMessage as well...where I am at now I need to send  
attachments and neither is very forthcoming on support details there  
(or examples) - so I am reading through headers and trying to figure  
what works and what doesn't.


Is anyone using either of these for attachments?

Any opinions on one or the other? Something else?

Thanks,
jeremy
___

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/palacios.dante%40gmail.com

This email sent to palacios.da...@gmail.com


All the best,
Dante.



___

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: Mail Frameworks

2010-06-02 Thread Dante Palacios

I forgot to mention, the MailDelivery.framework is free and open source

https://code.google.com/p/maildelivery/

On Jun 2, 2010, at 4:47 PM, Torsten Curdt wrote:


On Wed, Jun 2, 2010 at 22:12, Simon Wolf  wrote:

On 2 Jun 2010, at 19:57, Jeremy Matthews wrote:

So...I'm working on an app that needs an email framework to send  
messages...right now I'm using MailCore, and I hear good things  
about EDMessage as well...where I am at now I need to send  
attachments and neither is very forthcoming on support details  
there (or examples) - so I am reading through headers and trying  
to figure what works and what doesn't.


Is anyone using either of these for attachments?

Any opinions on one or the other? Something else?


I'm using EDMessage in a project and it has been good to work with  
albeit with a few quirks.


1. EDMessage and EDCommon both contain some deprecated methods. You  
can either ignore these or do as I did and tidy them up.  
Essentially it was replacing occurrences of  
'stringWithContentsOfFile:' with  
'stringWithContentsOfFile:encoding:error:' and replacing  
'stringWithCString:' with 'stringWithCString:encoding:'. I also  
replaced an occurrence of 'stringWithCString:length:' with  
'stringWithCharacters:length:'.


IIRC I fixed that and some other things up as well. I've forked it
over on github

http://github.com/tcurdt/edmessage

Haven't checked if there are any new upstream changes for a while  
though.


cheers
--
Torsten
___

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/palacios.dante%40gmail.com

This email sent to palacios.da...@gmail.com


All the best,
Dante.



___

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: Monster memory leak and I can't figure out why

2010-06-02 Thread Jeff Schilling
Are you running with NSZombieEnabled=YES?  many an hour has been spent tracking 
down 'memory leaks' - I have some firsthand experience with this :-)
On Jun 2, 2010, at 9:51 AM, Ken Tozier wrote:

> Thanks all for the replies
> 
> Re point #1: I was using Activity Monitor and both the "Real Memory" and 
> "Virtual Memory" columns showed this 100+ MB leak every 5-10 seconds. After a 
> minute or so of running, My app had gobbled up almost 2 gigs of memory.
> 
> Re point #2: All the thumbnail conversion code is contained within this one 
> method, so once it enters the loop, it doesn't exit till it's done.
> 
> I tried using [[NSGarbageCollector defaultCollector] collectExhaustively], as 
> Jonathan suggested, tried [image setCacheMode: NSImageCacheNever], but 
> neither of those slowed the ferocious gobbling of memory.
> 
> I finally resorted to using CGxxx functions and the problem disappeared. My 
> App now hums along generating 12 to 15 thumbnails per second with a memory 
> footprint in the 20 to 30 MB range. Here's what worked:
> 
> - (NSString *) createJPEGThumbnail:(NSString *) inPath
>   site:(NSString *) inSite
> {
>   NSDictionary*siteRecord,
>   *pubRecord;
>   
>   NSString*sourceName = 
> [inPath lastPathComponent],
>   *sourceRoot 
> = [sourceName stringByDeletingPathExtension],
>   *destName   
> = [[sourceRoot stringByAddingPercentEscapesUsingEncoding: 
> NSUTF8StringEncoding] stringByAppendingPathExtension: @"jpg"],
>   *pubCode
> = [self pubCodeFromPath: inPath],
>   *thumbPath;
> 
>   NSFileManager   *manager= 
> [NSFileManager defaultManager];
>   
>   siteRecord  = [thumbDirectories 
> objectForKey: inSite];
>   
>   pubRecord   = [[siteRecord objectForKey: 
> @"publications"] objectForKey: pubCode];
>   
>   if (pubRecord == nil)
>   pubRecord   = [[siteRecord objectForKey: 
> @"publications"] objectForKey: @"~MISCELLANEOUS"];
>   
>   thumbPath   = [[pubRecord objectForKey: 
> @"thumb_path"] stringByAppendingPathComponent: destName];
>   
>   if (![manager fileExistsAtPath: thumbPath])
>   {
>   NSURL   *sourceURL  
> = [NSURL fileURLWithPath: inPath],
>   
> *destURL= [NSURL fileURLWithPath: thumbPath];
>   
>   NSString*imageType  
> = UtilPreferredUTIForFile(inPath);
>   NSNumber*maxPixels  
> = [NSNumber numberWithInt: maxDimension];
>   NSDictionary*sourceOptions  = 
> [NSDictionary dictionaryWithObjectsAndKeys:
>   
> imageType, 
> kCGImageSourceTypeIdentifierHint,
>   
> kCFBooleanFalse, 
> kCGImageSourceShouldCache,
>   
> kCFBooleanTrue, 
> kCGImageSourceCreateThumbnailFromImageAlways,
>   
> maxPixels, 
> kCGImageSourceThumbnailMaxPixelSize,
>   
> nil];
>   
> 
>   CGImageSourceRefimageSourceCG   = 
> CGImageSourceCreateWithURL((CFURLRef) sourceURL, (CFDictionaryRef) 
> sourceOptions );
>   if (imageSourceCG != NULL)
>   {
>   NSDictionary*imageProps 
> = (NSDictionary *) CGImageSourceCopyPropertiesAtIndex(imageSourceCG, 0, NULL);
>   int w   
> = [[imageProps objectForKey: @"PixelWidth"] intValue],
>

Re: How to change color of text in webView

2010-06-02 Thread Shripada Hebbar
You can do all that stuff such as fonts, color in html/css that you feed to
web view. 

Regards
Shripada


On 03/06/10 8:43 AM, "cocoa-dev-requ...@lists.apple.com"
 wrote:

> Date: Wed, 02 Jun 2010 22:39:15 +0300
> From: Nava Carmon 
> Subject: How to change color of text in webView
> To: list-cocoa-dev Developers 
> Message-ID: <3d14359e-cb37-46f8-8392-c4815859e...@mac.com>
> Content-Type: text/plain; charset=us-ascii
> 
> Hi,
> 
> Is it possible to change the font color in web view? How do I do it?
> 
> Thanks,
> 
> Nava Carmon
> ncar...@mac.com
> 
> "Think good and it will be good!"


---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
___

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