Not blocking the UI with FMDB Queue

Not blocking the UI with FMDB Queue xCode 7.3 concept demo So notifications are coming in rapidly…each one is a thread, and the threads’s data are getting inserted into your FMDB. Your FMDB ensures thread safety because FMDB’s queue uses dispatch_sync: FMDatabaseQueue.m

It gets the block of database code you pass in, and puts […]

Using Cocoapods

ref – http://stackoverflow.com/questions/23755974/cocoapods-pod-install-takes-forever How to install CocoaPods and setup with your Xcode project https://www.raywenderlich.com/156971/cocoapods-tutorial-swift-getting-started Install cocoapods First, install pod:

The verbose option logs progress as the process runs, allowing you to watch the process instead of seeing a seemingly “frozen” screen.

Note: If you have previously installed pod and want to do a […]

instance variable strong references?

ref – http://stackoverflow.com/questions/16461343/ivars-references-strong-weak-or-what Default behavior of instance variable Instance variable maintains a strong reference to the objects by default Why don’t we specify weak/strong for iVar like properties? Local variables and non-property instance variables maintain a strong references to objects by default. There’s no need to specify the strong attribute explicitly, because it is the […]

Function Objects, and closures (javascript)

Function definitions

Use new to create instances, you are having objects returned to you.

Thus, the objects would be referenced by t1 and t2. If you were to access property name, you’d get the results: t1 this.name – Test1() – hooray works! public and private this.property is public. var properties are private.

[…]

Function Constructor, Prototype, and mix

ref – http://a-developer-life.blogspot.com/2011/11/7-ways-to-create-objects-in-javascript.html Creates a Person object, which has attribute name, and function getName.

The constructor pattern is compact, reusable and gives a classical OO syntax. However, here’s the problem: In our example the field getName is a function. In Javascript functions are objects. Thus, 10 object will have 10 function. And this means […]

attach functions to objects

First declare your objects

Then you declare a function…

You can literally attach functions to objects like so:

Where the function uses ‘this’ to access the calling object’s attributes. Using them like this:

would give: name is: gary, age is: 25 name is: ricky, age is: 35

‘this’ in function, and in object

this is not part of the closure scope, it can be thought of as an additional parameter to the function that is bound at the call site. If the method is not called as a method then the global object is passed as this. In the browser, the global object is identical to window. For […]