Storing UTF8 Umlauts in Postgres using PGSQLKit

2012-03-22 Thread Alexander Reichstadt
Hi,


for a couple of reasons we migrated our project from mysql to postgres using 
PGSQLKit.

But we are experiencing problems storing UTF8 data. So far we checked the 
database to be able to store UTF8. When using pgPHPAdmin to store values with 
German Umlaute it works. When using PGSQLKit chars get garbled.

The following code stores the values:


const char *cString = [sql cStringUsingEncoding:NSUTF8StringEncoding];
if (cString == NULL) 
{ 
self.errorDescription = [NSString stringWithFormat:@"ERROR: 
execCommand could not be losslessly converted to c string: %@", sql];
[self appendSQLLog:[NSString stringWithFormat:@"%@\n", 
self.errorDescription]];
return NO;
}
res = PQexec(pgconn, cString);

Both sides seem correct, server as well as client, so I am not sure what the 
issue might be.

Any ideas?

Thanks
Alex
___

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

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

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

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


Re: asynchronous nsurlconnection in nsoperation

2012-03-22 Thread Ariel Feinerman
Is this for iOS or Mac OS?

This for iOS


   // dispatch_async(kBgQueue, ^{ NSData* data = [NSData
dataWithContentsOfURL: myUrl]; // THIS IS WHAT YOU WANT Ariel **
The date is very large their amount is 400 Mb so the asynchronous is
necessarily
one cannot be in memory at once

On Wed, Mar 21, 2012 at 10:36 PM, Sebastian Celis
wrote:

> On Wed, Mar 21, 2012 at 10:59 AM, Ariel Feinerman 
> wrote:
> > I wish to insert an asynchronous NSURLConnection into non-concurrent
> > NSOperation
>
> Hi Ariel,
>
> MBRequest does this. It is done by forcing the operation's runloop to
> continue running while the network connection is in progress. I would
> recommend looking though the source code. Specifically, take a look at
> MBURLConnectionOperation.
>
> https://github.com/mobiata/MBRequest
>
> https://github.com/mobiata/MBRequest/blob/master/Classes/MBURLConnectionOperation.m
>
> - Sebastian
>



-- 
best regards
Ariel
___

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

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

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

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


[Solved] Re: Storing UTF8 Umlauts in Postgres using PGSQLKit

2012-03-22 Thread Alexander Reichstadt
The issue was in PGSQLKit.

-(NSString *)sqlEncodeString:(NSString *)toEncode
{

//size_t result;
int error;
char *sqlEncodeCharArray = malloc(1 + ([toEncode length] * 2)); // per 
the libpq doc.
const char *sqlCharArrayToEncode = [toEncode 
cStringUsingEncoding:defaultEncoding];
size_t length = strlen(sqlCharArrayToEncode);

PQescapeStringConn ((PGconn *)pgconn, sqlEncodeCharArray,
(const char *)[toEncode 
cStringUsingEncoding:defaultEncoding], 
length, &error);

//This is bad
//  NSString *encodedString = [[[NSString alloc] 
initWithFormat:@"%s",sqlEncodeCharArray] //autorelease];
//Instead use
NSString *encodedString = [NSString 
stringWithCString:sqlEncodeCharArray encoding:defaultEncoding]; 

free(sqlEncodeCharArray);

return encodedString;   

}




Am 22.03.2012 um 09:09 schrieb Alexander Reichstadt:

> Hi,
> 
> 
> for a couple of reasons we migrated our project from mysql to postgres using 
> PGSQLKit.
> 
> But we are experiencing problems storing UTF8 data. So far we checked the 
> database to be able to store UTF8. When using pgPHPAdmin to store values with 
> German Umlaute it works. When using PGSQLKit chars get garbled.
> 
> The following code stores the values:
> 
> 
> const char *cString = [sql cStringUsingEncoding:NSUTF8StringEncoding];
>   if (cString == NULL) 
>   { 
>   self.errorDescription = [NSString stringWithFormat:@"ERROR: 
> execCommand could not be losslessly converted to c string: %@", sql];
>[self appendSQLLog:[NSString stringWithFormat:@"%@\n", 
> self.errorDescription]];
>return NO;
>}
>   res = PQexec(pgconn, cString);
> 
> Both sides seem correct, server as well as client, so I am not sure what the 
> issue might be.
> 
> Any ideas?
> 
> Thanks
> Alex
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/lxr%40mac.com
> 
> This email sent to l...@mac.com

___

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

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

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

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


CALayer composition changes with frame position

2012-03-22 Thread Markus Spoettl

Hello all,

  I have a super-strange issue that I have debugged for hours without 
any progress. I'm at a complete loss to explain what is going on and 
would appreciate ideas on getting to the bottom of this.


I have a custom layer-hosting view with a delegate-drawn hierarchy, 
there are no filters involved. The hierarchy is like this:


rootLayer
  |-- moveableLayer
|-- stationaryLayer

I can click-drag "movableLayer" around using the mouse. moveableLayer's 
opacity is 0.5, stationaryLayer's is 1.0.


My problem is that stationaryLayer is composited differently, sometimes 
opaque, sometimes semi-transparent and I cannot explain why. It's 
completely reproducible and happens 100% of the time, even after rebooting.


During the mouse-drag, I'm only changing moveableLayer's position 
property, wrapped in a CATransaction with +setDisableActions:YES). The 
opacity properties of neither layer are changed after creating them.


To make sure no code accidentally changes opacity, I've added an 
observer to the opacity property of all layers involved, so I'm sure. 
I've also checked the observation works.


Here's a short video that illustrates the issue:

http://www.shiftoption.com/temp/magic-layer-transparency.mov

rootLayer drawn gray with a red rectangle in the middle, moveableLayer 
consists of the transparent white rectangle and a green-to-blue 
gradient. stationaryLayer is drawn with a yellow-to-red gradient. As you 
can see, at a certain point during the drag stationary switches from 
being composited transparently to completely opaque (relative to 
moveableLayer).


