[ANN] Open source Cocoa Google Reader class

2011-05-26 Thread Daniel Isenhower
Just thought I would throw this out there in case it's of help to anyone. https://github.com/perspecdev/PSGoogleReader ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Duplicate records adding to an NSTableView + NSArrayController

2011-05-26 Thread Darren Wheatley
Hi, I have an NSTableView bound to an NSArrayController, itself bound to a Core Data store. The app is working as expected, with two exceptions: 1. Duplicate records: I have an add button bound to arraycontroller.insert I have created a newObject method to allow me to define default values,

Drawing an arc fill inside an image

2011-05-26 Thread Alex Kac
I'm not sure what the best way to tackle this is... so I thought I'd ask here. I have an image with a circular button inside of it. I'd like to dynamically fill this button in an arc to show progress much like how when you are on iTunes Store on an iOS and its playing the preview its animating

Best way to handle iOS device rotation

2011-05-26 Thread koko
Should I make two views Portrait and Landscape to handle iOS device rotation or should struts and springs take care of that for me? koko Don't fight the framework. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not

Re: Best way to handle iOS device rotation

2011-05-26 Thread David Duncan
On May 26, 2011, at 11:24 AM, koko wrote: Should I make two views Portrait and Landscape to handle iOS device rotation or should struts and springs take care of that for me? Springs Struts can do a lot, but if you need some custom layout you can do it during the UIViewController

Re: Best way to handle iOS device rotation

2011-05-26 Thread Fritz Anderson
On 26 May 2011, at 1:24 PM, koko wrote: Should I make two views Portrait and Landscape to handle iOS device rotation or should struts and springs take care of that for me? Don't make two views. Start with auto-resizing (struts and springs). That should be enough in 95% of cases. If you have

Re: How to implement while there are objects in the array - run runloop idea?

