Friday, May 30, 2014

Formatted String to JS Date

From this snippet, decided to use the same inspiration to demo my date conversion function I wrote. It converts dd-MMM-yyyy String to a javascript date:

<!DOCTYPE html>
<p id="demo"></p>


   ddMMyyyyToJsDate = function(input){

// with ddMMMyyyy passed of  '30-May-2014'
var parts = input.match(/^(\d\d)-(\w{3})-(\d{4})$/);
                // parts[0] is '30-May-2014' , parts[1] is 30 , parts[2] is 'May' , parts[3] is 2014 ,
if((parts == null) ||(parts.length != 4)){
return "Invalid Date";
//  converts 'May' to 4
var MMM = "JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(parts[2]) / 3  ;
//  verify year of 2014 is 4 digits
if(parts[3].length != 4){
return "Invalid Date";
// verify  day is between 1 and 31
if((parts[1] < 1) || (parts[1] > 31)){
return "Invalid Date";
// pass in 2014, 4, 30
return new Date(parts[3], MMM , parts[1]); // months are 0-based

x = ddMMyyyyToJsDate ('30-May-2014') ;

elem = document.getElementById("demo"); // Find an element
elem.innerHTML = x;                     // Display x in the element

var x; // Declare x

var ddMMyyyyToJsDate ; // Declare converter



Thursday, May 22, 2014

Triangular Meetup May 2014

I went to the Tri-angular meetup and learned about the mean stack (Mongo-Express-Angular-Node). This was held at Ignite Social Media hosted by Darrough West and Keith Morgan.

There is and . It was suggested its easy to obtain it and get it built just using the node package manager (npm install).  The io one is better choice  as it has an SLA, but they are both pretty similar. However, it is rapidly changing and it does not have a released version.

Passportjs is baked in.

They host their projects on Heroku with MongoHQ.

Koa was mentioned as the "next" express.

Angular and node each have their own routing, but Angular routing invokes the Node routing.

Angular boiler plate was mentioned.

Suggestions with angular:
Try not overload scope, Template cache helpful

Html5 polyfill, respond.js for dealing with ie8

Do not put JQuery in controllers

Promises built in

Factories for http calls

Providers are fancy plugins

No need for undersore, but people like the map/reduce functions

lo-dash a underscre alternative

meteor use on sockets

mention of mongoose

Related post.

Tuesday, May 20, 2014

Angular 101

I am finally getting around to experimenting with Angular. By now you have probably have seen the 20ish minute talk,   or learn it in one day .  But, the first talk I went to on Angular was with The Google Development group here in Triangle last year.

Here is Kyle's sample which I partially modified:

Sample html:
 <div id="tab1EnhancedAddCmts" ng-app="NowPlaying">
                  <div ng-controller="MyCtrl">
                  <input type="text" ng-model="username">
                 <h1>Hello {{username}}</h1>
                <h2>My Favorite Libraries</h2>
              <ul><li ng-repeat="library in libraries">{{library}}</li></ul>
             <button ng-click="doSomething()">Click Me!</button>

Sample javascript:
<script language="javascript" src="appcontent/js/libs/angular/1.2.16/angular.min.js"></script>

<script type="text/javascript" language="javascript">
var app = angular.module('NowPlaying', []);

app.controller(‘MyCtrl’, ['$scope', ' NowPlayingSvc',
       function($scope,    NowPlayingSvc) {
            $scope.doSomething = function() {



        $scope.username = 'Kyle Buchanan';

        $scope.libraries = NowPlayingSvc.libraries;

app.factory('NowPlayingSvc', [
       function() {
            return {
                     libraries: [


More info:

Sunday, May 11, 2014

My first cocoa conf in links

Solomon Klein was the host of the CocoaConf Mini Raleigh 2014 [eventifier] .

Mike Rundle  [of] spoke on Making world class animations.

The mention of the book : "The illusion of life"-  A book on 12 basic principles with Disney for hand drawn animations but they apply to today.
  • squash and stretch - most important, weight and flexibilty to objects, keeping form as go smaller
  • anticipation - prepare audience its more realistic. i.e. ballet dancer action before it happens 
  • follow through - antenna on a car , hair continues to move at stop 
  • slow in and out - easing out 
  • arcs trjectory - animations can adhere to this. being thrown arcs being shown prior thrw 
  • secondary action - more life, lively 
  • appeal - vibrant 
  • transition - 2 visual states (dont just throw you into it)
  • focus - direct user attention (recent updated, eyes move)
  • delight interaction more appealing
Uikit Dynamics - llustrates the use of UIKit Dynamics for adding physics-related capabilities to views and other dynamic items.

JNWSpringAnimationDemo - generate steps

Facebook pop - paper (& Our Choice All Gore App did animation) figures out values PopSpringAnimation - initial velocity from gesture basement menu, hamburger menu

iBeacon - announced last year wwdc
- bluetooth spec - hw device acts like a beacon
- api

unique identifier - 16 byte
major id - 2 byte
minor id - 2 byte  (thing within store)
measured power -  1 byte what signal decibals 1 meter away from beacon

applications: retail, interactive guides

hardware criteria - readily available, production ready, configurable easily, acceptable enclosure,

jan 2014 spec was not out.

Estimotes  - in biz before announced, made them match apples 3 for 100 bucks, nice and apple looking like , minimal sticky surface on bottom, extra sensors with accelerometer and temp - fixed uuid identifier for all, battery not replaceable, sdk
Roximity beacons - plain, battery replaeable, fixed uuid, sdk, retail platform  with web dashboard and their app.
bleu station - not battery w usb , plain beacon implementation, app comes with it
kst particle - comes with an app, blue tooth explorer app,
ios device ios4 +

region monitoring
create CLBeaconRegion uiid , major (optional), minor (optional)

specify notification desired (entry,exit, entryOnDisplay)

region = [[CLBeagonRegion alloc] nitWithProximityUUID: uuid major: x minor:y identifier :@"something)


locationManager setDelegate




region monitoring works in background continues even if app is shut down force quit, phone restarted

has no notion proximity - sees it or it doesnt

low energy fine, but alot of beacons around not so much

ranging beacons
- list of beacons it sees and how far to these
- ranging


this is foreground only

proximity - unkown, immediate , near, far

Core Data Done Right -

not a database, model editor sucks

moGenerator - - command line tool

UITable View, also a controller delegate
sections, fetched objects NSFtechRequest
As far as upgrading apps, certain actions forec migration in xcode
ios introduced parent, child thing, old way was a background thread where you had to listen, now go to child and it tells parent when to update (core data not thread safe), throw context away if decide to cancel

rob rhyne

stats against you making a living on an app. Shoot for middle

Find your niche or perspective on world

Dave smith episode 132 

Feed wrangler

Talk about it, share it with others, sneak peak , you are special keep going

UIKit Dynamics

Physics light



Multipeer connectivity

Adhoc network iOS devices

AirDrop example

- peer id


Everybody equal, nobody acts as server

@import MultipeerConnectivity


WWDC talk 708 - Nearby Networking with Multipeer Connectivity

Jay Thrash

Ken Auer


Aza Raskin You are iterating solution as well as understanding problem 

Small fidelity and medium fidelity

Validate understanding and find real requirements


Method swizzling

Framework7 -CSS like ios7 screens

Objective cloud


James Dempsey

Makeover ios7

Worked apple 96 for 15 years


Beats big. News

Table view


Clicked upgrade

Extended edges  lose translucency 

Adjust scroll view insets can't get to top

Want those turned on

Label with style subtitle

Look at system apps

Dynamic type ... Tuned system fonts lighter on bigger font

User control text content size  7 settings relative not how big font is
Like t shirt sizes

Semantic txt styles. 6 constant headline, body, sub headline , footnote, caption on fonts

UI Font API 


Change size does not update  in settings

UIApplication property

App would have to code for it been though settings on interface builder

Notification methods


Relative simple table, keep it simple
variable row heights
Add extra cell use sizethatfits

Or defer height calculation until display


Dynamic type disasters

Saul Mora

Worked on
KVO Key value Observer : key paths we are watching for (avoid ton of if statements)

Parse API

ResponderChain - chain whebey it bubbles up - AppDelagate part of responder chain. Note that can't use responder unless on screen.

Don't put logic ViewController , put logic (to class) as a property in App delegate. Whereby, sned message from controller to invoke logic.

Class Cluster - reassign self

Dynamic KVO Handler method:

Bill Bumgarner

Tuesday, May 6, 2014


I will be attending the CocoaConf Mini Raleigh 2014  at the Wingate by Wyndham  (6115 Corporate Ridge Road) .

The conference is on twitter   ( @CocoaConf  ) and Glassboard

CSS Box Model

padding-left:12px ;
border-bottom: 1px solid #ccc;