All colors used have an alpha of 1.0. Also, the layers are never 
re-drawn during the drag, so it's not a painting issue.


The problem goes away when setting moveableLayer's opacity to 1.0. Then 
stationaryLayer is composited the same, independent of moveableLayer's 
position.


I'm on Lion 10.7.3 using the 10.7 SDK with Xcode 4.3.1.

Any ideas greatly appreciated!

Thanks
Markus
--
__
Markus Spoettl
___

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

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

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

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


Re: asynchronous nsurlconnection in nsoperation

2012-03-22 Thread Andreas Grosam

On Mar 21, 2012, at 4:59 PM, Ariel Feinerman wrote:

> Hi,

> I wish to insert an asynchronous NSURLConnection into non-concurrent
> NSOperation
> the reason is to allow necessarily unarchive actions on the streaming date

> Is this for iOS or Mac OS?
> This for iOS
> 
> The date is very large their amount is 400 Mb so the asynchronous is
> necessarily
> one cannot be in memory at once
> 
> - (void) connection: (NSURLConnection *) connection didReceiveData:
> (NSData*) data {
> // Append the new data to receivedData.
> [_receivedData appendData: data];
> if ([_receivedData length] >= MAX_CHUNK) {
> // unarchive
> // write to file
> // [receivedData setLength: 0];
> }
> 
> }
> 
> Is there a correct way to do ?

Yes. 

And your described approach works fine - if your connection delegates run on a 
secondary thread. Not sure, if you are actually required to use NSOperation, 
but basically, when you start your connection on a secondary thread (in order 
to keep the main thread responsive), it should work fine. (See the code below, 
how one can accomplish to start a connection on a secondary thread.)

Though, your approach is not optimal and it also **requires** that you can 
actually process (unarchive) **partial** data. 


If you cannot process partial data, you have to search for a more elaborated 
solution to this problem:

There are several approaches, from simple to more complex. And, there are 
approaches which look promising but won't work!

What you need to use in any case is an **asynchronous** (NSURL)connection. 
Don't use a synchronously scheduled NSURLConnection with that amount of data! 

1) The simplest one that works is to immediately write the received data to a 
temporary file (appending partial data to a file works fine). Then when 
finished downloading, process the temporary file, possibly leveraging mmap, 
NSStream, GCD or NSOperation. For this approach, you don't need anything 
special in the NSURLConnection. Starting it from the main thread is sufficient. 
Writing to the temp file is usually fast enough to keep the main thread 
responsive.
When you are processing the data, you can schedule the task on a secondary 
thread.

This approach is simple to implement, but is suboptimal performance wise - 
especially on devices with more than one CPU.


2) An approach that combines high performance with low memory foot-print is one 
that is a bit more elaborated. This would also require to schedule the 
connection on a secondary thread. (example on request)


3) A few approaches that WONT work and will likely eventually crash are the 
following:

3.a)
- (void) connection:(NSURLConnection*)connection didReceiveData:(NSData*) data 
{
dispatch_async(queue, ^{processData:data;}];
}
where processData: is supposed to be able to handle partial data.
This will likely crash due to memory running out: If downloading is fast, and 
processing is slow, GCD queues a lot of buffers - until memory runs out.

3.b)
- (void) connection:(NSURLConnection*)connection didReceiveData:(NSData*) data 
{
[_receivedData appendData: data];
}
And when finished, processing _receivedData.
This will crash due to memory running out.





Regards

Andreas



==

You can start a connection in a secondary thread, as follows:

Anywhere, for instance a ViewController handling the "Start" Button:

// start the NSURLConnection in a secondary thread:
[NSThread 
detachNewThreadSelector:@selector(startConnectionInSecondaryThread) 
 toTarget:self withObject:nil]; 


And -startConnectionInSecondaryThread is implemented:

static NSString* kDownloadConnectionRunLoopMode = 
@"MyViewControllerDownloadConnectionRunMode";

- (void) startConnectionInSecondaryThread
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[self startConnection];
runLoopDone_ = NO;
// Enable the run loop:
// first, add a dummy source in order to prevent the Run loop from exiting
// immediately when the connection closes :
[[NSRunLoop currentRunLoop] addPort:[NSMachPort port] 
forMode:kDownloadConnectionRunLoopMode];
do {
BOOL processedSource = [[NSRunLoop currentRunLoop] 
runMode:kDownloadConnectionRunLoopMode beforeDate:[NSDate distantFuture]];
} while (!runLoopDone_);

[pool release];
}


And finally, -startConnection, which is shown in more detail, to show some 
things you need to care about:

- (void) startConnection
{
// Note: startConnection can be performed on secondary threads, thus we need
// to schedule UIKit methods onto the main thread.

NSString* urlString = @"http://exmample.com";;
NSURL* url = [NSURL URLWithString:urlString];
 
// Possibly configure/clear URL cache

NSTimeInterval request_timeout = 60.0;
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url 
cachePolicy:0 timeoutInterval:request_timeout];

