Sunday, June 15, 2014

Storyboard and Segue

On interface builder, it almost looks like 2 nibs same time with transition in middle (known as segue) .
You specify in code what you want to make happen. On the right side of scene you can see transition details : identifier: ShowAlternate, type is Modal, FlipHorizontal. There is an action on button inform Destination Controller that delegate will be self

src3.pdf on page 32:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
if ([[segue identifier] isEqualToString:@"showAlternate"]) {
[[segue destinationViewController] setDelegate:self];


with storyboard you can have multiple views on a same board. It introduces segues. Segues represent transitions between screens. Opening a storyboard and your have pretty good idea of the UI flow at a glance.

Tuesday, June 10, 2014

Javascript hoistology

Scope and Hoisting explained
  • Unlike most programming languages, JavaScript does not have block-level scope
  • Variables have either a local scope or a global scope.
  • If you don't declare your local variables with the var keyword, they are part of the global scope
  • All variables declared outside a function are in the global scope. In the browser, which is what we are concerned with as front-end developers, the global context or scope is the window object
  • a variable is initialized (assigned a value) without first being declared with the var keyword, it is automatically added to the global context and it is thus a global variable
Only functions create new scope

JavaScript Declarations are Hoisted - variable used before its declared. JavaScript Initializations are Not Hoisted -
If a value is enumerable, it will show up when enumerating over an object using a for(prop in obj) loop. If a property is writable, you can replace it. If a property is configurable, you can delete it or change its other attributes. 
var person = Object.create(null); 
Object.defineProperty(person, 'firstName', { value: "Yehuda", writable: true, enumerable: true, configurable: true });

The propertyIsEnumerable method returns true if proName exists in object and can be enumerated using a ForIn loop. The propertyIsEnumerable method returns false if object does not have a property of the specified name or if the specified property is not enumerable. Typically, predefined properties are not enumerable while user-defined properties are always enumerable. The hasOwnProperty method returns true if object has a property of the specified name, false if it does not. This method does not check if the property exists in the object's prototype chain; the property must be a member of the object itself.

Every function has these methods you can call (Object.getOwnPropertyNames(Function.prototype)):
  • toString
  • call
  • apply
  • length
  • name
  • arguments
  • caller
  • constructor
  • bind

Saturday, June 7, 2014

Linkery from WWDC 2014

The WWDC keynote - analysis  (

Note that at the 1:43 mark is when Swift is mentioned:
  • xcode 14 million downloads
  • objective  C has served for 20 years, but what if we did it without baggage of C - "did more than think of it"
  • swift - fast, modern, interactivity
  • type inferences, closures, generics, multiple return types, name spaces
  • native to cocoa same lvm compiler, same arc memmory management, same run time
  • work beside objcective C in same application
  • Use of "playgrounds" within Xcode - running code as you write it showing sidebar, can see imagefunctional - closure  on array elements
  • language guide (Swift eBook) and reference implementation available

Swift Kick in Head
  • Swift is like JavaScript in that a line break is enough to mark the end of a statement, and ending them with semicolons is optional
  • Swift associates types with variables. The compiler infers the variables’ types from the values assigned to them
  • Int, Float, Double, Bool, (whose values are true and false as opposed to Objective-C’s YES and NO) , String - forcing a Float type for what could be a double if type not specified -  var someValue:Float = 3.0
  • function definition example: func circleArea(circleRadius: Double) -> Double
Getting started with Swift

swift programming language intro

  • Playgrounds that allow you to experiment Swift and see the result in real-time. In other words, you no longer need to compile and run your app in the Simulator. As you type the code in Playgrounds, you’ll see the actual result immediately without the overheads of compilation.
  • Swift allows you to use nearly any character for both variable and constant names. You can even use emoji character for the naming
  • strings are represented by the String type - Whenever you assign a string as variable (i.e. var), the string can be modified in your code
  • Swift allows you to compare strings directly by using the == operator
  • Objective C you use the addObject: method of NSMutableArray to add a new item to an array. Swift makes the operation even simpler. You can add an item by using the “+=” operator
  • Swift only provides two collection types. One is arrays and the other is dictionaries.
  • You can define classes in a single file (.swift) without separating the external interface and implementation
  • Swift requires you to provide the default values of the properties or a ?.

Swift for scripting

Swift Flappy birds four hours

The Alt Conference -

Casa De Mora

Adding Juice

Cloud services

Friday, June 6, 2014

Javascript this and call that

The essentials video on 'this' says: " this refers to owner of the function we are executing or to the particular object the function is a method of."

Here is one of simplest programs but it demonstrates the 'this' in two different uses:
var MyFunction = function () {

var obj = new MyFunction();

From each of the invocations, the two console outputs look like this:

Now, we have added a local function tryme() to MyFunction(). Again, it starts out by executing line 35 without a variable defining it.

Since tryme() gets invoked without a variable assigned to it, we get the global this object. Likewise, when MyFunction() is invoked without a variable assigned to it, we get the global object.

Then, with a var obj getting  new MyFunction(), we have MyFunction owner of this, but inside tryme we get default value of this (i.e. window)

Now on to prototypes , its is an object in which other objects inherits properties.
Note that every object has a __proto__ in the debugger. Here is what it provides:

The prototype says if i do not have the property or method that is being requested, go to the 'object' that this field references and look for it.

After highlighted line executes displaying f

Here we refdefine the class and instead have a prototype method for setName:
var MyFunction = function () {
this.first = 'chris';
this.last = 'cross';

var f = new MyFunction();
MyFunction.prototype.setName = function (_first, _last) {
 this.first = _first;
 this.last = _last;

f.setName('cross', 'court');

First: (FROM

This value at line 54 before executing the call (global object of window):

Then we step into call at line 54:

the output of line 58 with the hello for property2 (the populated this as the passed in method):

throw is executed on line 49 which is caught on line 57, line 63 is next function called and this from line 61 has global object:


var MyFunction = function (name, color ){
   var b =  {
    MyFunction('ipod', 'black');

"call method: method of a function invokes the function with the context variable this set to the first argument passed in, and then each additional argument is passed into the function"

MyFunction('ipod', 'black');, 'ipod', 'black');

"apply method:invokes the function with the context variable this set to the first argument passed in. The second and final argument, however, will end up being the arguments of the function provided as an array"


Thursday, June 5, 2014


Azure sure is making a name for itself. Here is the Azure 101 , azure overview

mobile services with iOS
Tutorial shows you how to add a cloud-based backend service to an iOS app using Azure Mobile Services

Notification Hubs

Azure Notification Hubs makes it easy to either add push notifications to existing iOS apps or enhance your current push strategy, regardless of where your app backend is hosted or what language it's written in. 

Few folks with iBeacon experiences

How i tracked house movements...
Next, I wanted to see if I could track movements in my own house as a simple test, without creating a custom app. I looked for a few apps that could detect the iBeacons and execute an action. There are a few apps capable of doing this – all of them somewhat limiting. The only app I found that allowed me to control what happens when triggering an iBeacon was an app called Placed.
Coding for iBeacons
One limitation iOS has, versus OS X and Android, is the inability to listen for iBeacon regions indiscriminately. The application must explicitly request monitoring for each and every UUID it is interested in hearing about. This is no doubt better for the user’s battery, but isn’t really spelled out clearly in the docs.

Monday, June 2, 2014

WWDC sampling from interwebs

The Keynote...

The  musical

HealthKit , Cloud, ...

Chris "For now, it’s going to be able to live alongside existing Objective-C code however, I fully expect that it’ll become the standard; either from developer adoption or by Apple eventually forcing everyone to use it"

iOS8 Family Sharing, et al..

Mac 10.10 Yosemite:

  • Improved Notification Center 
  • Improved Spotlight - can also show additional info from the Internet as well as third-party applications
  • SMS and call support
  • meshed iOS and Mac OS X into one
  • iCloud Drive with sharing
  • you annotate and scribble on images or PDF files without third-party sw
  • Safari smart search field and suggestions, along with improved tabbing
  • sync files and communications between the mobile and desktop OS with handoff

iOS 8 and Yosemite available for developers

Swift : [integration guide]

Keynote live blog

iOS8 news

Home automation

New photos app iOS8

Family sharing