Parent class creating Child Class Instance

http://stackoverflow.com/questions/8916351/objective-c-alloc-child-class-from-parent-and-use-parent-class-instance-varria demo The Problem The problem started when I was looking at NSURLSession’s dataTaskWithRequest:theRequest method.

dataTaskWithRequest returns an instance of NSURLSessionDataTask, which is a child class of NSURLSession.

Usually, in objective c, a class has an address. It instantiates another object (in the heap), which has a different address. But how does a […]

mutex vs semaphore

http://stackoverflow.com/questions/62814/difference-between-binary-semaphore-and-mutex https://en.wikipedia.org/wiki/Race_condition Mutex: Is a key to a toilet. One person can have the key – occupy the toilet – at the time. When finished, the person gives (frees) the key to the next person in the queue. Officially: “Mutexes are typically used to serialise access to a section of re-entrant code that cannot be […]

HTTP request using iOS

Example 1 – pass data using Header fields On the server side, the receiving script will strip the information from the request object and use the data, query the database, and return it. On our iOS client side, we create a NSURL object that takes in the string of the web api address that we […]

Custom UIPickerView example

ref – http://stackoverflow.com/questions/3061401/respondstoselector-not-found-in-protocols CustomPickerEx Description We are going to create a custom UIPickerView. This Picker View get the string of your selection, then send the delegating class the result. Hence a UIViewController can create this custom class, conform to the protocol, connect the delegate, and start receiving strings of the selected entries in the picker […]

Mac: Install MySQL and use Terminal to use it

ref – http://www.cyberciti.biz/faq/mysql-command-to-show-list-of-databases-on-server/ Determine Kernal bit 32 or 64 for Mac See whether you have the 32 or 64 bit processor Go download the mysql dmg file from mysql’s developer page: http://dev.mysql.com/downloads/mysql/ Locate the DMG file compatible for your machine and download it Let’s double click on the .dmg file, and double click the .pkg […]