Re: Swift and Threads

2016-09-13 Thread Stephen J. Butler
This site suggests a version using withUnsafeMutableBufferPointer: http://blog.human-friendly.com/swift-arrays-are-not-threadsafe let nbrOfThreads = 8 let step = 2 let itemsPerThread = number * step let bitLimit = nbrOfThreads * itemsPerThread var bitfield = [Bool](count: bitLimit,

Re: Where are my bytes hiding?

2016-05-05 Thread Stephen J. Butler
Those files are compressed by the filesystem. In HFS+/MacOS Extended that means that the data fork is empty and the file contents are stored in the resource fork or extended attributes structure. http://wiki.sleuthkit.org/index.php?title=HFS#HFS.2B_File_Compression If it's in the extended

Re: Diff view framework?

2016-01-25 Thread Stephen J. Butler
How about using a webkit view and one of these diff2html scripts: http://stackoverflow.com/questions/641055/diff-to-html-diff2html-program On Mon, Jan 25, 2016 at 3:08 AM, Jonathan Guy wrote: > Hi all > Does anyone know of a cocoa framework which provides a view for

Re: Handling http:// URLs

2015-10-13 Thread Stephen J. Butler
I think you're talking about Seamless Linking/Universal Links. Introduced in iOS 9 https://developer.apple.com/videos/play/wwdc2015-509/ https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html On Tue, Oct 13, 2015 at 7:20 PM, Rick Mann

Re: Question about enums

2015-07-17 Thread Stephen J. Butler
How about using a Custom option with an associated String value? enum Foo:String { case Bar = “Bar case Etc = “Etc case Etc_Etc = “Etc Etc case Custom(String) } On Fri, Jul 17, 2015 at 2:53 PM, Michael de Haan  m...@comcast.net wrote: I wonder if I can get some input as I

Re: Question about enums

2015-07-17 Thread Stephen J. Butler
, 2015, at 13:33 , Stephen J. Butler stephen.but...@gmail.com wrote: How about using a Custom option with an associated String value? enum Foo:String { case Bar = “Bar case Etc = “Etc case Etc_Etc = “Etc Etc case Custom(String) } Unfortunately that won’t compile. One

Re: Question about enums

2015-07-17 Thread Stephen J. Butler
Oops, yes, obviously I haven't played much with raw representable enums yet :) Thanks for the correction. On Fri, Jul 17, 2015 at 3:39 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Jul 17, 2015, at 13:33 , Stephen J. Butler stephen.but...@gmail.com wrote: How about using

Re: cannot invoke 'substringToIndex' with an argument list of type '(Int)'

2015-07-07 Thread Stephen J. Butler
You should file a documentation bug. The signature is actually: func substringFromIndex(index: String.Index) - String So what you really want I believe is: s = s.substringToIndex(advance(s.endIndex, -1)) On Tue, Jul 7, 2015 at 2:02 AM, Rick Mann rm...@latencyzero.com wrote: What? The docs

Re: Swift 2 init() with CF types and throws

2015-07-01 Thread Stephen J. Butler
You're focusing on the wrong part :) Which element of your code has a type of NSGraphicsContext? It's cocoaCTX! The compiler error is suggesting you do one of these: cocoaCTX?.graphicsPort cocoaCTX!.graphicsPort On Wed, Jul 1, 2015 at 6:28 PM, Rick Mann rm...@latencyzero.com wrote: I'm trying

Re: Swift program termination...

2015-05-24 Thread Stephen J. Butler
I think you should use GCD by creating a dispatch source of type DISPATCH_SOURCE_TYPE_SIGNAL (the handle is the signal enum, eg SIGTERM), add an event handler, and then resume it. On Sun, May 24, 2015 at 10:40 AM, Randy Widell randy.wid...@gmail.com wrote: I’m messing around with Swift to create

Re: Best way to move a file out of the way?

2015-03-24 Thread Stephen J. Butler
I would say rename the new destination file if you think you should keep the old one around. However, if it's always the case that the new file should replace the old one when it finishes downloading, then you should save the new file under a temporary name and use -[NSFileManager