[request setValue:@"gzip

Re: [Solved] Re: Storing UTF8 Umlauts in Postgres using PGSQLKit

2012-03-22 Thread Andy 'Dru' Satori
Sorry I didn't see this, I was KO'd by the pollen and seasonal allergies.   Yes 
this is an issue with PGSQLkit, I have confirmed it and will be committing a 
change today based upon yours to address this.  Thanks for patch! 

-- 
Andy 'Dru' Satori


On Thursday, March 22, 2012 at 6:55 AM, Alexander Reichstadt wrote:

> The issue was in PGSQLKit.
> 
> -(NSString *)sqlEncodeString:(NSString *)toEncode
> {
> 
> //size_t result;
> int error;
> char *sqlEncodeCharArray = malloc(1 + ([toEncode length] * 2)); // per the 
> libpq doc.
> const char *sqlCharArrayToEncode = [toEncode 
> cStringUsingEncoding:defaultEncoding];
> size_t length = strlen(sqlCharArrayToEncode);
> 
> PQescapeStringConn ((PGconn *)pgconn, sqlEncodeCharArray,
> (const char *)[toEncode cStringUsingEncoding:defaultEncoding], 
> length, &error);
> 
> //This is bad
> // NSString *encodedString = [[[NSString alloc] 
> initWithFormat:@"%s",sqlEncodeCharArray] //autorelease];
> //Instead use
> NSString *encodedString = [NSString stringWithCString:sqlEncodeCharArray 
> encoding:defaultEncoding]; 
> 
> free(sqlEncodeCharArray);
> 
> return encodedString; 
> 
> }
> 
> 
> 
> 
> Am 22.03.2012 um 09:09 schrieb Alexander Reichstadt:
> 
> > Hi,
> > 
> > 
> > for a couple of reasons we migrated our project from mysql to postgres 
> > using PGSQLKit.
> > 
> > But we are experiencing problems storing UTF8 data. So far we checked the 
> > database to be able to store UTF8. When using pgPHPAdmin to store values 
> > with German Umlaute it works. When using PGSQLKit chars get garbled.
> > 
> > The following code stores the values:
> > 
> > 
> > const char *cString = [sql cStringUsingEncoding:NSUTF8StringEncoding];
> > if (cString == NULL) 
> > { 
> > self.errorDescription = [NSString stringWithFormat:@"ERROR: execCommand 
> > could not be losslessly converted to c string: %@", sql];
> > [self appendSQLLog:[NSString stringWithFormat:@"%@\n", 
> > self.errorDescription]];
> > return NO;
> > } 
> > res = PQexec(pgconn, cString);
> > 
> > Both sides seem correct, server as well as client, so I am not sure what 
> > the issue might be.
> > 
> > Any ideas?
> > 
> > Thanks
> > Alex
> > ___
> > 
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> > (mailto:Cocoa-dev@lists.apple.com))
> > 
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> > (http://lists.apple.com)
> > 
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/lxr%40mac.com
> > 
> > This email sent to l...@mac.com (mailto:l...@mac.com)
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> (mailto:Cocoa-dev@lists.apple.com))
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> (http://lists.apple.com)
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/dru%40druware.com
> 
> This email sent to d...@druware.com (mailto:d...@druware.com) 

___

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

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

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

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


Re: [Solved] Re: Storing UTF8 Umlauts in Postgres using PGSQLKit

2012-03-22 Thread Alexander Reichstadt
Hi, sorry to hear that, but great to meet you here!! Let's catch up off list.

Alex




Am 22.03.2012 um 14:20 schrieb Andy 'Dru' Satori:

> Sorry I didn't see this, I was KO'd by the pollen and seasonal allergies.   
> Yes this is an issue with PGSQLkit, I have confirmed it and will be 
> committing a change today based upon yours to address this.  Thanks for patch!
> 
> -- 
> Andy 'Dru' Satori
> 
> On Thursday, March 22, 2012 at 6:55 AM, Alexander Reichstadt wrote:
> 
>> The issue was in PGSQLKit.
>> 
>> -(NSString *)sqlEncodeString:(NSString *)toEncode
>> {
>> 
>> //size_t result;
>> int  error;
>> char *sqlEncodeCharArray = malloc(1 + ([toEncode length] * 2)); // per the 
>> libpq doc.
>> const char *sqlCharArrayToEncode = [toEncode 
>> cStringUsingEncoding:defaultEncoding];
>> size_t length = strlen(sqlCharArrayToEncode);
>> PQescapeStringConn ((PGconn *)pgconn, sqlEncodeCharArray,
>> (const char *)[toEncode cStringUsingEncoding:defaultEncoding],
>> length, &error);
>> //This is bad
>> //   NSString *encodedString = [[[NSString alloc] 
>> initWithFormat:@"%s",sqlEncodeCharArray] //autorelease];
>> //Instead use
>> NSString *encodedString = [NSString stringWithCString:sqlEncodeCharArray 
>> encoding:defaultEncoding];
>> 
>> free(sqlEncodeCharArray);
>> return encodedString;
>> }
>> 
>> 
>> 
>> 
>> Am 22.03.2012 um 09:09 schrieb Alexander Reichstadt:
>> 
>>> Hi,
>>> 
>>> 
>>> for a couple of reasons we migrated our project from mysql to postgres 
>>> using PGSQLKit.
>>> 
>>> But we are experiencing problems storing UTF8 data. So far we checked the 
>>> database to be able to store UTF8. When using pgPHPAdmin to store values 
>>> with German Umlaute it works. When using PGSQLKit chars get garbled.
>>> 
>>> The following code stores the values:
>>> 
>>> 
>>> const char *cString = [sql cStringUsingEncoding:NSUTF8StringEncoding];
>>> if (cString == NULL)
>>> {
>>> self.errorDescription = [NSString stringWithFormat:@"ERROR: execCommand 
>>> could not be losslessly converted to c string: %@", sql];
>>> [self appendSQLLog:[NSString stringWithFormat:@"%@\n", 
>>> self.errorDescription]];
>>> return NO;
>>> }
>>> res = PQexec(pgconn, cString);
>>> 
>>> Both sides seem correct, server as well as client, so I am not sure what 
>>> the issue might be.
>>> 
>>> Any ideas?
>>> 
>>> Thanks
>>> Alex
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/lxr%40mac.com
>>> 
>>> This email sent to l...@mac.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/dru%40druware.com
>> 
>> This email sent to d...@druware.com
> 

___

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

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

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

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


advice for creating these controls

2012-03-22 Thread Rick C.
Hi,

Just looking for an opinion what's the best way to create controls like this:

http://cl.ly/191V3Z1C0m2k2U0V443x

I initially assumed subclassing NSSegmentedControl, but then I was thinking 
maybe I can just subclass NSButton and put them together.  Or maybe even make 
this out of a custom view?  Any help would be appreciated thanks,

rc
___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Alex Zavatone
Download the UIControls project from the source code section on Apple's dev 
site.

On Mar 22, 2012, at 10:14 AM, Rick C. wrote:

> Hi,
> 
> Just looking for an opinion what's the best way to create controls like this:
> 
> http://cl.ly/191V3Z1C0m2k2U0V443x
> 
> I initially assumed subclassing NSSegmentedControl, but then I was thinking 
> maybe I can just subclass NSButton and put them together.  Or maybe even make 
> this out of a custom view?  Any help would be appreciated thanks,
> 
> rc
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

- Alex Zavatone



___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Andreas Mayer

Am 22.03.2012 um 15:14 schrieb Rick C.:

> Just looking for an opinion what's the best way to create controls like this:
> 
> http://cl.ly/191V3Z1C0m2k2U0V443x
> 
> I initially assumed subclassing NSSegmentedControl, but then I was thinking 
> maybe I can just subclass NSButton and put them together.  

The first one looks like two controls next to each other. A button and a popup 
menu. Some subclassing is probably needed to get the right look.
The other two look like segmented controls, so it's probably best to subclass 
that. (Do you even need a subclass? Doesn't the "Textured Square" style do what 
you need?)

> Or maybe even make this out of a custom view?

You can, of course, create any control from scratch.


Andreas
___

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

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

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

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


Easy wifi credentials

2012-03-22 Thread Eric Dolecki
Are there apis or a way to connect an iDevice to a device and have it send 
current wifi credentials (with user accept/deny popup)? I thought I heard 
someone say this before but I've been googling not knowing what it's called and 
have come up empty so far.

Thanks

___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Alex Zavatone

On Mar 22, 2012, at 11:08 AM, Andreas Mayer wrote:

> 
> Am 22.03.2012 um 15:14 schrieb Rick C.:
> 
>> Just looking for an opinion what's the best way to create controls like this:
>> 
>> http://cl.ly/191V3Z1C0m2k2U0V443x
>> 
>> I initially assumed subclassing NSSegmentedControl, but then I was thinking 
>> maybe I can just subclass NSButton and put them together.  
> 
> The first one looks like two controls next to each other. A button and a 
> popup menu. Some subclassing is probably needed to get the right look.
> The other two look like segmented controls, so it's probably best to subclass 
> that. (Do you even need a subclass? Doesn't the "Textured Square" style do 
> what you need?)

They are defined here:


https://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html

In this file: SegmentViewController.m using UISegmentedControl like this:

#pragma mark UISegmentedControl
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] 
initWithItems:

[NSArray arrayWithObjects:

[UIImage imageNamed:@"segment_check.png"],

[UIImage imageNamed:@"segment_search.png"],

[UIImage imageNamed:@"segment_tools.png"],

nil]];


- Alex Zavatone



___

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

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

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

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


Re: CALayer composition changes with frame position

2012-03-22 Thread James Bucanek
Markus Spoettl  wrote 
(Thursday, March 22, 2012 3:59 AM +0100):



My problem is that stationaryLayer is composited differently, sometimes
opaque, sometimes semi-transparent and I cannot explain why.


I've noticed that CA does a lot of image caching during an 
animation, and there are sometime differences between the cached 
image during animation and the (re)composited image when not 
being animated.



All colors used have an alpha of 1.0. Also, the layers are never re-drawn
during the drag, so it's not a painting issue.

The problem goes away when setting moveableLayer's opacity to 1.0.


Have you tried leaving the moveableLayer's opacity at 1.0 and 
drawing its content with an alpha of 0.5?


--
James Bucanek


___

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

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

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

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


Re: makeObjectsPerformSelector on a sub class

2012-03-22 Thread T.J. Usiyan
Does it work if you use a for in loop?
TJ

On Wed, Mar 21, 2012 at 4:28 PM, Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On Mar 21, 2012, at 13:23 , Quincey Morris wrote:
>
> > One thing to check: if your 'scrambleState' actually has a parameter:
> >
> >   - (void) scrambleState: …
> >
> > Then you need '@selector(scrambleState:)', not
> '@selector(scrambleState)'. It's an easy thing to overlook.
>
> Er, pretend you never saw that -- if there was a parameter you wouldn't be
> expecting to invoke 'performSelector…'. Listen to Jens instead.
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/griotspeak%40gmail.com
>
> This email sent to griotsp...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: makeObjectsPerformSelector on a sub class

2012-03-22 Thread T.J. Usiyan
Another option would be a container holding just the tiles.

On Wed, Mar 21, 2012 at 5:06 PM, James Bucanek wrote:

> Pascal Harris >
> wrote (Wednesday, March 21, 2012 7:56 AM -):
>
>
>  Now I want to scramble the state of each of the tiles.  In the game
>> controller, I'm using the following code:
>>
>> [[self.view subviews] makeObjectsPerformSelector:@**
>> selector(scrambleState)];
>>
>> I've put a breakpoint in scrambleState - and it never gets called. I'm
>> guessing that 'makeObjectsPerformSelector' fails to work because
>> scrambleState
>> is not a method in UIView. Question is, what do I need to do in order to
>> ensure that this code gets called?
>>
>
> Others have made a lot of valid suggestions and points, but if it wasn't
> mentioned I have another reason this would fail:
>
> You must ensure that *all* subview of self.view implement -scrambleState.
> The first object in the collection that doesn't implement this method will
> throw an exception and the iteration will stop.
>
> Safer, although longer, would be:
>
> // (warning: typed in mail)
> UIView* subview;
> for ( subview in self.view.subviews )
>if ([subview respondsToSelector:@selector(**scrambleState)])
>[subview scrambleState];
> --
> James Bucanek
>
>
>
> __**_
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at 
> cocoa-dev-admins(at)lists.**apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/**mailman/options/cocoa-dev/**
> griotspeak%40gmail.com
>
> This email sent to griotsp...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CALayer composition changes with frame position

2012-03-22 Thread T.J. Usiyan
How is the red rectangle drawn? I don't have any great insight right now
other than the fact that the change you are talking about happens at a
specific place. When the top aligns with the red rectangle. You might
consider color space or something like that. Maybe (and I am most certainly
guessing right now. pure conjecture) the problem has to do with mixing with
the grey?

On Thu, Mar 22, 2012 at 6:59 AM, Markus Spoettl wrote:

> Hello all,
>
>  I have a super-strange issue that I have debugged for hours without any
> progress. I'm at a complete loss to explain what is going on and would
> appreciate ideas on getting to the bottom of this.
>
> I have a custom layer-hosting view with a delegate-drawn hierarchy, there
> are no filters involved. The hierarchy is like this:
>
> rootLayer
>  |-- moveableLayer
>|-- stationaryLayer
>
> I can click-drag "movableLayer" around using the mouse. moveableLayer's
> opacity is 0.5, stationaryLayer's is 1.0.
>
> My problem is that stationaryLayer is composited differently, sometimes
> opaque, sometimes semi-transparent and I cannot explain why. It's
> completely reproducible and happens 100% of the time, even after rebooting.
>
> During the mouse-drag, I'm only changing moveableLayer's position
> property, wrapped in a CATransaction with +setDisableActions:YES). The
> opacity properties of neither layer are changed after creating them.
>
> To make sure no code accidentally changes opacity, I've added an observer
> to the opacity property of all layers involved, so I'm sure. I've also
> checked the observation works.
>
> Here's a short video that illustrates the issue:
>
> http://www.shiftoption.com/**temp/magic-layer-transparency.**mov
>
> rootLayer drawn gray with a red rectangle in the middle, moveableLayer
> consists of the transparent white rectangle and a green-to-blue gradient.
> stationaryLayer is drawn with a yellow-to-red gradient. As you can see, at
> a certain point during the drag stationary switches from being composited
> transparently to completely opaque (relative to moveableLayer).
>
> All colors used have an alpha of 1.0. Also, the layers are never re-drawn
> during the drag, so it's not a painting issue.
>
> The problem goes away when setting moveableLayer's opacity to 1.0. Then
> stationaryLayer is composited the same, independent of moveableLayer's
> position.
>
> I'm on Lion 10.7.3 using the 10.7 SDK with Xcode 4.3.1.
>
> Any ideas greatly appreciated!
>
> Thanks
> Markus
> --
> __**
> Markus Spoettl
> __**_
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at 
> cocoa-dev-admins(at)lists.**apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/**mailman/options/cocoa-dev/**
> griotspeak%40gmail.com
>
> This email sent to griotsp...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: advice for creating these controls

2012-03-22 Thread Andreas Mayer

Am 22.03.2012 um 16:22 schrieb Alex Zavatone:

>   UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] 
> initWithItems:
>   
> [NSArray arrayWithObjects:
>   
> [UIImage imageNamed:@"segment_check.png"],
>   
> [UIImage imageNamed:@"segment_search.png"],
>   
> [UIImage imageNamed:@"segment_tools.png"],
>   
> nil]];

You can do that in Interface Builder. No need for code.


Andreas
___

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

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

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

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


Re: CALayer composition changes with frame position

2012-03-22 Thread Markus Spoettl

On 3/22/12 5:36 PM, James Bucanek wrote:

My problem is that stationaryLayer is composited differently, sometimes
opaque, sometimes semi-transparent and I cannot explain why.


I've noticed that CA does a lot of image caching during an animation,
and there are sometime differences between the cached image during
animation and the (re)composited image when not being animated.


Yes, but the composition should yield the same result whether animated 
or not, shouldn't it? Also, there's really no property animation going 
on (-actionForLayer: isn't fired).



All colors used have an alpha of 1.0. Also, the layers are never re-drawn
during the drag, so it's not a painting issue.

The problem goes away when setting moveableLayer's opacity to 1.0.


Have you tried leaving the moveableLayer's opacity at 1.0 and drawing
its content with an alpha of 0.5?


Yes, but my test case in the video is very very trimmed down. In reality 
lots of different things are drawn over each other, so that approach 
doesn't work.


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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


How to tell which thread is which in the debugger?

2012-03-22 Thread Jens Alfke
I’m trying to debug some multithreaded code, but I can’t figure out how to tell 
which NSThread I create corresponds to which thread in the Xcode debugger view.

In other words: my code creates an NSThread and sets its .name property. If I 
get a description of the NSThread or log it in an NSLog, it describes itself as 
e.g.:
{name = MyGroovyThread, num = 5}

However, the Xcode debugger (and gdb, and ‘sample’, and the crash reporter) 
show the thread with a different, larger number. As far as I can tell, the ‘num 
=‘ in the NSThread’s description is simply a serial number incremented by 
NSThread, and doesn’t correspond to the way the rest of the OS numbers threads. 
(Why not?)

I was hoping that the ‘name’ property of the NSThread would show up in the 
debugger, since it does display names with some threads. But it doesn’t. (Why 
not?) How can I set a name that will show up in the debugger — do I need to use 
the pthreads API for that?

—Jens

PS: This is one of those questions that might also belong in xcode-users, but 
it seems more like the issue is with NSThread, not with Xcode.
___

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

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

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

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

Re: How to tell which thread is which in the debugger?

2012-03-22 Thread Wade Tregaskis
> I was hoping that the ‘name’ property of the NSThread would show up in the 
> debugger, since it does display names with some threads. But it doesn’t. (Why 
> not?) How can I set a name that will show up in the debugger — do I need to 
> use the pthreads API for that?

You should try pthread_setname_np().  When that was first added (Snow Leopard?) 
it was orthogonal to NSThread's naming scheme (which was basically solely for 
use in the debugger via `po`).  I thought the two had been reconciled - I filed 
the bug suggesting as such, back in the day - but perhaps it didn't happen.
___

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

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

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

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

Re: How to tell which thread is which in the debugger?

2012-03-22 Thread Greg Parker
On Mar 22, 2012, at 11:02 AM, Wade Tregaskis  wrote:
> Jens Alfke wrote:
>> I was hoping that the ‘name’ property of the NSThread would show up in the 
>> debugger, since it does display names with some threads. But it doesn’t. 
>> (Why not?) How can I set a name that will show up in the debugger — do I 
>> need to use the pthreads API for that?
> 
> You should try pthread_setname_np().  When that was first added (Snow 
> Leopard?) it was orthogonal to NSThread's naming scheme (which was basically 
> solely for use in the debugger via `po`).  I thought the two had been 
> reconciled - I filed the bug suggesting as such, back in the day - but 
> perhaps it didn't happen.

As of Lion, [[NSThread currentThread] setName:@"name"] uses 
pthread_setname_np(). Calling -[NSThread setName:] on a thread that is not the 
current thread does not.


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

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

Re: Missing header files/folders?

2012-03-22 Thread Eric Wing
> Correct. Note that when setting the path, you can get away with just
> pointing to the copy of Xcode that you'd like to bless:
>
>   sudo xcode-select -switch /Applications/Xcode.app

Interesting, but as a courtesy note to everybody, those of us who
write and use 3rd party tools that depend on xcode-select that are not
from Apple, this variation may not work since the underlying internal
layout of Xcode using /Applications/Xcode.app/Contents/Developer
mostly mimics the old /Developer root and these tools probably haven't
been updated to work with two different variations of the path.

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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

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

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

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


Disabling NSScrollView elasticity in app plist files.

2012-03-22 Thread Alex Zavatone
As a guy who HATES WITH A BURNING PASSION the bouncy elastic NSScrollViews and 
sudden app termination when they are on my computer's OS, I'd like to ask a few 
questions in the hopes of minimizing this atrocity against mankind (for me) 
when/if I have to switch to Lion.

As far as I can tell in Lion codesigned apps, you can't open up the guys of the 
app and change ANYTHING, even if it's in a pList file within the app.  

IIRC, Codesigning prevents any modification of any codesigned app's internals 
on Lion.

Am I correct in this assumption?

If so, is it possible to put these settings into a preference pList file that 
is read in from the User's library to configure some of the app's startup 
properties?

If not, would it be possible to modify a setting in System/Library/Frameworks 
to hard code NSScrollViews from NEVER EVER being elastic for any app that is 
launched on one system?

TIA,
- Alex Zavatone



___

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

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

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

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


Re: CALayer composition changes with frame position

2012-03-22 Thread Markus Spoettl

On 3/22/12 3:15 PM, T.J. Usiyan wrote:

How is the red rectangle drawn? I don't have any great insight right now
other than the fact that the change you are talking about happens at a
specific place. When the top aligns with the red rectangle. You might
consider color space or something like that. Maybe (and I am most certainly
guessing right now. pure conjecture) the problem has to do with mixing with
the grey?


The problem also surfaces when I don't draw the rectangle at all. I 
should probably have done that first to make things simpler, sorry. 
Here's a new video with simplified background:


http://www.shiftoption.com/temp/magic-layer-transparency2.mov

Again, while the mouse is dragging, there's no painting of any kind 
going on, no content assignment to layers or filters that change. The 
only thing that happens is that the moveableLayer is repositioned.


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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


Re: Disabling NSScrollView elasticity in app plist files.

2012-03-22 Thread Markus Spoettl

On 3/22/12 7:38 PM, Alex Zavatone wrote:

As a guy who HATES WITH A BURNING PASSION the bouncy elastic
NSScrollViews and sudden app termination when they are on my
computer's OS, I'd like to ask a few questions in the hopes of
minimizing this atrocity against mankind (for me) when/if I have to
switch to Lion.

As far as I can tell in Lion codesigned apps, you can't open up the
guys of the app and change ANYTHING, even if it's in a pList file
within the app.

IIRC, Codesigning prevents any modification of any codesigned app's
internals on Lion.

Am I correct in this assumption?


No. It depends on whether the app or the system check if its signature 
is valid. If neither cares, nothing will happen.


I'm using Xcode with a switched-out GIT IDE plugin so that I can get rid 
of the GIT integration. Xcode is code signed, but doesn't seem to mind 
me rearranging it's bowels.


Markus
--
__
Markus Spoettl
___

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

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

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

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


Re: Missing header files/folders?

2012-03-22 Thread Joar Wingfors
Hi Eric,

When using the command line invocation that I mentioned the developer folder 
inside of the Xcode app bundle would still end up being selected. I just wanted 
to call out that you don't have to provide the full path, as that's now more of 
an implementation detail.

Joar


On 22 mar 2012, at 11:24, Eric Wing wrote:

>> Correct. Note that when setting the path, you can get away with just
>> pointing to the copy of Xcode that you'd like to bless:
>> 
>>  sudo xcode-select -switch /Applications/Xcode.app
> 
> Interesting, but as a courtesy note to everybody, those of us who
> write and use 3rd party tools that depend on xcode-select that are not
> from Apple, this variation may not work since the underlying internal
> layout of Xcode using /Applications/Xcode.app/Contents/Developer
> mostly mimics the old /Developer root and these tools probably haven't
> been updated to work with two different variations of the path.
> 
> Thanks,
> Eric
> -- 
> Beginning iPhone Games Development
> http://playcontrol.net/iphonegamebook/
> ___
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list  (xcode-us...@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/xcode-users/joar%40joar.com
> 
> This email sent to j...@joar.com


___

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

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

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

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


Re: Missing header files/folders?

2012-03-22 Thread Chris Hanson
On Mar 22, 2012, at 11:24 AM, Eric Wing wrote:

>> Correct. Note that when setting the path, you can get away with just
>> pointing to the copy of Xcode that you'd like to bless:
>> 
>>  sudo xcode-select -switch /Applications/Xcode.app
> 
> Interesting, but as a courtesy note to everybody, those of us who
> write and use 3rd party tools that depend on xcode-select that are not
> from Apple, this variation may not work since the underlying internal
> layout of Xcode using /Applications/Xcode.app/Contents/Developer
> mostly mimics the old /Developer root and these tools probably haven't
> been updated to work with two different variations of the path.

Actually, when you point OS X 10.7.3’s xcode-select at Xcode.app, it will 
record the path as /Applications/Xcode.app/Contents/Developer because that’s 
what external tools will expect.

There is a known issue with xcode-select though: If you install or upgrade to 
OS X 10.7.3, and then install Xcode 4.2.1 or earlier along with its UNIX 
Development package (which is enabled by default), doing so will replace the OS 
X 10.7.3 version of xcode-select with Xcode 4.2.1’s or earlier.  For that 
version of xcode-select, you really will need to pass it the path to the 
Developer directory and not just Xcode.app.

  -- Chris


___

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

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

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

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

Re: Disabling NSScrollView elasticity in app plist files.

2012-03-22 Thread Alex Zavatone

On Mar 22, 2012, at 2:58 PM, Markus Spoettl wrote:

> On 3/22/12 7:38 PM, Alex Zavatone wrote:
>> As a guy who HATES WITH A BURNING PASSION the bouncy elastic
>> NSScrollViews and sudden app termination when they are on my
>> computer's OS, I'd like to ask a few questions in the hopes of
>> minimizing this atrocity against mankind (for me) when/if I have to
>> switch to Lion.
>> 
>> As far as I can tell in Lion codesigned apps, you can't open up the
>> guys of the app and change ANYTHING, even if it's in a pList file
>> within the app.
>> 
>> IIRC, Codesigning prevents any modification of any codesigned app's
>> internals on Lion.
>> 
>> Am I correct in this assumption?
> 
> No. It depends on whether the app or the system check if its signature is 
> valid. If neither cares, nothing will happen.

OK.  I just went over to a fresh Mac running Lion, duplicated TextEdit, edited 
the info.plist inside the app, added a space, saved it and tried to launch the 
app.

It immediately quit due to a codesigning error.  This tells me that codesigned 
apps can't be modified at all.

If you are right and I am wrong, Is there a project setting in Xcode that 
allows us to control this?  Or some other flag somewhere?

> 
> I'm using Xcode with a switched-out GIT IDE plugin so that I can get rid of 
> the GIT integration. Xcode is code signed, but doesn't seem to mind me 
> rearranging it's bowels.
> 

OK, so that tells me that you answer is the right one.  But still, something is 
preventing a codesigned app from being edited.

Hmmm.

- Alex Zavatone



___

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

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

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

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


Re: Disabling NSScrollView elasticity in app plist files.

2012-03-22 Thread Markus Spoettl

On 3/22/12 8:58 PM, Alex Zavatone wrote:

OK, so that tells me that you answer is the right one. But still,
something is preventing a codesigned app from being edited.


There is a codesign switch (the "kill" flag) that causes the process to 
be terminated if the signature isn't matching the executable. Last time 
I checked that didn't include checking for tempered resources. Maybe 
codesign and signature checking learned that trick.


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Seth Willits
On Mar 22, 2012, at 7:14 AM, Rick C. wrote:

> Just looking for an opinion what's the best way to create controls like this:
> 
> http://cl.ly/191V3Z1C0m2k2U0V443x
> 
> I initially assumed subclassing NSSegmentedControl, but then I was thinking 
> maybe I can just subclass NSButton and put them together.  Or maybe even make 
> this out of a custom view?  Any help would be appreciated thanks,


Well it depends on what exactly you mean. Do you want the exact look, or just 
the functionality and behavior? The bottom two are just plain 
NSSegmentedControls with a custom appearance. If you want the same appearance, 
you'll have to subclass it and draw the segments yourself.

The button/popup combo is a custom control. You culd make it out of two 
customized controls, a button and a popup and smoosh them together (the button 
would draw no right edge, and the popup would draw the vertical separator as 
its left edge), or you could make it a single custom control. Either approach 
would work, but I always do the latter. 

--
Seth Willits




___

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

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

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

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


Re: Missing header files/folders?

2012-03-22 Thread Charles Srstka
On Mar 20, 2012, at 11:20 PM, Shane Stanley wrote:

> This has come up again. I have a customer who has upgraded to Lion from Snow 
> Leopard, and there are no header files (which my app uses) in his 
> /System/Library/Frameworks/. But there is no option to reinstall Xcode with 
> Xcode 4.3. 

If you install the command line tools package for Xcode, it will install the 
header files in /System/Library/Frameworks.

Charles
___

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

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

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

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


Re: Why so many public properties all up in my grizzle?

2012-03-22 Thread G S
On Mon, Mar 19, 2012 at 1:35 PM, Sebastian Celis
wrote:

> 1) Embrace @properties...Exposing _ivars in header files is
> gross. You never want people to access them directly, so don't make
> those declarations public at all.
>


> 2) Technically, nothing is truly private in Objective-C, so let's stop
> trying to completely prevent people from using private APIs.


contradiction++
___

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

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

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

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


Re: Why so many public properties all up in my grizzle?

2012-03-22 Thread T.J. Usiyan
>
>
> > 2) Technically, nothing is truly private in Objective-C, so let's stop
> > trying to completely prevent people from using private APIs.
>
>
> contradiction++
> ___
>
>
Not quite. You actually CAN hide the ivars and it is odd to expose them
because you have the ability to hide them. Exposing the accessor method
INSTEAD of the ivar is usually better. I know that it is not always
convenient and hope that we eventually get the ability to access self's
ivars if we are in the same compilation unit, but until then, exposing
accessors seems like a better option.

TJ
___

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

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

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

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


Re: Why so many public properties all up in my grizzle?

2012-03-22 Thread T.J. Usiyan
Well damn, @package accomplishes the 'compilation unit' request.
On Thu, Mar 22, 2012 at 8:36 PM, T.J. Usiyan  wrote:

>
>> > 2) Technically, nothing is truly private in Objective-C, so let's stop
>> > trying to completely prevent people from using private APIs.
>>
>>
>> contradiction++
>> ___
>>
>>
> Not quite. You actually CAN hide the ivars and it is odd to expose them
> because you have the ability to hide them. Exposing the accessor method
> INSTEAD of the ivar is usually better. I know that it is not always
> convenient and hope that we eventually get the ability to access self's
> ivars if we are in the same compilation unit, but until then, exposing
> accessors seems like a better option.
>
> TJ
>
___

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

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

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

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


Re: Here's a new idea... or maybe a really old one revisited

2012-03-22 Thread Andreas Mayer

Am 23.03.2012 um 01:09 schrieb William Squires:

> Marge takes over, and Xcode - having learned Marge's preferences for source 
> code formatting, reformats the .h and .m files from Bart's project so it's 
> nice and tidy according to Marge.

That's nice. Only I don't want it to reformat the files - I want it to just 
*display* it formatted the way I want.

At least until I actually change something.


Andreas
___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Lee Ann Rucker
The button/popup combo could still be an NSSegmentedControl. Getting a menu on 
a segment is just a matter of setMenu:forSegment: - the triangle would have to 
be part of the icon, because it doesn't do it for you.

- Original Message -
From: "Seth Willits" 
To: "Cocoa-Dev List" 
Sent: Thursday, March 22, 2012 1:32:11 PM
Subject: Re: advice for creating these controls

On Mar 22, 2012, at 7:14 AM, Rick C. wrote:

> Just looking for an opinion what's the best way to create controls like this:
> 
> http://cl.ly/191V3Z1C0m2k2U0V443x
> 
> I initially assumed subclassing NSSegmentedControl, but then I was thinking 
> maybe I can just subclass NSButton and put them together.  Or maybe even make 
> this out of a custom view?  Any help would be appreciated thanks,


Well it depends on what exactly you mean. Do you want the exact look, or just 
the functionality and behavior? The bottom two are just plain 
NSSegmentedControls with a custom appearance. If you want the same appearance, 
you'll have to subclass it and draw the segments yourself.

The button/popup combo is a custom control. You culd make it out of two 
customized controls, a button and a popup and smoosh them together (the button 
would draw no right edge, and the popup would draw the vertical separator as 
its left edge), or you could make it a single custom control. Either approach 
would work, but I always do the latter. 

--
Seth Willits




___

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

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

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

This email sent to lruc...@vmware.com
___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Rick C.
Thanks everyone for the replies.  Yes I guess I just need to get a bit better 
at subclassing to get the right look. :-)  To be sure I would subclass 
NSSegmentedControl not NSSegmentedCell right?

And for the UIControls I guess for the examples right?  Yes I'll look into 
this.  And yes the textured control gives a similar look depending on the 
background.  But not quite as nice like for example the divider lines in my 
pics go all the way from top to bottom where the stock Lion control does not go 
all the way leaving an empty space at the top/bottom.  It doesn't look bad, but 
just not quite as nice as my examples...

rc



On Mar 23, 2012, at 4:32 AM, Seth Willits wrote:

> On Mar 22, 2012, at 7:14 AM, Rick C. wrote:
> 
>> Just looking for an opinion what's the best way to create controls like this:
>> 
>> http://cl.ly/191V3Z1C0m2k2U0V443x
>> 
>> I initially assumed subclassing NSSegmentedControl, but then I was thinking 
>> maybe I can just subclass NSButton and put them together.  Or maybe even 
>> make this out of a custom view?  Any help would be appreciated thanks,
> 
> 
> Well it depends on what exactly you mean. Do you want the exact look, or just 
> the functionality and behavior? The bottom two are just plain 
> NSSegmentedControls with a custom appearance. If you want the same 
> appearance, you'll have to subclass it and draw the segments yourself.
> 
> The button/popup combo is a custom control. You culd make it out of two 
> customized controls, a button and a popup and smoosh them together (the 
> button would draw no right edge, and the popup would draw the vertical 
> separator as its left edge), or you could make it a single custom control. 
> Either approach would work, but I always do the latter. 
> 
> --
> Seth Willits
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
> 
> This email sent to rickcort...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: advice for creating these controls

2012-03-22 Thread Lee Ann Rucker
>  [UIImage imageNamed:@"segment_tools.png"],

You'll save yourself headaches in the future if you don't use extensions in the 
image name, especially if you someday turn it into a combined 1x & 2x tiff.
___

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

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

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

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


Re: advice for creating these controls

2012-03-22 Thread Seth Willits
On Mar 22, 2012, at 9:49 PM, Lee Ann Rucker wrote:

> The button/popup combo could still be an NSSegmentedControl. Getting a menu 
> on a segment is just a matter of setMenu:forSegment: - the triangle would 
> have to be part of the icon, because it doesn't do it for you.

You're totally right. I had forgotten about that.



On Mar 22, 2012, at 9:50 PM, Rick C. wrote:

> Thanks everyone for the replies.  Yes I guess I just need to get a bit better 
> at subclassing to get the right look. :-)  To be sure I would subclass 
> NSSegmentedControl not NSSegmentedCell right?

It's NSSegmentedCell that does the drawing for the control. Same goes for all 
of the other controls - their cells do the drawing.


--
Seth Willits




___

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

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

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

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