2011-05-26 Thread Stephen J. Butler
On Thu, May 26, 2011 at 12:56 PM, Nick eveningn...@gmail.com wrote: I have a custom (not main) thread, that adds objects to an NSArray at random times. I have an another thread (main thread) that has to retrieve these objects and do something with them (extract some properties from the

Re: How to implement while there are objects in the array - run runloop idea?

2011-05-26 Thread Jens Alfke
On May 26, 2011, at 10:56 AM, Nick wrote: I have a custom (not main) thread, that adds objects to an NSArray at random times. ... Is there any way to make the RunLoop (after it has processed all NSUrlConnection's asynchronous things) check, if there are some objects in my NSArray queue,

Re: How to implement while there are objects in the array - run runloop idea?

2011-05-26 Thread Ken Thomases
On May 26, 2011, at 1:35 PM, Stephen J. Butler wrote: - Use NSNotifications to notify that a new object is waiting to be processed. If you go this route, you could actually have multiple processing threads all listening for the notification. Notifications are delivered on the same thread as

Re: Drawing an arc fill inside an image

2011-05-26 Thread Jens Alfke
On May 26, 2011, at 11:21 AM, Alex Kac wrote: So I have the image, and I suppose I can draw that image to a context and then draw an arc on that image, and then make another image out of it. That seems like it would get slow if I needed to do that a lot. No need to make a new image. Just

Why do things wind up under the nav bar after rotation?

2011-05-26 Thread G S
Hi all. I'm having a layout problem on all my screens after they're rotated. It seems as though the view loses all knowledge of the navigation bar at the top after a rotation, so subviews are shoved up under it. Check it out: http://i.stack.imgur.com/mFALa.png It's not just this view. It

Re: Drawing an arc fill inside an image

2011-05-26 Thread Steve Christensen
Custom view that sits on top of a UIImageView? Implement -drawRect: and a progress property and you're done. On May 26, 2011, at 11:21 AM, Alex Kac wrote: I'm not sure what the best way to tackle this is... so I thought I'd ask here. I have an image with a circular button inside of it. I'd

Re: Best way to handle iOS device rotation

2011-05-26 Thread koko
Thanks David and Fritz ... always best to check the path ! koko Don't fight the framework. --Kyle Sluder On May 26, 2011, at 12:32 PM, David Duncan wrote: On May 26, 2011, at 11:24 AM, koko wrote: Should I make two views Portrait and Landscape to handle iOS device rotation or should

Re: Why do things wind up under the nav bar after rotation?

2011-05-26 Thread G S
Resolved. Turns out that doing this after rotation will re-align everything: [self.navigationController.view layoutSubviews]; Kinda seems like the framework would call that, but I guess not. ___ Cocoa-dev mailing list

Re: Why do things wind up under the nav bar after rotation?

2011-05-26 Thread David Duncan
On May 26, 2011, at 12:00 PM, G S wrote: Resolved. Turns out that doing this after rotation will re-align everything: [self.navigationController.view layoutSubviews]; Kinda seems like the framework would call that, but I guess not. It should and this shouldn't be necessary. A bug

Re: How to implement while there are objects in the array - run runloop idea?

2011-05-26 Thread Stephen J. Butler
On Thu, May 26, 2011 at 1:35 PM, Stephen J. Butler stephen.but...@gmail.com wrote: You might want to abandon that approach and not add objects from the background thread directly to the shared array. Instead, you could signal the main thread that a new object is ready to be processed. Some

Re: Drawing an arc fill inside an image

2011-05-26 Thread Conrad Shultz
The OP wants a solution for iOS. lock/unlockFocus only exist in NSView, not UIView. FWIW, I think you (that is, the OP) should start with the simplest solution available (e.g. Steve's suggestion), test performance, and only optimize if needed. Don't try to optimize if it's not actually

IKScannerDeviceView transferMode set to memory

2011-05-26 Thread Tom Hohensee
I am currently rewiring a scanner application which I originally wrote some years ago using the TWAIN driver directly into the more modern ImageKit IKScannerDeviceView . I thought that I could customize it enough to meet my needs without having to build it using ImageCaptureCore framework with

Re: Drawing an arc fill inside an image

2011-05-26 Thread Alex Kac
Sure, I get the idea of only optimizing if needed. That said, experience (15 years) tells me very strongly that if I know that X will be slow and Y will be fast and either way works properly, I'd probably choose Y. So I prefer to stand on the shoulders of giants where possible. I've got a

Re: Why do things wind up under the nav bar after rotation?

2011-05-26 Thread G S
Kinda seems like the framework would call that, but I guess not. It should and this shouldn't be necessary. A bug report would be good here. Yes, I'm going to file one. While this workaround straightens the layout after rotation, it's a little janky because things snap into place after the

Re: Why do things wind up under the nav bar after rotation?

2011-05-26 Thread David Duncan
On May 26, 2011, at 2:39 PM, G S wrote: Kinda seems like the framework would call that, but I guess not. It should and this shouldn't be necessary. A bug report would be good here. Yes, I'm going to file one. While this workaround straightens the layout after rotation, it's a little

Using an iPhone to control a Mac- source code?

2011-05-26 Thread Tom Jeffries
This may be the wrong forum for this question- if so, please let me know. I want to use an iPhone to act as mouse and keyboard for a Mac. It looks like the best connection is through a network, although Bluetooth might also work. There are other apps that do this. I'd love some sample code so I

Seeding random() randomly

2011-05-26 Thread Graham Cox
I'm using random(), but every time I run my app I get the same sequence, despite having this code in my app delegate's -appDidFinishLaunching method. Clearly I'm not seeding it right, though I can't see why - I get a different value for seed every time. What gives? unsigned seed =

Re: Seeding random() randomly

2011-05-26 Thread Dave Keck
I'm using random(), but every time I run my app I get the same sequence, despite having this code in my app delegate's -appDidFinishLaunching method. Clearly I'm not seeding it right, though I can't see why - I get a different value for seed every time. What gives?        unsigned seed =

Re: Seeding random() randomly

2011-05-26 Thread Ken Thomases
On May 26, 2011, at 8:00 PM, Graham Cox wrote: I'm using random(), but every time I run my app I get the same sequence, despite having this code in my app delegate's -appDidFinishLaunching method. Clearly I'm not seeding it right, though I can't see why - I get a different value for seed

Re: Seeding random() randomly

2011-05-26 Thread Quincey Morris
On May 26, 2011, at 18:00, Graham Cox wrote: unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 1.0); NSLog(@launched, seed = %ld, seed ); Also, be careful here, because %ld is the wrong format specifier for type 'unsigned'. Whether it logs the

Re: Seeding random() randomly

2011-05-26 Thread David Duncan
On May 26, 2011, at 6:15 PM, Dave Keck wrote: I'm not sure what your problem is, but I believe arc4random() has superseded random() for a while now. Incorrect. There are many reason to have a seedable PRNG, the least of which is the ability to reasonably debug the randomness. That an

Re: Seeding random() randomly

2011-05-26 Thread Graham Cox
On 27/05/2011, at 11:23 AM, Quincey Morris wrote: On May 26, 2011, at 18:00, Graham Cox wrote: unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 1.0); NSLog(@launched, seed = %ld, seed ); Also, be careful here, because %ld is the wrong format

Re: Seeding random() randomly

2011-05-26 Thread Ken Thomases
On May 26, 2011, at 8:32 PM, Graham Cox wrote: On 27/05/2011, at 11:23 AM, Quincey Morris wrote: On May 26, 2011, at 18:00, Graham Cox wrote: unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 1.0); NSLog(@launched, seed = %ld, seed ); Also, be

