What is the best Core Image filter to produce black and white effects?

– (UIImage *)imageBlackAndWhite { CIImage *beginImage = [CIImage imageWithCGImage:self.CGImage]; CIImage *blackAndWhite = [CIFilter filterWithName:@”CIColorControls” keysAndValues:kCIInputImageKey, beginImage, @”inputBrightness”, [NSNumber numberWithFloat:0.0], @”inputContrast”, [NSNumber numberWithFloat:1.1], @”inputSaturation”, [NSNumber numberWithFloat:0.0], nil].outputImage; CIImage *output = [CIFilter filterWithName:@”CIExposureAdjust” keysAndValues:kCIInputImageKey, blackAndWhite, @”inputEV”, [NSNumber numberWithFloat:0.7], nil].outputImage; CIContext *context = [CIContext contextWithOptions:nil]; CGImageRef cgiimage = [context createCGImage:output fromRect:output.extent]; //UIImage *newImage = [UIImage imageWithCGImage:cgiimage]; UIImage *newImage … Read more

NSTextField or NSTextView?

Could someone explain to me what are the main differences between NSTextField and NSTextView? I know that NSTextView has more features and is usually used for longer texts, and NSTextField is usually used for one-line plain text fields, but if I understand correctly, NSTextField can be also used with attributed strings and with multiple lines… … Read more

How well is Objective-C++ supported?

Disclaimer: I don’t work or speak for Apple, so this is my opinion: I can’t speak for the major dev shops, but in my small group, we’ve used Objective-C++ both for integrating C++ libraries, and as you propose for writing backends in C++. As @alxp mentions, things like exception handling across the language boundary are … Read more

Subclassing NSWindowController in Swift and init(windowNibName)

Instead of overriding any of the init methods you can simply override the windowNibName property and return a hardcoded string. This allows you to call the basic vanilla init method to create the window controller. class WindowController: NSWindowController { override var windowNibName: String! { return “NameOfNib” } } let windowController = WindowController() I prefer this … Read more

Using frameworks in a command line tool

Unfortunately, there is no way to bundle a framework with a command-line Utility in OS X and I suspect that the framework you’re linking to is expecting to be bundled in the app bundle’s Frameworks/ directory. If you have access to the framework source code, you can compile a static library and statically link it … Read more

CoreFoundation vs Foundation

In a technical sense, yes, it is faster, for exactly that reason. In a practical sense, no, it’s not faster. For one thing, the speed difference is tiny. We’re talking milliseconds saved over the life of the entire process. The savings might be bigger on the iPhone, but it’s still pretty much the tiniest speed … Read more

How to register user defaults using NSUserDefaults without overwriting existing values?

From the documentation for -registerDefaults: (emphasis added): The contents of the registration domain are not written to disk; you need to call this method each time your application starts. You can place a plist file in the application’s Resources directory and call registerDefaults: with the contents that you read in from that file. So your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)