Re: Crash in libsystem_kernel.dylib`__workq_kernreturn:

2015-01-25 Thread Stephen J. Butler
I agree that it sounds like a memory management bug. Especially since you aren't using ARC. Try turning on NSZombies and see if it crashes at a more helpful point. http://michalstawarz.pl/2014/02/22/debug-exc_bad_access-nszombie-xcode-5/ On Sun, Jan 25, 2015 at 4:57 PM, Trygve Inda

Re: URLByResolvingBookmarkData not case sensitive

2015-01-06 Thread Stephen J. Butler
What about this (caveat: only works if the file exists): @interface NSArray (FileNSURL) - (NSUInteger) indexOfFileNSURL:(NSURL*)aFileURL error:(NSError**)error; @end @implementation NSArray (FileNSURL) - (NSUInteger) indexOfFileNSURL:(NSURL *)aFileURL error:(NSError**)error { id

Re: NSRegularExpression segfault

2014-12-15 Thread Stephen J. Butler
If you read the ICU docs on regular expressions you'll see that it sets an 8MB limit on head size when evaluating. My guess is that you've run into this and NSRegularExpression misses a return code somewhere. But your pattern is really suboptimal for what you're trying to accomplish. For example,

Re: NSRegularExpression segfault

2014-12-15 Thread Stephen J. Butler
: On Mon, Dec 15, 2014 at 6:09 PM, Stephen J. Butler stephen.but...@gmail.com wrote: If you read the ICU docs on regular expressions you'll see that it sets an 8MB limit on head size when evaluating. My guess is that you've run into this and NSRegularExpression misses a return code

Re: hueComponent not valid for the NSColor

2014-11-01 Thread Stephen J. Butler
It's a color space that only contains a white and alpha component. Hue doesn't make sense in an all white space. It's like if we were talking about a train that only goes between NYC and DC, and you asked How long does it take for that train to reach London? You can't ask that question because the

Re: How to convert String.Index to UInt?

2014-08-16 Thread Stephen J. Butler
Try: import Cocoa let s = hallo\there let aas = NSMutableAttributedString(string: s, attributes: nil) if let rangeOfTab = s.rangeOfString( \t ) { let colour = NSColor.grayColor() let length = distance(s.startIndex, rangeOfTab.startIndex) let aRange = NSRange(location: 0, length:

Re: Class in Swift

2014-08-16 Thread Stephen J. Butler
I'm still learning Swift, but extrapolating from what I might do in Python or Ruby... protocol MyProtocol { ... } func myFunction(generator: (MyParameterType) - MyProtocol) { for ... { let p : MyParameterType = ... if not p special { continue } let obj = generator(p) ... } }

Re: How do I temporary retain self, under ARC?

2014-07-17 Thread Stephen J. Butler
Do you know this code will always run on the main thread? Because you could fix this from the other side, in the delegate. Use dispatch_async(dispatch_get_main_queue(), ...) to un-assign the property. But this won't work if you're on a non-main thread when you call back into the delegate. On

Re: NSStrings to CStrings and hex encoding...

2014-06-24 Thread Stephen J. Butler
Those are the UTF-8 sequences for smart quotes. It's not coming from cStringUsingEncoding, but directly from NSTextView: http://stackoverflow.com/questions/19801601/nstextview-with-smart-quotes-disabled-still-replaces-quotes Rant: This has been a super annoying Mavericks feature IMHO. Even when

Re: string literals and performance

2014-05-24 Thread Stephen J. Butler
You misunderstand the point of the Stackoverflow answer. In the first example you've given it looks like s is just a stack local variable. In that case there is no difference between the two examples. Actually, in the face of optimization I bet the assembly turns out exactly the same. Use the

Re: NSSharingService with Animated GIFs?

2014-05-17 Thread Stephen J. Butler
On Sat, May 17, 2014 at 12:41 AM, Charles Carver charlescar...@mac.comwrote: NSURL *saveUrl = [NSURL URLWithString:[NSString stringWithFormat:@file://%@, NSTemporaryDirectory()]]; saveUrl = [saveUrl URLByAppendingPathComponent:fileName]; You shouldn't construct file URLs like this. There has

Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-05 Thread Stephen J. Butler
What's your next step after doing the UTF8 to UTF16 range conversion? If it's just going to be -[NSString substringWithRange:] then I'd strongly suggest just doing -[NSString initWithBytes:length:encoding:] on the UTF8 string. At least profile it and see what the penalty is. You've already paid

Re: NSURLSession + Bonjour to do peer-to-peer file transfers?

2013-12-25 Thread Stephen J. Butler
NSURLSession is a fancy HTTP client. It needs to talk to an HTTP server. None of the included iOS and OS X frameworks (that I'm aware of) include an HTTP server. You can either run an HTTP server on the device in your app ( https://www.google.com/search?q=ios+http+server) or you can write your

Re: _NSWarnForDrawingImageWithNoCurrentContext

2013-12-16 Thread Stephen J. Butler
Did you try the suggestion the warning listed? Breaking on void _NSWarnForDrawingImageWithNoCurrentContext()? Because a stack trace for when the error occurs would be helpful. On Sat, Dec 14, 2013 at 6:32 AM, Leonardo mac.iphone@gmail.com wrote: Hi, when I rotate my NSView, my image

Re: rangeOfString behaves wierd

2013-12-09 Thread Stephen J. Butler
I don't get the same result. 10.9.0, Xcode 5.0.2. I created an empty command line utility, copied the code, and I get NSNotFound. 2013-12-09 02:50:19.822 Test[73850:303] main 见≠見 (3 shorts) occurs in 见=見見 (4 shorts) at {9223372036854775807, 0} On Mon, Dec 9, 2013 at 2:43 AM, Gerriet M.

Re: rangeOfString behaves wierd

2013-12-09 Thread Stephen J. Butler
OK, you are right. Copy+paste didn't preserve the compatibility character. Does look like a bug of sorts, or at least something a unicode expert should explain. On Mon, Dec 9, 2013 at 3:20 AM, Gerriet M. Denkmann gerr...@mdenkmann.dewrote: On 9 Dec 2013, at 16:00, Stephen J. Butler

Re: rangeOfString behaves wierd

2013-12-09 Thread Stephen J. Butler
Would converting each string to NFD (decomposedStringWithCanonicalMapping) be an acceptable work around in this case? On Mon, Dec 9, 2013 at 3:43 AM, Stephen J. Butler stephen.but...@gmail.comwrote: OK, you are right. Copy+paste didn't preserve the compatibility character. Does look like

Re: Download fileSystem data

2013-11-30 Thread Stephen J. Butler
Have you profiled your code to see what calls exactly are taking the most time? I have a feeling it's these: isFilePackageAtPath kLSItemInfoIsInvisible kFSNodeLockedMask kFSCatInfoCreateDate kFSCatInfoContentMod kFSCatInfoBackupDate kFSCatInfoAccessDate And parsing ls

Re: Sending a message to a Toll free bridge

2013-11-25 Thread Stephen J. Butler
I don't believe that the array that CTFontCopyAvailableTables() returns contains CFTypes. So yes, CFArray is bridgeable. But in this case that isn't so useful since the values aren't. On Mon, Nov 25, 2013 at 3:23 AM, Gerriet M. Denkmann gerr...@mdenkmann.dewrote: The documentation states:

Re: How to fix warning?

2013-08-28 Thread Stephen J. Butler
Are those really always constant? Why not: NSCharacterSet *stopCharacters = [NSCharacterSet characterSetWithCharactersInString:@ \t\n\r\x85\x0C\u2028\u2029]; On Wed, Aug 28, 2013 at 3:26 PM, Dave d...@looktowindward.com wrote: Hi, I am getting the following warning warning: format

Re: Ownership follows the 'Create' Rule' - not literally

2013-08-25 Thread Stephen J. Butler
What they're saying here is that that parameter is following the Create Rule even though the function doesn't have a normal name for following the rule. They are documenting an exception to the ownership rule. If the function name did follow the rule it would be redundant to document it as such.

Re: NSValue valueWithBytes:objCType:

2013-08-25 Thread Stephen J. Butler
My guess, and this is only a guess, is that NSValue only uses the type property to make sure two NSValues have the same layout before calling memcmp (or such) on them. We have a lot of evidence that it doesn't do a deep inspection of the type in order to give a more accurate comparison. Can you

Re: Variable Number of Parameters in Method

2013-08-21 Thread Stephen J. Butler
On Wed, Aug 21, 2013 at 2:35 AM, Dave d...@looktowindward.com wrote: -(void) methodX:(NSString*) theName,… { va_list myArgumentList; NSInteger myArgumentCount; myArgumentCount = 0; va_start(myArgumentList,theMethodName); while(va_arg(myArgumentList,NSString*) != nil)

Re: Variable Number of Parameters in Method

2013-08-21 Thread Stephen J. Butler
On Wed, Aug 21, 2013 at 4:22 AM, Dave d...@looktowindward.com wrote: if ([myType isEqualToString:@NSInteger] ) { myNSInteger = va_arg(myArgumentList,NSInteger*); // do something with myNSInteger [myFormattedString

Re: -[NSBundle URLForResource:withExtension:subdirectory] is case-sensitive

2013-08-17 Thread Stephen J. Butler
On Sat, Aug 17, 2013 at 6:03 PM, Rick Aurbach r...@aurbach.com wrote: I expect indexURL to be non-null (and to contain the appropriate URL). However, in actual devices, this function returns nil; on the IOS Simulator it returns a valid URL. If I change the resource name to exactly match the

Re: pathForResource:ofType: iOS bug?

2013-07-07 Thread Stephen J. Butler
How are you examining the return value? Show us that code too, please. On Sun, Jul 7, 2013 at 7:34 PM, Jeff Smith jeff...@aol.com wrote: Hi, pathForResource:ofType: is returning a path string with 4 garbage characters added to the end of the string. To make sure it wasn't my program

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Stephen J. Butler
I didn't look at your code, but... one thing to note is that it is absolutely not secure to run your daemon as root and display a GUI. I hope that isn't part of your plan. The OS X way to do this sort of thing is to write your daemon as a Launch Agent (since it needs to interact with a logged in

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Stephen J. Butler
On Fri, May 10, 2013 at 1:56 AM, Ondrej Holecek ondrej.hole...@gmail.comwrote: thanks for the hint, I have to check this first. However at first glance it seems I have to create 2 applications. Daemon and cmd-line app. My idea is to have just one app which behaves as a daemon in case the

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Stephen J. Butler
On Fri, May 10, 2013 at 2:03 PM, Jens Alfke j...@mooseyard.com wrote: #!/bin/sh open -b com.example.XQIVApp $@ You probably want this instead to prevent word splitting for elements that have spaces: open -b com.example.XQIVApp $@ Nothing is ever trivial in sh/bash ;)

Re: Too many threads?

2013-05-08 Thread Stephen J. Butler
If that's a POSIX error code it's reporting, then 35 maps to either EAGAIN or EWOULDBLOCK. I thought it might be you're hitting the max file limit (256 by default) but that would cause open() to return EMFILE. However, pthread_create() can return EAGAIN, and with 2000+ threads you might be

Re: Dynamic library linking

2013-02-24 Thread Stephen J. Butler
This is an advanced topic which touches on a lot of OS X details. The short of it is, even if you solve your linking problems your Python 3.3 library won't work. What you need to is include the entire Python 3.3 framework in your Application bundle. Once you've figured out how to do that, linking

Re: Cocoa | Reading Plist/file version of Native binary

2012-11-26 Thread Stephen J. Butler
Do you mean the app/bundle version? CFBundleGetValueForInfoDictionaryKey() with kCFBundleVersionKey. On Tue, Nov 27, 2012 at 12:41 AM, Sachin Porwal sachinpor...@gmail.comwrote: Hi, I am looking for a way to read file version information of a native Binary(32/64 bit) in Cocoa. This is

Re: App rejection due to app-sandboxing invalid entitlement

2012-10-29 Thread Stephen J. Butler
On Mon, Oct 29, 2012 at 12:49 PM, Martin Hewitson martin.hewit...@aei.mpg.de wrote: But com.apple.security.scripting-targets is not a temporary entitlement, is it? I thought this was the recommended way of communicating between apps in the new era. But this part clearly is:

Re: Hints for supporting dragging a file onto the dock icon, then onto a row in menu presented at that point?

2012-09-13 Thread Stephen J. Butler
On Thu, Sep 13, 2012 at 2:40 PM, Chris Markle cmar...@asperasoft.com wrote: I'm pretty new to OS X development and just looking for hints about how to do something like this... I saw an app called Dragster that allows you to drag a file over the dock icon for the app, at which point a menu of

Re: How to Identify a Phantom Write Operation

2012-09-05 Thread Stephen J. Butler
On Wed, Sep 5, 2012 at 1:51 PM, douglas welton douglas_wel...@earthlink.net wrote: I reconfigured my code to load the cached copy of the user-selected movie with the QTMovieResolveDataRefsAttribute set to NO. I don't get any new/additional messages sent to the console. In your experience,

Re: App memory

2012-08-16 Thread Stephen J. Butler
getrusage? On Thu, Aug 16, 2012 at 9:39 AM, Charlie Dickman 3tothe...@comcast.net wrote: Is there a system command or any other way to get application memory stats like vm_stat does for the whole system? Charlie Dickman 3tothe...@comcast.net

Re: Where do these come from...

2012-08-15 Thread Stephen J. Butler
On Wed, Aug 15, 2012 at 10:20 AM, Charlie Dickman 3tothe...@comcast.net wrote: [[NSColor whiteColor] set]; [die1 drawInRect: iDieDrawRect fromRect: imageRect1 operation: NSCompositeSourceOver

Re: Where do these come from...

2012-08-15 Thread Stephen J. Butler
On Wed, Aug 15, 2012 at 10:02 PM, Charlie Dickman 3tothe...@comcast.net wrote: Here's the whole method... it is being called from within a view's drawRect method... Are you calling drawRect directly from your code? If so, don't do that. You should be sending one of the setNeedsDisplay

Re: Adding login items - who's right? The headers or the guide?

2012-07-29 Thread Stephen J. Butler
On Sun, Jul 29, 2012 at 6:09 PM, João Varela joaocvar...@gmail.com wrote: I would like to support the new way of adding login items by adopting the Services Management framework. As I I would like to support Snow Leopard I was quite pleased when I read that SMLoginItemSetEnabled function was

Re: Getting NSApplicationDelegate protocol

2012-07-06 Thread Stephen J. Butler
On Fri, Jul 6, 2012 at 3:30 AM, ecir hana ecir.h...@gmail.com wrote: I'm trying to get the methods a protocol specifies and just stumbled upon one problem: the following code returns NULL: Protocol *protocol = objc_getProtocol(NSApplicationDelegate); Are you trying this on 10.5? Or are

Re: Getting NSApplicationDelegate protocol

2012-07-06 Thread Stephen J. Butler
problem perfectly. On Fri, Jul 6, 2012 at 11:14 AM, Stephen J. Butler stephen.but...@gmail.com wrote: On Fri, Jul 6, 2012 at 3:30 AM, ecir hana ecir.h...@gmail.com wrote: I'm trying to get the methods a protocol specifies and just stumbled upon one problem: the following code returns NULL

Re: How to know if a file has been opened before?

2012-06-05 Thread Stephen J. Butler
On Tue, Jun 5, 2012 at 3:14 AM, Antonio Nunes devli...@sintraworks.com wrote: On 5 Jun 2012, at 00:09, Stephen J. Butler wrote: You can use extended attributes to attach information to a file. Maybe serialize your session state as a plist and use setxattr/getxattr to manipulate it. Follows

Re: How to know if a file has been opened before?

2012-06-04 Thread Stephen J. Butler
You can use extended attributes to attach information to a file. Maybe serialize your session state as a plist and use setxattr/getxattr to manipulate it. Follows the file as it's moved around. PS: it's recommended that names for your attribute following the java style reverse DNS. For example,

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Stephen J. Butler
On Fri, May 25, 2012 at 1:56 AM, Peter magn...@web.de wrote: I'd like to reveal/select multiple items in the Finder. NSWorkspace only handles single files as in            [[NSWorkspace sharedWorkspace] selectFile:currentFilePath                            

Re: In a modal pickle

2012-05-19 Thread Stephen J. Butler
On Sat, May 19, 2012 at 12:04 PM, NUExchange j.ay...@neu.edu wrote: I have a core data app that opens two windows when it starts up. One of the two has a NSSearchField. The cursor is in search field and I can enter and delete text, but any other operation on either of the windows causes the

Re: Dissappearing string

2012-05-16 Thread Stephen J. Butler
On Wed, May 16, 2012 at 12:39 PM, Charlie Dickman 3tothe...@comcast.net wrote:        possible[strlen(possible)] = '\0'; This can't possibly work. strlen() depends on the string already being \0 terminated. You can't use strlen() to find the position to add a \0.

Re: Dissappearing string

2012-05-16 Thread Stephen J. Butler
On Wed, May 16, 2012 at 12:39 PM, Charlie Dickman 3tothe...@comcast.net wrote:        NSString *possibleString = [NSString stringWithFormat: @%s, possible]; ... and this line is something you shouldn't do. There are a ton of correct methods to create an NSString from a C string:

Re: First Responder

2012-05-10 Thread Stephen J. Butler
On Thu, May 10, 2012 at 6:24 PM, koko k...@highrolls.net wrote: I have a menu item connected to an action in First Responder; The action exists in an NSView subclass. The subclass implements acceptsFirstResonder and return YES. The subclass implements validateMenuItem and return YES; When

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Stephen J. Butler
On Mon, May 7, 2012 at 8:06 AM, Charles Srstka cocoa...@charlessoft.com wrote: Myself, I like to just spin off a method or function that takes a chunk of data and populates the fields of the struct one by one, instead of writing the data straight onto the struct. A little more code, but you

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-05 Thread Stephen J. Butler
On Sat, May 5, 2012 at 4:46 PM, Markus Spoettl ms_li...@shiftoption.com wrote: On 05.05.12 23:07, Martin Wierschin wrote: So, when using a binary search, I get different answers depending on the other strings in the list! Seems to work for me: I was using F-Script to investigate this, but

Re: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?

2012-03-31 Thread Stephen J. Butler
Wikipedia says that cur/ico files have a very simple format: http://en.wikipedia.org/wiki/ICO_(file_format) Part of the ICONDIRENTRY structure is the hotspot information. Should be pretty easy to write a basic parser. On Sun, Mar 25, 2012 at 4:25 AM, Oshrat Fahima oshr...@waves.com wrote: Hi

Re: drawRect using a Category

2012-03-30 Thread Stephen J. Butler
On Fri, Mar 30, 2012 at 10:31 PM, Peter Teeson ptee...@me.com wrote: Rather than using a sub-class, which seems overkill to me, I decided to try a Category instead. So here's what I did (and it seems to work.) The problem with this approach is that you've replaced the drawRect: for every

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-13 Thread Stephen J. Butler
On Tue, Mar 13, 2012 at 4:09 PM, JongAm Park jongamp...@sbcglobal.net wrote: In other words, the thread function may want to update UI like inserting a log message to a text field on a window and thus asking main thread to do so, and main thread is waiting to acquire a lock or waiting using

Re: Finding object array index when iterating through array

2012-03-08 Thread Stephen J. Butler
On Tue, Mar 6, 2012 at 8:19 PM, Marco Tabini mtab...@me.com wrote: I have an array and I am iterating through it using this technique: for (id object in array) {    // do something with object } Is there  way to obtain the object's current array index position or do I have to add a

Re: Accessing array in thread safe way

2012-03-06 Thread Stephen J. Butler
On Tue, Mar 6, 2012 at 1:51 PM, Jan E. Schotsman jesc...@xs4all.nl wrote: I have an array of progress values (number objects) for subprojects, from which I calculate the overall progress . The array is an atomic property of the project class. Is it safe to access this array from multiple

Re: initFileURLWithPath run on emulator, not run on device

2012-01-30 Thread Stephen J. Butler
On Mon, Jan 30, 2012 at 9:57 AM, Riccardo Barbetti riccardo.barbe...@gmail.com wrote: I have a problem, after that I had write and test code on simulator, today I have work on device. I'm skeptical because... In my program I save my NSArray:    NSArray *paths =

Re: KVO willChange and didChange

2012-01-15 Thread Stephen J. Butler
On Mon, Jan 16, 2012 at 12:30 AM, Gideon King gid...@novamind.com wrote: Are there any recommendations on the best approach for being able to have the setter able to do what it needs with the KVO and then calling other methods, without breaking bindings? I can't believe I have misunderstood

Re: Carousel - like control for Mac OS

2011-12-21 Thread Stephen J. Butler
On Tue, Dec 20, 2011 at 3:00 PM, Nick eveningn...@gmail.com wrote: Hello I am wondering, if a component exists similar to this http://www.ajaxdaddy.com/demo-jquery-carousel.html for Mac OS. Basically, what I need is just next and previous buttons (and these images smoothly scrolled one

Re: Locks

2011-12-06 Thread Stephen J. Butler
On Tue, Dec 6, 2011 at 9:07 PM, koko k...@highrolls.net wrote: I did come across OSAtomicIncrementXX … thanks. I cannot use NSLock as this is in a BSD Static lib and I am required to implement as close to windows as possible. So my code looks like below and is isomorphic to the Windows

Re: Validating dictionary strings file

2011-11-20 Thread Stephen J. Butler
On Sun, Nov 20, 2011 at 11:33 PM, Gideon King gid...@novamind.com wrote: Clearly there is some formatting error in the file but it is a rather large file and would take a very long time to manually go through and find the issue - is there some tool available that will tell me where to look in

Re: -dateWithTimeIntervalSinceNow: 64-bits may overflow

2011-10-09 Thread Stephen J. Butler
On Sun, Oct 9, 2011 at 1:51 PM, Jerry Krinock je...@ieee.org wrote: On 2011 Oct 08, at 21:12, Stephen J. Butler wrote: What's wrong with +[NSDate distantFuture]? Nothing.  It's only [NSDate -dateWithTimeIntervalSinceNow:FLT_MAX] which sometimes gives unexpected results. It's not, at least

Re: Mystery of the missing symbol

2011-10-02 Thread Stephen J. Butler
On Sun, Oct 2, 2011 at 7:50 PM, Graham Cox graham@bigpond.com wrote: A user is reporting this error logged to the console when trying to load a plug-in bundle (an iTunes visualizer): dlopen(path to plug-in): Symbol not found: __NSConcreteStackBlock  Referenced from:path to plug-in

Re: Task dispatching

2011-09-13 Thread Stephen J. Butler
On Tue, Sep 13, 2011 at 1:36 PM, Scott Ribe scott_r...@elevated-dev.com wrote: On Sep 13, 2011, at 12:23 PM, Jens Alfke wrote:  The forked process is an exact clone of the original, with its address space copy-on-write, so it’s already up and running without any startup time. Yeah, but about

Re: Custom universal types, but outside an application

2011-09-08 Thread Stephen J. Butler
On Thu, Sep 8, 2011 at 3:21 PM, dvlc...@gmail.com wrote: My problem: this type is not actually defined and used by an application, but by a preference pane. It seems that putting the proper entries in the preference pane's Info.plist doesn't work (or am I missing something ?). What you're

Re: NSTask vmrun

2011-08-05 Thread Stephen J. Butler
On Fri, Aug 5, 2011 at 10:15 PM, Rainer Standke li...@standke.com wrote: args: (    -T fusion,    -gu Administrator,    -gp Admin,    runScriptInGuest,    \/Users/rainer/Documents/Virtual Machines.localized/Windows XP Professional v1.vmwarevm/Windows XP Professional v1.vmx\,    ,    

Re: Symbol not found when compiling MM (ObjC++) file

2011-08-05 Thread Stephen J. Butler
On Fri, Aug 5, 2011 at 9:57 AM, Alexander Hartner a...@j2anywhere.com wrote: Now when I import Logger.h and use it from a Objective C (.m) file everything seems to work great. However as soon I as import it and use it from a Objective C++ (.mm) file I get the following link error: Ld

Re: Running Cocoa from a dynamic library

2011-07-28 Thread Stephen J. Butler
On Thu, Jul 28, 2011 at 1:14 PM, Jens Alfke j...@mooseyard.com wrote: On Jul 27, 2011, at 8:02 AM, Guido Sales Calvano wrote: Ogre3D however, uses a cocoa window to render on, and obviously I want user input. But if I start ogre in a dynamic library ui events register incorrectly. It’s not

Re: drawRect not getting called when needed under OS X

2011-07-24 Thread Stephen J. Butler
On Sat, Jul 23, 2011 at 11:33 PM, Tom Jeffries tjeffries@gmail.com wrote: When I run the code that displays the graphics in question on initialization it works fine, but when I call it later in the program it the new graphics are not displayed.  The code in the graphics module that displays

Re: NSTask oddity with getting stdout

2011-07-24 Thread Stephen J. Butler
On Sun, Jul 24, 2011 at 10:17 PM, Scott Ribe scott_r...@elevated-dev.com wrote: I'm using NSTask to run a background process, monitor its output, and ultimately present a message to the user. All has been fine with this 10.2 through 10.6, as far as I know. Now under 10.7 I saw a case where my

Re: Writing global preferences file into /Library/Preferences (OS X Lion)

2011-07-20 Thread Stephen J. Butler
On Wed, Jul 20, 2011 at 8:31 PM, Peter C peterchan...@gmail.com wrote: Some of the programs I wrote save a preference file into /Library/Preferences via NSDictionary. This serves as a general settings for all users. Many other 3rd party software (Skype, Microsoft and etc) saves preferences

Re: getting last accessed date

2011-07-07 Thread Stephen J. Butler
On Fri, Jul 8, 2011 at 12:31 AM, Scott Ribe scott_r...@elevated-dev.com wrote: On Jul 7, 2011, at 11:19 PM, Rick C. wrote: One more note, seems in terminal stat aFile works so I suppose I could use nstask to do this as well? It does seem odd that the two would produce different results...

Re: Why Wasn't Memory Collected?

2011-06-11 Thread Stephen J. Butler
On Sat, Jun 11, 2011 at 1:03 PM, Bing Li lbl...@gmail.com wrote:        NSData *data = [xmlDoc XMLData];        NSString *xmlStr = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];        xmlStr = [xmlStr stringByAppendingString:@\n];        const char *xmlChar

Re: How can logging a pointer value cause EXC_BAD_ACCESS?

2011-05-29 Thread Stephen J. Butler
On Sun, May 29, 2011 at 1:30 PM, Jerry Krinock je...@ieee.org wrote: I'm really losing it; or maybe I never understood to begin with.  How can this code crash?      - (void)dealloc      {          NSLog(@0988 %p %s, self, __PRETTY_FUNCTION__) ;          NSLog(@1250 ) ; CRASH-   int

Re: A Simple NSXML XPath Problem

2011-05-28 Thread Stephen J. Butler
On Sat, May 28, 2011 at 9:40 PM, Bing Li lbl...@gmail.com wrote: The XML is pretty simple.    ?xml version=1.0 encoding=UTF-8?    addresses        roadOrange ST/road        aptRM235/apt    /addresses The following code is use to extract the value of the road, Orange ST. In Java, the

Re: What's wrong with this?

2011-05-28 Thread Stephen J. Butler
On Sat, May 28, 2011 at 11:29 PM, Graham Cox graham@bigpond.com wrote: #import UIKit/UIKit.h @class SGBoard;         //-- error: Expected '{' before 'class' @interface GameViewController : UIViewController {        IBOutlet UIView*                mGameView;        IBOutlet SGBoard*

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 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: Use them from only one thread at a time

2011-05-19 Thread Stephen J. Butler
On Thu, May 19, 2011 at 3:56 PM, Sean McBride s...@rogue-research.com wrote: On Thu, 19 May 2011 13:22:32 -0700, Jerry Krinock said: Thread-Unsafe Classes.  The following classes and functions are generally not thread-safe. In most cases, you can use these classes from any thread as long as you

Re: Read-Write Lock is Available?

2011-05-12 Thread Stephen J. Butler
On Thu, May 12, 2011 at 12:44 PM, Bing Li lbl...@gmail.com wrote: I am writing concurrent code. I get used to the read-write lock on other development environment. However, according to the Threading Programming Guide from apple.com, Cocoa does not support the read-write lock? We can use it

Re: @selector signature with two colons instead of actual message name

2011-05-03 Thread Stephen J. Butler
On Tue, May 3, 2011 at 8:49 PM, davel...@mac.com wrote: - (void)noEmailAlertDidEnd:(NSAlert*) returnCode:(NSInteger)retCode contextInfo:(void*)ctxInfo { See it now? - (void)noEmailAlertDidEnd:(NSAlert*) returnCode :(NSInteger)retCode contextInfo:(void*)ctxInfo It's using 'returnCode' as

Re: Xcode 4 auto-importing Objective C categories from static library

2011-04-23 Thread Stephen J. Butler
On Sat, Apr 23, 2011 at 3:36 PM, Bradley S. O'Hearne br...@bighillsoftware.com wrote: Since transitioning to Xcode 4, I have discovered a very curious shift in the way Objective C categories are handled in static libraries. In general, if you create an Objective C category, you have to import

Re: NSString midstring()

2011-04-17 Thread Stephen J. Butler
On Sun, Apr 17, 2011 at 4:08 PM, JAMES ROGERS jimrogers_w4...@me.com wrote: I have stepped this through with the debugger and no flags were raised. The code compiles without an error or a warning of any kind. I am afraid your response has overwhelmed me. You didn't see it in the debugger

Re: Strange property/synthesized accessor behaviour

2011-04-10 Thread Stephen J. Butler
On Sat, Apr 9, 2011 at 9:52 AM, Philipp Leusmann m...@byteshift.eu wrote: Who can explain this behavior to me? Why is oWidth != object.mWidth ? How can that happen? It's an artifact of how Objective-C searches for selector implementations. You're calling @selector(width) on an id, and of

Re: NSString, stringByAppendingPathComponent, and Canonicalization

2011-04-04 Thread Stephen J. Butler
On Mon, Apr 4, 2011 at 10:08 PM, Jeffrey Walton noloa...@gmail.com wrote: I need to accept a filename from the user. Given the user supplied filename, I form a fully qualified name: NSString* pathName = [NSHomeDirectory(), stringByAppendingPathComponent:@Documents]; NSString* fullPathName =

Re: Programming Context Menu

2011-04-04 Thread Stephen J. Butler
On Tue, Apr 5, 2011 at 12:10 AM, Chris Hanson c...@me.com wrote: On Apr 4, 2011, at 12:38 PM, Bing Li lbl...@gmail.com wrote:        if (nil == defaultMenu)        {                @synchronized(self)                {                        if (nil == defaultMenu) Don't do this. I don't

Re: OCTET_STRING_t - NSString?

2011-03-29 Thread Stephen J. Butler
On Tue, Mar 29, 2011 at 12:24 PM, Todd Heberlein todd_heberl...@mac.com wrote: In particular, the beginning of the OCTET_STRING_t's buffer begins with two bytes (decimal values 12 and 21). Am I supposed to skip these? For example, the following code where I skip these first two bytes seems to

Re: OCTET_STRING_t - NSString?

2011-03-29 Thread Stephen J. Butler
On Tue, Mar 29, 2011 at 12:48 PM, Todd Heberlein todd_heberl...@mac.com wrote: In particular, the beginning of the OCTET_STRING_t's buffer begins with two bytes (decimal values 12 and 21). Am I supposed to skip these? For example, the following code where I skip these first two bytes seems to

Re: why I got wrong arguments from command-line

2011-03-29 Thread Stephen J. Butler
On Tue, Mar 29, 2011 at 9:55 AM, Haibin Liu lhb...@gmail.com wrote: NSArray * argvs = [[NSProcessInfo processInfo] arguments];    argvs = (    /Users/sara/studio/client/bin/Debug/Test.app/Contents/MacOS/Test,    -psn_0_2392648 ) The -psn_* argument is added by launch services. You'll have to

Re: Symbol not found

2011-03-16 Thread Stephen J. Butler
On Wed, Mar 16, 2011 at 6:08 PM, koko k...@highrolls.net wrote: A customer running 10.5.8 gets this message when launching my app. Dyld Error Message: Symbol not found: _OBJC_CLASS_$_NSURL Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It Mac Expected in:

  1   2   3   >