Re: Seeding random() randomly

2011-05-26 Thread Graham Cox
On 27/05/2011, at 11:53 AM, Ken Thomases wrote: %u I'm confused about how to correctly write format specifiers for both 32 and 64-bit runtimes. The 64-bit porting guide doesn't spell it out (yet you end up with code peppered with warnings that you should examine the use of the format

Re: Seeding random() randomly

2011-05-26 Thread Kevin Bracey
I think this was from some programming book I have, sorry I can site it: srandom(time(NULL)); cheers Kevin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: TransformProcessType() still doesn't show menu (Bug ID# 5905139)

2011-05-26 Thread Jerry Krinock
I just thought I'd lift my head up long to say thank you, Anders. Unfortunately, your code doesn't work in my app. Tried several mutations; still no good. Another thing I learned is that programmatically switching apps, simulating the user typing cmd-tab, which works when the user does it,

Re: TransformProcessType() still doesn't show menu (Bug ID# 5905139)

2011-05-26 Thread Jim Correia
On May 26, 2011, at 7:21 PM, Jerry Krinock wrote: I just thought I'd lift my head up long to say thank you, Anders. Unfortunately, your code doesn't work in my app. Tried several mutations; still no good. Another thing I learned is that programmatically switching apps, simulating the

Re: Seeding random() randomly

2011-05-26 Thread Chase Latta
unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 1.0); You are trying to set seed to a value that is something like 3,281,585,690,000; seed cannot handle this value so it will be set to 4294967295, at least on my machine. You are using the same seed each time you run the

Re: Seeding random() randomly

2011-05-26 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 5/26/11 6:00 PM, Graham Cox wrote: I'm using random(), but every time I run my app I get the same sequence, despite having this code in my app delegate's -appDidFinishLaunching method. Clearly I'm not seeding it right, though I can't see why -

Re: Seeding random() randomly

2011-05-26 Thread Eeyore
I've seen gnu documentation for srandom that suggest the equivalent of Kevin's suggestion, namely srandom(time(0)). Not sure if using the NSDate has any advantage over a call to time() and it would avoid this type of thing (gnu is likely to ensure time() and srandom() work correctly together).

Re: Seeding random() randomly

2011-05-26 Thread Jens Alfke
On May 26, 2011, at 7:15 PM, Kevin Bracey wrote: srandom(time(NULL)); It’s never a good idea to seed a RNG with something guessable like this. (An old exploit against the Netscape browser’s SSL implementation was made possible in part by doing exactly that.) All you have to do is call

Re: Seeding random() randomly

2011-05-26 Thread Scott Ribe
On May 26, 2011, at 9:32 PM, Jens Alfke wrote: It’s never a good idea to seed a RNG with something guessable like this. Not all applications of random() have anything to do with security... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice

Re: Seeding random() randomly

2011-05-26 Thread Graham Cox
On 27/05/2011, at 1:16 PM, Conrad Shultz wrote: I'm pretty sure your problem has to do with overflowing your data types. unsigned is getting treated as unsigned int, which will be too small to hold the value after you, for some reason I'm not clear on, multiply by 1. When I wrote some

Re: Seeding random() randomly

2011-05-26 Thread Clark Cox
On Thu, May 26, 2011 at 9:30 PM, Graham Cox graham@bigpond.com wrote: I should mention this is in a 64-bit build, so doesn't that mean that 'unsigned' is 64 bits? No. 'unsigned' is the same size on both 32- and 64-bit The only built-in types that are different between 32- and 64-bits are:

Re: Seeding random() randomly

2011-05-26 Thread Graham Cox
On 27/05/2011, at 2:42 PM, Clark Cox wrote: No. 'unsigned' is the same size on both 32- and 64-bit The only built-in types that are different between 32- and 64-bits are: signed long long (which is really the same as signed long) unsigned long and any pointer type All other built-in

Re: encoding of file names

2011-05-26 Thread Andrew Thompson
However, in practical terms, the indexable string elements are components, not codepoints. It seems to me the single hardest thing to come to grips with when newly approaching NSString is understanding that 'unichar's (and characters in the sense of [characterAtIndex:]) *aren't*