Skip to main content

Posts

Showing posts from April, 2014

Xcode and iOS programming

A digest of reading book 'iOS Programming - Big  Nerd Ranch'

#What Is a Framework?
A framework is a type of bundle—a directory hierarchy with a specified layout that
groups shared dynamic libraries, header files, and resources (images, sounds, nib files) in a
single place.

#Core Foundation
Core Foundation is a low-level C language framework that (partially) parallels the
Objective-C Foundation framework. It defines data types and provides services that are
used by many of the other C language frameworks

#Toll-Free Bridging
Some Foundation classes have a memory layout that is almost identical to the memory
layout of the corresponding Core Foundation class. For these classes, a pointer to the
Foundation object can be used as a reference to the corresponding Core Foundation
object and vice versa. All you need is the appropriate cast. Apple calls this feature toll-free
bridging.
e.g.
// Create an NSString
NSString *nsString = @"Toll-Free";
// Cast nsString to a CFString and…

The concepts in Objective-C

The digest  from book 'Learning Objective-c 2.0" and http://qs4int.blogspot.ca/2013/01/v-behaviorurldefaultvmlo.html

# Expressions and Statements
Expressions and statements in C are the equivalent of phrases and sentences in a natural
language. When you add a semicolon (;) to the end of an expression, it becomes a statement.

Expression  could be: a+10
Statement could be: int v  = a+10;
Other example like:
if ( expression )
statement1
else
statement2

for (expression1; expression2; expression3) statement

#Pointers
A pointer is a variable whose value is a memory address. It points to a location in memory.


#typedef
The typedef declaration provides a means for creating aliases for variable types:
typedef float Temperature;
Temperature high, low;

#define
#define is used for textual replacement. The most common use of #define is to define
constants, such as:
#define MAX_VOLUME 11

# Preprocessor directives
#include and #import do essentially the same thing: request that the preprocessor r…

(iOS) dispatch_async() vs. NSOperationQueue

source: http://stackoverflow.com/questions/11676629/ios-dispatch-async-vs-nsoperationqueue NSOperation* classes are the higher level api. They hide GCD's lower level api from you so that you can concentrate on getting the task done. The rule of thumb is: Use the api of the highest level first and then degrade based on what you need to accomplish. The advantage of this approach is that your code stays most agnostic to the specific implementation the vendor provides. In this example, using NSOperation, you'll be using Apple's implementation of execution queueing (using GCD). Should Apple ever decide to change the details of implementation behind the scenes they can do so without breaking your application's code.
One such example would be Apple deprecating GCD and using a completely different library (which is unlikely because Apple created GCD and everybody seems to love it). Regarding the matter i recommend consulting the following resources: http://nshipster.com/nsoperati…

Good understanding about strong and weak property attributes

source: http://stackoverflow.com/questions/7912555/weak-and-strong-property-setter-attributes-in-objective-c Here is information what I know about variable properties atomic //defaultnonatomicstrong=retain //defaultweakretainassign //defaultunsafe_unretainedcopyreadonlyreadwrite //default so below is the detailed article link where you can find above mentioned all attributes, that will defiantly help you. Many thanks to all the people who give best answers here!! Variable property attributes or Modifiers in iOS 01.strong (iOS4 = retain ) - it says "keep this in the heap until I don't point to it anymore" - in other words " I'am the owner, you cannot dealloc this before aim fine with that same as retain" - You use strong only if you need to retain the object. - By default all instance variables and local variables are strong pointers. - We generally use strong for UIViewControllers (UI item's parents) - strong is used with ARC and it basically helps you , b…

Regarding IOS declared property attributes

nonatomic vs. atomic - "atomic" is the default. Always use "nonatomic". I don't know why, but the book I read said there is "rarely a reason" to use "atomic". (BTW: The book I read is the BNR "iOS Programming" book.)

readwrite vs. readonly - "readwrite" is the default. When you @synthesize, both a getter and a setter will be created for you. If you use "readonly", no setter will be created. Use it for a value you don't want to ever change after the instantiation of the object.

retain vs. copy vs. assign

"assign" is the default. In the setter that is created by @synthesize, the value will simply be assigned to the attribute. My understanding is that "assign" should be used for non-pointer attributes.
"retain" is needed when the attribute is a pointer to an object. The setter generated by @synthesize will retain (aka add a retain count) the object. You will need to release the object …

Write Code Every Day

The article is from http://ejohn.org/blog/write-code-every-day/

Below is the  key sentences,
I must write code every day. I can write docs, or blog posts, or other things but it must be in addition to the code that I write.It must be useful code. No tweaking indentation, no code re-formatting, and if at all possible no refactoring. (All these things are permitted, but not as the exclusive work of the day.)All code must be written before midnight.The code must be Open Source and up on Github.

Spring Boot Project

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that can you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration. FeaturesCreate stand-alone Spring applicationsEmbed Tomcat or Jetty directly (no need to deploy WAR files)Provide opinionated 'starter' POMs to simplify your Maven configurationAutomatically configure Spring whenever possibleProvide production-ready features such as metrics, health checks and externalized configurationAbsolutely no code generation and no requirement for XML configuration The reference guide includes detailed descriptions of all the features, plus an extensive howto for common use cases.