Re: Linearly Scaling Text

2011-05-30 Thread Ajay Sabhaney
> I hope that there are no issues scaling an NSTextView that is layer-backed > (either using NSView's scaleUnitSquareToSize method, or the bounds > manipulation approach that TextEdit uses). Unfortunately, there seems to be issues with scaling an NSTextView in a layer-backed hierarchy as well -

Intercepting click on send in Mail.app

2011-05-30 Thread Nava Carmon
Hi, Is it possible to intercept click on Send in Mac OS X Mail application? 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

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On Sun, 29 May 2011 18:15:10 -0400 > > From: Jeffrey Walton wrote > As Kyle said, its the C language - signed values are > promoted/converted (?) to unsigned. So -1 is always greater than 1 (if > you let it happen). Its really the generated CMP instruction which is > bitting you. Cast the unsign

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread jonat...@mugginsoft.com
On 30 May 2011, at 12:03, julius wrote: > > > So was it really just because the number of array elements is never -3 that > the Cocoa developers decided to make NSArray count return type NSUInteger? > > Julius > You always need to pay close close attention to function/method return types,

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Roland King
> In what contexts is that output going to be used? > I think that like me people will tend to use it in contexts to do with > accessing array elements > e.g. x = [ary objectAtIndex:[ary count]-2]; well if you haven't already confirmed that [ary count ] can never be less than 2, or checked tha

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Graham Cox
On 30/05/2011, at 9:03 PM, julius wrote: > Why did Cocoa developers make the count method return NSUInteger? Because you can't have negative numbers of elements in an array. It's that simple. The reason you're running into trouble is not because this type is unsigned, it's because you are do

An architectural question for iOS app

2011-05-30 Thread Brian Bruinewoud
Hi all, I'm about to start writing an app (Target is iPad running 4.3 or later) but I've gotten to a position where I'm not sure of the best way to proceed with the architecture. I thought I'd better ask now before I paint myself into a corner. The parts of the app with which I am having troub

Referencing struct fields in C

2011-05-30 Thread Oleg Krupnov
This question is related to C language, rather than Obj-C. I have a data structure typedef struct { int x; int y; } A; In my code, I have a function foo(bool xOrY) that runs a long-lasting loop that iterates through a huge array of A structures and for each structure, it should get x or y

Re: An architectural question for iOS app

2011-05-30 Thread Brian Bruinewoud
One Issue I'm having that I forgot to mention is that when I zoom in, the gesture recogniser on the objects ceases to recognise my attempts to drag and the scrollview drags instead - I have to zoom back out to near to 1:1 before I cant start dragging the objects again. On 30/05/2011, at 21:55 ,

Re: Referencing struct fields in C

2011-05-30 Thread Oleg Krupnov
oops, small correction, in the second code sample it should read: if (xOrY) { offset = (char*)&(test.y) - (char*)&test; } else { offset = (char*)&(test.x) - (char*)&test; } On Mon, May 30, 2011 at 3:02 PM, Oleg Krupnov wrote: > This question is related to C language, rather

Re: Referencing struct fields in C

2011-05-30 Thread Graham Cox
On 30/05/2011, at 10:10 PM, Oleg Krupnov wrote: >> I am looking to optimize this code Have you measured it and shown it to be a bottleneck, or are you just assuming it will benefit? --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: Referencing struct fields in C

2011-05-30 Thread Oleg Krupnov
And no, I cannot move the for loop inside the if, because the (omitted) code inside the for loop is huge, and I would hate to duplicate it in the both if clauses... Thanks Dmitry! On Mon, May 30, 2011 at 3:12 PM, Dmitry Muraviev wrote: > А почему вы не хотите перенести цикл внутрь условия? > >

Re: Referencing struct fields in C

2011-05-30 Thread Oleg Krupnov
I knew this question was coming! :) Well, maybe you are right. The problem is that the function foo() involves much stuff, including disk I/O operations, so measuring its performance is quite tricky, you get different result on each test, depending on the available memory, disk busyness etc. It's h

Re: Referencing struct fields in C

2011-05-30 Thread Graham Cox
On 30/05/2011, at 10:26 PM, Oleg Krupnov wrote: > I knew this question was coming! :) Well, maybe you are right. The > problem is that the function foo() involves much stuff, including disk > I/O operations, so measuring its performance is quite tricky, you get > different result on each test, de

