" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi

How to access mutable (non-const ) data type values from CFArrayRef

Posted on November 23rd, 2015 by Mithlesh Jha

Is accessing mutable type values from the CFArrayRef a straightforward task ? No! it is not as simple as it is for non-mutable types. Background The CFArrayRef is the standard collection provided by the core foundation framework. This framework also provides the functions to create/query/manipulate the array. One such function has the following prototype. const […]

How to store C++ object pointers in Core foundation’s ordered collections like CFMutableArrayRef, CFMutableDictionaryRef.

Posted on November 23rd, 2015 by Mithlesh Jha

We create a new mutable array object using the function CFArrayCreateMutable which has following signature: CFMutableArrayRef CFArrayCreateMutable( CFAllocatorRef allocator, CFIndex capacity, const CFArrayCallBacks* callBacks);    Where the first parameter gives the type of allocator used to allocate memory for this array, second gives its capacity and third parameter is a pointer to CFArrayCallBacks structure which […]

How to check whether the current user is Administrator or not on Mac using Cocoa.

Posted on November 23rd, 2015 by Hem Dutt

There could be a  scenario in which a application would need to know whether the user is Admin or not, before or after startup to allow/block user from using it’s certain functionalities. To achieve this kind of “Authorization” we need to ask user about his account password and check it against his username. To do […]

Filtering colors from images and creating a new image from filtered color

Posted on November 23rd, 2015 by Hem Dutt

Suppose we need to show the effect of only the red component of it’s color on the image, Then this can be done by reading all the pixels of that image and extracting and applying only the red color on all pixels. The other color components i.e blue and green will be filtered out and […]

How to create folder in desktop using “Perform Apple Script” in MAC

Posted on November 23rd, 2015 by Elishree Dey

How to create a folder in desktop both in MAC and Windows must of us know, here I am not changing any thing to create a folder to desktop for Windows(its throught SendEvent Command line code). But we can also write one line to “Perform Apple Script” for do shell or terminal window command and […]

How to detect and identify mounted and unmounted USB device on Mac using Cocoa

Posted on November 23rd, 2015 by Hem Dutt

There could be a situation in which we have to notify the application about mounting and un-mounting the USB and also to identify the USB i.e on which path it is mounted, what is the type of USB e.g I-Pod, I-Phone , Pen Drive etc. 1. To get the notification for mounting and un-mounting  of […]

Tracking dependencies of a library in Mac

Posted on November 23rd, 2015 by B.Vinoth Raj

otool is a command-line tool shipped with Xcode and can do things similar to Dependency Walker in Windows. Where is it located? /Applications/Xcode.app/Contents/Developer/usr/bin How to use it? For instance, to know all the dependencies of libcurl dylib the following can be done: cd to /Applications/Xcode.app/Contents/Developer/usr/bin $ ./otool -L /usr/lib/libcurl.dylib Result:   /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, […]