Mixing C# with Objective-C

There is, obviously, no such language as C++/CLI on Mac OS. On Windows, C++/CLI actually compiles as managed code ran by the CLR, that runs native code; since on Mac OS Mono isn’t integrated to the system, it’s rather the other way around. Your app is native, and it can host managed code. Mono exposes … Read more

Is it possible to turn on/off “do not disturb” for OS X programmatically

Unfortunatelly (yet unsurprisingly), there’s no public API for dealing with user’s notifications preferences, one of which is Do Not Disturb mode (DND). Nevertheless if your want to provide the feature of turning DND on and off in your application, you’re not out of luck actually: there’re three ways for you to choose from. #1. Run … Read more

What is the right choice between NSDecimal, NSDecimalNumber, CFNumber?

If you are dealing with financial computations, you really should use base-10 arithmetic to avoid the rounding errors that can occur with the standard base-2 floating point types. So it’s either NSDecimal or NSDecimalNumber. And since you’re writing object-oriented code, NSDecimalNumber is the right choice for you. To answer your questions: only testing of your … Read more

Unique Identifier of a Mac?

Apple has a technote on uniquely identifying a mac. Here’s a loosely modified version of the code Apple has posted in that technote… don’t forget to link your project against IOKit.framework in order to build this: #import <IOKit/IOKitLib.h> – (NSString *)serialNumber { io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(“IOPlatformExpertDevice”)); CFStringRef serialNumberAsCFString = NULL; if (platformExpert) { serialNumberAsCFString … Read more

The new enum in Objective-C

Because this new way helps you with autocompletion, switch statement, better, respectively more precise warnings, … Stick with macro … typedef NS_ENUM( NSUInteger, CarType ) { FourDoorCarType, TwoDoorCarType }; … read this for example https://stackoverflow.com/a/3190470/581190 NSInteger, … what types do you want?

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