How to call delegate methods using YouTube embed technique?

2011-05-30 Thread Guillermo Moral
What is the best way to call delegate methods using YouTube embed technique ? You can see two example on how to work with Youtube embed technique in these links : http://iphonedevelopertips.com/video/display-youtube-videos-without-exiting-your-application.html http://iphoneincubator.com/blog/win

Re: Referencing struct fields in C

2011-05-30 Thread Oleg Krupnov
> In any case, the optimizer will probably move all of the loop-invariant state > outside the loop for you, and it's likely to do a better job than your > home-grown attempt. That's a great news! If it is really so, I stand corrected and not trying to optimize it any further. In fact, in the me

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Roland King
.. going back on list .. On 30-May-2011, at 9:18 PM, julius wrote: > > On 30 May 2011, at 12:28, Roland King wrote: > >> >> >>> In what contexts is that output going to be used? >>> I think that like me people will tend to use it in contexts to do with >>> accessing array elements >>> e.g.

How to intercepting click on send in Mail.app

2011-05-30 Thread Nava Carmon
Hi, Is it possible to intercept click on Send in Mac OS X Mail application? I'm writing a client that on click on Send in Mail client should perform certain action Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post ad

Re: Cocoa-dev Digest, Vol 8, Issue 383

2011-05-30 Thread julius
On Mon, 30 May 2011 Roland King wrote > > >> In what contexts is that output going to be used? >> I think that like me people will tend to use it in contexts to do with >> accessing array elements >> e.g. x = [ary objectAtIndex:[ary count]-2]; > > well if you haven't already confirmed that [ar

Re: How to intercepting click on send in Mail.app

2011-05-30 Thread Joanna Carter
Le 30 mai 2011 à 15:02, Nava Carmon a écrit : > Is it possible to intercept click on Send in Mac OS X Mail application? > I'm writing a client that on click on Send in Mail client should perform > certain action Why not just get Mail Act-on from Indev http://www.indev.ca/MailActOn.html; it migh

Re: Cocoa-dev Digest, Vol 8, Issue 383

2011-05-30 Thread julius
On 30 May 2011, Graham Cox wrote > > On 30/05/2011, at 9:03 PM, julius wrote: > >> Why did Cocoa developers make the count method return NSUInteger? > > > Because you can't have negative numbers of elements in an array. > > It's that simple. Yes but is that the only reason for doing this? >

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On 30 May 2011, Graham Cox wrote > > On 30/05/2011, at 9:03 PM, julius wrote: > >> Why did Cocoa developers make the count method return NSUInteger? > > > Because you can't have negative numbers of elements in an array. > > It's that simple. Yes but is that the only reason for doing this? >

Re: How to intercepting click on send in Mail.app

2011-05-30 Thread Nava Carmon
Actually the client is supposed to get a text from the mail message when the user clicks send. This client is not a mail client and not is supposed to send mail. Is there some programmatic solution? Thanks On May 30, 2011, at 5:12 PM, Joanna Carter wrote: > Le 30 mai 2011 à 15:02, Nava Carmon

Re: Cocoa-dev Digest, Vol 8, Issue 383

2011-05-30 Thread Graham Cox
On 31/05/2011, at 12:03 AM, julius wrote: > has the potential to create problems if it skips one's mind Well, so does almost anything in life. Coding's no different. > Of course I find decision to have NSArray count return NSUInteger somewhat > curious precisely because it seems to me liable t

Re: Referencing struct fields in C

2011-05-30 Thread Graham Cox
On 30/05/2011, at 11:30 PM, Oleg Krupnov wrote: > In fact, in the meantime I created a quick and dirty prototype to > measure this operation isolated, and it seems that out of 3 options > (plain if, function pointer, and pointer arithmetics) the plain if is > the winner, surprisingly :) Not that

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Scott Ribe
On May 30, 2011, at 7:31 AM, Roland King wrote: > No. I am saying that semantically the 'size' of an array is a non-negative > integer and thus the correct way to represent it is with a data type which > represents non-negative integers. While that is certainly correct, the counter argument is

Problem using data in a distributed object

2011-05-30 Thread Ken Tozier
HI I wrote two apps that communicate through distributed objects and found this weird "feature" where if a string is distributed by one app, the receiving app can't use it to create other strings. For example str1 is vended from app A App B wants to take that string and append some text to the

Re: Referencing struct fields in C

2011-05-30 Thread Cem Karan
> From: Oleg Krupnov > Date: May 30, 2011 9:30:22 AM EDT > To: Graham Cox > Cc: Cocoa-Dev List > Subject: Re: Referencing struct fields in C <> > One thing that bothers me though. How the compiler will understand > that the state is loop-invariant? Should I necessarily declare the > checked bo

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On 30 May 2011, at 16:02, Graham Cox wrote: > > On 31/05/2011, at 12:03 AM, julius wrote: > >> has the potential to create problems if it skips one's mind > > Well, so does almost anything in life. Coding's no different. > >> Of course I find decision to have NSArray count return NSUInteger s

Aquatic Prime

2011-05-30 Thread John MacMullin
See the updated Aquatic Prime at: https://github.com/bdrister/AquaticPrime Best regards, John MacMullin Email:john.macmul...@cox.net Skype: john_macmullin www.macmullin.info ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post adm

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Roland King
On 30-May-2011, at 11:05 PM, julius wrote: > > On 30 May 2011, at 15:52, Roland King wrote >> >> On 30-May-2011, at 9:18 PM, julius wrote: >> >>> They used the datatype which maps onto the thing they are describing, array elements are non-negative integers, so they used NSUIntege

How to extract files from zip archive?

2011-05-30 Thread Vyacheslav Karamov
Hi All! I need to extract zip-archive content to ~/Library/Application Support/My Program/Shared at the first launch. What the best way to do it? I tried to NSString * listsPath = STR_ADDPATH([[NSBundle mainBundle] resourcePath], @"lists.zip"); if (0 == folderSize && FileTools::DoesFi

Re: How to intercepting click on send in Mail.app

2011-05-30 Thread Joanna Carter
Le 30 mai 2011 à 15:51, Nava Carmon a écrit : > Actually the client is supposed to get a text from the mail message when the > user clicks send. This client is not a mail client and not is supposed to > send mail. > Is there some programmatic solution? Mail Act-On can call Apple Script, which c

Re: How to extract files from zip archive?

2011-05-30 Thread Lee Ann Rucker
>NSArray * args = [NSArray arrayWithObjects:@"-a ", listsPath, @" -d ", sharedPath, nil]; Why do you have spaces in your args? It's not going to concatenate them into a single command line string, it's going to pass them in as the separate args to the app's "main". - Original Message -

Re: Linearly Scaling Text

2011-05-30 Thread Lee Ann Rucker
My view isn't even zoomable, but if the text in the textview doesn't completely fit in the box, when I go to edit it goes from a perfectly legible "long string with ..." to a very fuzzy "long string with truncation". I'm half-tempted to just make it non-editable. - Original Message - Fr

Re: Problem using data in a distributed object

2011-05-30 Thread Ken Thomases
On May 30, 2011, at 10:20 AM, Ken Tozier wrote: > I wrote two apps that communicate through distributed objects and found this > weird "feature" where if a string is distributed by one app, the receiving > app can't use it to create other strings. For example > > str1 is vended from app A > App

Re: Problem using data in a distributed object

2011-05-30 Thread Ken Thomases
On May 30, 2011, at 12:08 PM, kentoz...@comcast.net wrote: > Thanks Ken You're welcome. > How do I specify "by copy" when sending? > > For example, say object A sends data to B like so: > > [objectB performSelector: @selector(handleRequest:) withObject: vendedObject]; I'm not sure what you'r

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Quincey Morris
On May 30, 2011, at 08:27, julius wrote: > All I had hoped was that someone on this list might illuminate the issue more > than has happened so far. The problem isn't really lack of illumination, but that you're not prepared to accept the consequences of the explanation. Here's my version of t

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Bruce Turner
A couple of other issues about the use of NSUInteger throughout the Foundation Framework. Core Foundation functions tend to use CFIndex and CFRange, both signed. This is true for CFArray and other collections. If you mix Foundation and Core Foundation you have to deal with this. Many C fu

Re: Referencing struct fields in C

2011-05-30 Thread Robert Martin
What cured me of optimization-itis was this entry in ridiculousfish's ridiculously cool blog: http://ridiculousfish.com/blog/archives/2010/07/23/will-it-optimize/#fish_made_a_mess --Rob >> One thing that bothers me though. How the compiler will understand >> that the state is loop-invariant? S

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Gary L. Wade
On 31/05/2011, at 12:03 AM, julius wrote: > has the potential to create problems if it skips one's mind On 05/30/2011 8:40 AM, "Roland King" wrote: > Whist seeing your side... You know, we could really take this to the extreme and I could get upset that Roland started talking about a card gam

Re: Re: Linearly Scaling Text

2011-05-30 Thread Gordon Apple
When I implemented a scalable teleprompter screen in MacOS, I did it by rendering the text in a narrow view that was scaled down by the scale factor, then scaled the view up to fill the containing view. With a little work, it was fully editable. I was not using CALayers at the time. When I tried t

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On 30 May 2011, at 16:40, Roland King wrote: > > On 30-May-2011, at 11:05 PM, julius wrote: > >> >> On 30 May 2011, at 15:52, Roland King wrote >>> >>> On 30-May-2011, at 9:18 PM, julius wrote: >>> > They used the datatype which maps onto the thing they are describing, > arr

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On 30 May 2011, at 20:03,Quincey Morris wrote > > On May 30, 2011, at 08:27, julius wrote: > >> All I had hoped was that someone on this list might illuminate the issue >> more than has happened so far. > > The problem isn't really lack of illumination, but that you're not prepared > to accep

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Dave Zarzycki
On May 30, 2011, at 1:45 PM, julius wrote: > > On 30 May 2011, at 20:03,Quincey Morris wrote >> >> On May 30, 2011, at 08:27, julius wrote: >> >>> All I had hoped was that someone on this list might illuminate the issue >>> more than has happened so far. >> >> The problem isn't really lack of

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Sean McBride
On Mon, 30 May 2011 13:56:38 -0700, Dave Zarzycki said: >As others have pointed out, this has nothing to do with Objective-C or >Cocoa. This behavior is true of any C derived language or library. If >this aspect of C bothers you, then please consider adding -Wconversion >to your project's build se

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On 30 May 2011, at 21:56, Dave Zarzycki wrote: > On May 30, 2011, at 1:45 PM, julius wrote: > >> >> On 30 May 2011, at 20:03,Quincey Morris wrote >>> >>> On May 30, 2011, at 08:27, julius wrote: >>> All I had hoped was that someone on this list might illuminate the issue more than

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Quincey Morris
On May 30, 2011, at 13:45, julius wrote: > Hilarity and riot. Glad to have been of service. > Here is a nice instance that I think quite germane. > > The input parameter to NSArray's objectAtIndex: is an NSUInteger. > Both these code snippets work perfectly (they retrieve element 3). > zS

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread mlist0...@gmail.com
Maybe this will assuage your outrage (excuse the lame programmer poetry): If you were to look at the apis for NSArray and see that indices are signed integers, you could reasonably conclude that storing/retrieving an object from a negative index is a legitimate thing to do. That would maybe be

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread julius
On 30 May 2011, at 22:34, Quincey Morris wrote: > On May 30, 2011, at 13:45, julius wrote: > >> Hilarity and riot. > > Glad to have been of service. > >> Here is a nice instance that I think quite germane. >> >> The input parameter to NSArray's objectAtIndex: is an NSUInteger. >> Both these c

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Quincey Morris
On May 30, 2011, at 15:14, julius wrote: > I'm definitely off to the north coast. I *wish* people would stop using that old "saving the distressed sheep" line to put an end to a thread. It's happening far too often these days. ___ Cocoa-dev mailing

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Greg Guerin
julius wrote: My question is Why did Cocoa developers make NSArray count return NSUInteger? It's impossible to answer with certainty. The person or persons who made that decision are not on this list (AFAIK). Nor have they documented the rationale behind their design decisions for poste

Re: Linearly Scaling Text

2011-05-30 Thread Ajay Sabhaney
> Because it was mono-Font text, I resorted to scaling the font > instead. Actually I did try scaling the font instead of the text view, but I'm unable to get the text to scale linearly as our application should be able to handle most fonts. > I never went back to view scaling, but I wonder > i

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Graham Cox
On 31/05/2011, at 8:57 AM, Greg Guerin wrote: > julius wrote: > >> My question is >> Why did Cocoa developers make NSArray count return NSUInteger? > > In a practical sense, none of this matters. The decision was made long, long > ago. It is what it is. You're too late to save that sheep fr

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread koko
Nothing but mental masturbation ... give it a rest ... moderator, do your job, please. -koko On May 30, 2011, at 4:43 PM, Quincey Morris wrote: > On May 30, 2011, at 15:14, julius wrote: > >> I'm definitely off to the north coast. > > I *wish* people would stop using that old "saving the dis

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Lee Ann Rucker
>Unfortunately, somebody decided a long time ago, the same can't be done for >integers, because there's no infinite-range numerical space available to >machine computation (in any way that mainstream hardware supports directly), >and no single finite-range space that (as in the floating point ca

Re: Linearly Scaling Text

2011-05-30 Thread Gordon Apple
Actually, I wasn¹t talking about tiled layers, although that might also be relevant. I was talking about tiled views. There is some sample code available for tiled views, but it took some massaging to get it to do what I wanted. I only tiled my view vertically and used half of a screen height fo

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Graham Cox
On 31/05/2011, at 11:06 AM, koko wrote: > Nothing but mental masturbation ... give it a rest ... moderator, do your > job, please. Get out of bed the wrong side today? Quincey is one of the most helpful contributors on the list; you might remember that next time you want help. There's always

Autoreleased Data In Cocoa

2011-05-30 Thread Bing Li
Dear all, I have a question about autoreleased data in Cocoa. According to the documentation from Apple.com, developers need to design autorelease pools when programming command-line, loop and threading. If in Cocoa without threading, no autorelease pools are programmed explicitly since an autorel

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Ross Carter
On May 30, 2011, at 9:38 PM, Graham Cox wrote: > On 31/05/2011, at 11:06 AM, koko wrote: > >> Nothing but mental masturbation ... give it a rest ... moderator, do your >> job, please. > > > Get out of bed the wrong side today? > > Quincey is one of the most helpful contributors on the list; y

Re: How to extract files from zip archive?

2011-05-30 Thread Chris Hanson
On May 30, 2011, at 8:45 AM, Vyacheslav Karamov wrote: > NSString * listsPath = STR_ADDPATH([[NSBundle mainBundle] resourcePath], > @"lists.zip"); What is STR_ADDPATH? There's already Cocoa API for what it looks like it does: NSString *listsPath = [[NSBundle mainBundle] pathForResource:@"list

Re: Why does NSArray count return NSUInteger?

2011-05-30 Thread Andy Lee
On May 30, 2011, at 6:57 PM, Greg Guerin wrote: > julius wrote: > >> My question is >> Why did Cocoa developers make NSArray count return NSUInteger? > > > It's impossible to answer with certainty. The person or persons who made > that decision are not on this list (AFAIK). Nor have they docu

Re: How to extract files from zip archive?

2011-05-30 Thread Jim Thomason
On Mon, May 30, 2011 at 10:45 AM, Vyacheslav Karamov wrote: > Hi All! > ... >   [task setLaunchPath:@"/usr/bin/unzip"]; >   NSArray * args = [NSArray arrayWithObjects:@"-a ", listsPath, @" -d ", > sharedPath, nil]; In addition to what others have said regarding spaces and such, when I was looking

Re: Autoreleased Data In Cocoa

2011-05-30 Thread Nick Zitzmann
On May 30, 2011, at 8:15 PM, Bing Li wrote: > - (NSString *) receiveMessage > { >NSMutableString *receivedString; >NSString *message; >NSString *newReceivedString; >[isConnectedLock lock]; >@try >{ >if (isConnected) >

Handling mouse events on transparent window conditionally

2011-05-30 Thread Deepa
Hi, I am developing an Desktop application in which I should be able to take mouse events on transparent window. But, transparent NSWindow does not take mouse events. So, I have set setIgnoreMouseEvents to NO which allows the transparent window to take mouse events. I have the problem in th