Sunday, December 29, 2013

Beaconville

The technology that still works even if cell signals are blocked ( i.e.  cell phone jamming ) is Beacon or  iBeacon (apple) :

"They are poised to transform how retailers, event organizers, transit systems, enterprises, and educational institutions communicate with people indoors. Consumers might even want to deploy them as part of home automation systems ."

With iBeacons :

"companies will be able to provide deals to people that are walking past their stores. But for now, iBeacon will simply help people that are already inside an Apple retail location." [more]

Payments - Proxima Wallet :

"On the user’s side, there is no physical credit card to take from your wallet; you do everything in the app. On the vendor’s side, there is no card reader that needs to be plugged into your phone; the iPhone itself, as you bought it, is the cash register. No swiping required"

'you’re able to get an approximate range in terms of distance to the beacon,” Nolan says. “So you join the queue to buy something from the vendor and when you get to the top of the queue the vendor can take your order, which is all seamlessly handled by the software the vendor uses. You approve the purchase and the entire communication is handled securely over the multipeer APIs Apple shipped in iOS 7, and proxied through the vendor’s device if your device does not have a currently responsive Internet connection'

Thursday, December 26, 2013

Javascript has landed in iOS


https://github.com/node-app/Nodelike : "implement a roughly Node.JS-compatible interface using JavaScriptCore.framework on iOS 7 and OS X Mavericks"

http://nodeapp.org/ : "Node.JS interpreter as an iOS app," 

http://blog.bignerdranch.com/3784-javascriptcore-and-ios-7/ : "JavaScriptCore gives developers deep access to the full JavaScript runtime from Objective-C. You can syntax-check and execute scripts, access variables, receive callbacks, and share Objective-C objects, making possible a wide range of interactions."

 http://strongloop.com/strongblog/apples-ios7-native-javascript-bridge/ : "Apple’s iOS7 is the first iOS operating system to officially support JavaScript as a mobile development language in Apples XCode tool chain. Apple’s iOS7 support of JavaScript inline with your Objective-C code validates JavaScript as the leading (and only) non proprietary language that is supported within the iOS development environment by the device manufacturer."

Thursday, December 19, 2013

Ev Williams on what u can do online


The Javascript vs Native facts

http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/

"But the real elephant in the room here is that in all these articles on this subject, rarely does anyone actually quantify how slow JS is or provide any sort of actually useful standard of comparison. (You know… slow relative to what?) To correct this, I will develop, in this article, not just one useful equivalency for JavaScript performance–but three of them. So I’m not only going to argue the “traditional hymns” of “wa wa JS is slow for arbitrary case”, but I’m going to quantify exactly how slow it is, and compare it to a wide variety"...

Sunday, December 1, 2013

Node.js school


http://nodeschool.io/
>npm set http-proxy https://http.proxy.test.com:8000 --global
>npm install -g learnyounode
>learnyounode
>learnyounode select hello world

Write a program that prints the text "HELLO WORLD" to the console (stdout).

HINTS: To make Node.js program, create a new file with a `.js` extension and start writing JavaScript! Execute your program by running it with the `node` command. e.g.:
Created file1.js:
var http = require('http');
http.createServer(function (req, res) {
       res.writeHead(200, {'Content-Type': 'text/plain'});
       res.end('I Have arrived!\n');
}) .listen(1337, '127.0.0.1');
console.log('Node Server running at http://127.0.0.1:1337/');
>node file1.js
Node Server running at http://127.0.0.1:1337/
I Have arrived!

>learnyounode select my first i/o!

Write a program that uses a single synchronous filesystem operation to read a file and print the number of newlines it contains to the console (stdout), similar to running `cat file | wc -l`.
The full path to the file to read will be provided as the first command-line argument.

HINTS:
To perform a filesystem operation you are going to need the `fs` module from the Node core library. To load this kind of module, or any other "global" module, use the following incantation:
   var fs = require('fs')

Now you have the full `fs` module available in a variable named `fs`.
All synchronous (or blocking) filesystem methods in the `fs` module end with 'Sync'. To read a file, you'll need to use `fs.readFileSync('/path/to/file')`. This method will return a `Buffer` object containing the complete contents of the file.

Documentation on the `fs` module can be found by pointing your browser here:
C:\nodehome\AppData\Roaming\npm\node_modules\learnyounode\node_apidoc\fs. html

`Buffer` objects are Node's way of efficiently representing arbitrary arrays of data, whether it be ascii, binary or some other format. `Buffer` objects can be converted to strings by simply calling the `toString()` method on them. e.g. `var str = buf.toString()`.

Documentation on `Buffer`s can be found by pointing your browser here: C:\nodehome\AppData\Roaming\npm\node_modules\learnyounode\node_apidoc\buf fer.html

If you're looking for an easy way to count the number of newlines in a string, recall that a JavaScript `String` can be `.split()` into an array of substrings and that '\n'. Using this method you'll end up with an array that has one more element than the number of newlines.
var fs = require('fs');
var buf = fs.readFileSync('C:/logs/test.log');
var str = buf.toString();
var newstring = str.split('\n');
console.log('split ' + newstring);
var n = newstring.length -1;
console.log('count in file ' + n);


>learnyounode run file2.js Running "my first i/o!"...

 >learnyounode list

  • HELLO WORLD
  • BABY STEPS
  • MY FIRST I/O!
  • MY FIRST ASYNC I/O!
  • FILTERED LS
  • MAKE IT MODULAR
  • HTTP CLIENT
  • HTTP COLLECT
  • JUGGLING ASYNC
  • TIME SERVER
  • HTTP FILE SERVER
  • HTTP UPPERCASERER
  • HTTP JSON API SERVER





Saturday, November 30, 2013

Javascript Performance Tips and more


Javascript performance tips

Designer tips for performance

Doug Crockford  the "Good Parts" Talks [1] [2]

javascriptjabber with scott hanselman , JSHint

Stack, Queue, Linked List using Javascript

Semextex GUI components

The jiggle effect using Javscsript

Javascript library trends

Javascript Fat arrow

JS implementation of excel like functionality

To Hell with JQuery

http://venturebeat.com/2013/11/08/the-future-of-web-apps-is-ready-isomorphic-javascript/

http://readwrite.com/2013/11/18/assessing-the-aftermath-of-the-html5-hype-cycle

http://blog.kevinchisholm.com/arrays-javascript/javascript-array-management-with-push-pop-shift-and-unshift/

http://coding.smashingmagazine.com/2013/11/21/introduction-to-full-stack-javascript/

http://www.dontfeartheinternet.com/

http://toddmotto.com/ultimate-guide-to-learning-angular-js-in-one-day/

http://coding.smashingmagazine.com/2013/10/29/get-up-running-grunt/

http://www.muleradio.net/thebigwebshow/102/

Some Good iOS7 resources


The site by Ralf Ebert has  some good basic introduction for iOS. Of course, I have to use chrome translate to read it in english.

cocoanetics - You can make any iOS device (>= iPhone 4S) and any Mac (>= late 2011) sporting a BTLE chip into an iBeacon.
An iBeacon is identified by 3 values: proximityUUID, Major and Minor. The first being a UUID and the two latter being two 16 bin integers. You can construct a CLBeaconRegion in 3 levels: only UUID, UUID plus Major, UUID plus Major plus Minor.
AutoLayout - rather than the master / details , gives the ablity to edit details inline

http://nshipster.com/ios7/

http://www.codersgrid.com/2013/10/04/ios7-code-sample-snippets-of-new-functions/

http://www.appcoda.com/uipageviewcontroller-tutorial-intro/

http://maniacdev.com/2013/11/top-ios-development-resources-for-week-ended-november-10th-2013

http://nathanbarry.com/app-design-handbook/#packages $39

http://mobile.smashingmagazine.com/2013/11/22/four-ways-to-build-a-mobile-app-part1-native-ios/

http://www.codelord.net/2013/10/18/adapting-scroll-views-to-ios-7/

http://coenraets.org/blog/2013/09/phonegap-and-cordova-with-ios-7/

http://www.raywenderlich.com/store/ios-apprentice

Saturday, November 23, 2013

Forkin and Pushin

working tree - your unstaged files
index - staged files
snapshot - in source control

git status -s

git log

 see hash of snapshot contents. each commit get new hash, usually can abbreviate hash using first 7 chars of the hash

git show <hash>

git gui

git log --pretty=raw or oneline

https://gist.github.com/ralfebert/515937

git checkout restores the files from the index

git diff 7char1...7char2 or git log -p

git tag labelname1 7char1 gives a tag to a commit

use a branch to create changes seperate from our main changes (i.e. master)

branch is a label to a commit - git branch -v

git branch newfeature creates a branch

switch between branches using git checkout <branchname>

if you are positioned on master you can do git merge newfeaure

gitk can be entered at command prompt

remotes is connection from one git repository to another

git remote -v shows connections

push your master to git hub (i.e. origin) : git push -u origin master

merging happens automatically when pulling from remote

In GitHub , What is a Fork
At some point you may find yourself wanting to contribute to someone else's project, or would like to use someone's project as the starting point for your own. This is known as "forking"
[more]

https://help.github.com/articles/using-pull-requests


Pull requests let you tell others about changes you've pushed to a GitHub repository. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary.
There is the git-flow . See talk

Tuesday, November 19, 2013

Git up and go

Today I took in the Git Foundations training by Tim Bergland at the Witherspoon building (located at 2810 Cates Ave. on the  NCSU campus).  I can confirm if you park at 2815 Cates Ave, you might expect a parking violation warning on your windshield.

http://teach.github.com/presentations/git-foundations.html

On learning about why you have to invoke the add command twice on successive writes to the GIT repository.  why add twice??? three stage thinking (why u add everytime) :

working (tree)  --- edit   ->  
staging (i.e. status tells just YOU add/remove to empty shopping cart) ->
history (commit - together)

On the git log and how to create a git alias  (i.e. git lol)

provides date, author, 40 char commit id
C:\gittrain>git config --global alias.lol "log --graph --decorate --oneline --all"


Learned that branching is giving the "commit you are on" a label. You can only be on one branch at a time, and by default, you are on master 


C:\gittrain>git branch
* master

create a branch
C:\gittrain>git branch feature
\
Now on Branch feature
C:\gittrain>git lol
* 5390c82 (HEAD, master, feature) more books info
* 877cb2e Initial commit

Add file to branch staging
C:\gittrain>git add raven.txt.

Commit file
C:\gittrain>git commit -m "add brnch"
[master 82168b5] more barnch
 1 file changed, 3 insertions(+), 1 deletion(-)

switch to branch 'feature'
C:\gittrain>git checkout feature

Switched to branch 'master'
C:\gittrain>git checkout master

merge feature into master
C:\gittrain>git merge feature - m "merged"

delete feature branch (branch is just name for a commit)

C:\gittrain>git branch -d feature

The transcript of the class can be found here.
http://www.youtube.com/user/GitHubGuides
http://teach.github.com
http://teach.github.com/presentations/
https://github.com/github/teach.github.com
http://training.github.com/web/
http://training.github.com/web/free-classes/
https://github.com/githubteacher

Saw this link today on Git Hub evolution by Zach Holman . Also, a link on effective-git-branching-and-release-management

Friday, November 15, 2013

Javascript Tools Bower, Grunt, Yeoman

bower is a package manager for installing client-side libraries in your server-side environment . This post has a good introduction.
bower is a package manager for client side technologies. It can be used to search , install , uninstall web assets like JavaScript , HTML , and CSS. It is not an opinionated tool and leaves lot of choice to the developers. There are various tools built on top of bower like YeoMan and Grunt
C:\Users\dmbl>npm install -g bower
C:\Users\dmbl>bower

Bower : "offers the opportunity to search for packages you may need in your project (for example,bower search underscore to find Underscore.js) and install them in your project (for example, bower install –save underscore"

Grunt
command line build tool. It can help us automate repetitive tasks. We can think of it as JavaScript alternative to Make or Ant. It can perform tasks like minification, compilation , unit testing, linting, etc.
gruntjs-workflow : "Grunt.js is a fantastic task-based command line tool written in JavaScript on top of the wonderful Node.js platform. You can leverage Grunt.js to script away all of your grunt work"
grunt tasks : "Grunt JS is a task runner, which means it is designed to run tasks for you. It’s your little slave bot, and you can tell it what to do, and when to do it!"

Yeoman
As stated on their website, Yeoman 1.0 is more than just a tool. It's a workflow; a collection of tools and best practices working in harmony to make developing for the web even better
AKA Yo - introduction to yeoman yo


C:\Users\dmbl>npm install -g yo


Related posts:

Intro to Angular, Yeoman, and Chrome Apps (Revised)

Wednesday, November 13, 2013

Node.js under the hood

In ten years of java development, I have mainly been involved with stateless  "pull" technologies:
The term connectionless is also used to describe communication in which a connection is made and terminated for each message that is sent. IP is connectionless as well as stateless.

With Node.js, it is a platform that fills a particular need :

  • don’t want to use Node.js for CPU-intensive operations 
  • Node.js operates on a single-thread, using non-blocking I/O calls
  • capable of handling a huge number of simultaneous connections with high throughput, which equates to high scalability
The main idea of Node.js: use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices.
Now,  that last phrase, Non-Blocking I/O. You will never hear anywhere, from anyone, that Node.js is non-blocking.

Further details:
avoiding the need for OS threads by simply refusing to wait. Rather than making blocking IO calls, wherein the thread stalls waiting for the call to return, almost all IO calls in Node.js are asynchronous, wherein the thread continues without waiting for the call to return. In order to handle the returned data, code in Node.js passes callback functions to each asynchronous IO call. An event loop implemented within Node.js keeps track of these IO requests and calls the callback when the IO becomes available.
It uses event driven concurrency


five talks learn more nodejs

http://www.slideshare.net/royaldark/presentation-28147455

Sunday, November 10, 2013

So it begins, on to NodeJs

I have been hearing for NodeJs for over a year now and I haven't gotten around to learning it. To me, the little I know about it, the value to me is that you don't need a full blown app server to serve up for a pretty straight forward web page. The fact that the code is written in  java script is neither here nor there,  as I can easily learn a new language if that is what is required.  I have been saving this link for a while. The nodejs download page says:
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Within 5 minutes, i am able to execute npm at the command line.
npm -h quick help on  <cmd>
npm -l display full usage info 

npm faq commonly asked questions
npm help  <term> search for help on  <term>
npm help npm   involved overview
C:\Users\dmbl>node
>

Now, that you have reached the node '>' prompt, you can execute any JavaScript code by entering your code in this command line mode. However, you don't have access to everything you do in a web page in command line mode.

More resources and info:

Friday, November 8, 2013

Nexus 5 Googlefied, Angular in a Day, Silicon Valley or NYC?

Nexus 5 is Googlefied :
Of course, there's nothing wrong with turning the Nexus from the premiere Android phone into the Google phone, but it does change things for Google and for the rest of the Android ecosystem. KitKat is about "polishing," "refining," and providing a "long tail set of features," but it's also about honing and sharpening. The result is a new edge, Google's services, which reach their highest and best form on the Nexus 5.
Nice site kirupa.com such as how you can tell if you have internet access from javascript.

Learn Angular in a day

Boostrap3 experience

Silicon Valley or NYC for tech ?

Thursday, November 7, 2013

Harvard Building Mobile Applications Course Week 3 iOS6

On to the week 3 lecture transcript  and video of the Harvard Building Mobile Applications Course . The lecture slides , code slides as pdf , and code supplement the presentation.



UI Kit : API for UI related things

Templates:

  • Empty Application
  • Single View Application
  • Utility Application
  • Master-Detail Application 
  • Tabbed Application
Program #1:
program flow : main.m -> AppDelegate:
@class ViewController - forward declaration to avoid circular references

didFinishLaunchingWithOptions method  :
self viewController  given ViewController class
self window rootViewController given the self viewController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
19. {
20. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
21. self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
22. self.window.rootViewController = self.viewController;
23. [self.window makeKeyAndVisible];
24. return YES;
25. }

Program #2:
Master-Detail application  example -see View Controller types:

The App Delegate header file which provides a navigation controller:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
16. @property (strong, nonatomic) UINavigationController *navigationController;


example created a instance of class MasterViewController in AppDelegate.
- The root controller here is navigation controller  with  master controller:
- self navigationController which is a UINavigationController which is initialized with MasterViewController instance


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18. {
19. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
20. MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
21. self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
22. self.window.rootViewController = self.navigationController;
23. [self.window makeKeyAndVisible];
24. return YES;

MasterViewController -> UITableViewController -> UIViewController

Te header file shows MasterViewController provides a detailViewController:

@interface MasterViewController : UITableViewController
17. 
18. @property (strong, nonatomic) DetailViewController *detailViewController;
19. 
20. @end


The implementation of MasterViewController has a init method for nib:
- the method is passed from the AppDelegate: @"MasterViewController" bundle:nil];
- The top of the navigation list shows a title of Master


22. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
23. {
24. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
25. if (self) {
26. self.title = NSLocalizedString(@"Master", @"Master");
27. }
28. return self;
29. }
30.


MasterViewController:
- method viewDidLoad invoked when the particular view loads such as adding things to view
- method numberOfSectionsInTableView is how many sections in table
- method numberOfRows inSection is how many entries in section
NSIndexPath is row and section
UIBarButtonSystemItemAdd  constant of enum  of UIBarButtonItem
UITableViewCell is the cell in view
- When view loads adds edit button after calling parent and drags item into navigation bar

- (void)viewDidLoad
32. {
33. [super viewDidLoad];
34. self.navigationItem.leftBarButtonItem = self.editButtonItem;
35.
36. UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(
insertNewObject:)];
37. self.navigationItem.rightBarButtonItem = addButton;
38. }

sections are grouping of rows.
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
53. {
54. return 1;
55. }
56.

how many rows

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
58. {
59. return _objects.count;
60. }
61.

add new row (method from the selector when creating nib). Index path is section and row.

- (void)insertNewObject:(id)sender
41. {
42. if (!_objects) {
43. _objects = [[NSMutableArray alloc] init];
44. }
45. [_objects insertObject:[NSDate date] atIndex:0];
46. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
47. [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];lectures/3/src3/MasterDetail/MasterDetail/MasterViewController.m
48. }


Cell population:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
63. {
64. static NSString *CellIdentifier = @"Cell";
65.
66. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
67. if (cell == nil) {
68. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
69. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
70. }
71.
72. NSDate *object = _objects[indexPath.row];
73. cell.textLabel.text = [object description];
74. return cell;
75. }

Program #3 (storyboards)
storyboard - simply user interface process
started with utility application
Looks like 2 nibs same time with transition in middle (known as segue)
specify in code what you want to make happen
Right side of scene you can see transition details : identifier: ShoAlternate, type is Modal, FlipHorizontal
There is an action on button
inform Destination Controller that delegate will be self


Program #4 (Gestures)

Added the images to the project
Have the UIImageView in the nib



@interface ViewController ()
// private properties

@property (nonatomic, readwrite, weak) IBOutlet UIImageView *imageView;
@property (assign, nonatomic, readwrite) int index;
@property (nonatomic, readwrite, strong) NSArray *robs;

// private methods
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender;
- (void)handleSwipe:(UISwipeGestureRecognizer *)sender;


@end


INITIALIZE array:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
  ...
    
        // prepare Robs
        self.robs = [[NSArray alloc] initWithObjects:@"rob1.jpg", @"rob2.jpg", @"rob3.jpg", nil];
        self.index = 0;
    }
    return self;

}





- (void)viewDidLoad:

// load image
    self.imageView.image = [UIImage imageNamed:[self.robs objectAtIndex:self.index]];




- (void)handleSwipe:(UISwipeGestureRecognizer *)sender
{
    // handle swipe
    UISwipeGestureRecognizerDirection direction = [(UISwipeGestureRecognizer *)sender direction];
    switch (direction)
    {
        // ignore up, down
        case UISwipeGestureRecognizerDirectionUp:
        case UISwipeGestureRecognizerDirectionDown:
            break;
            
        // left
        case UISwipeGestureRecognizerDirectionLeft:
            self.index = (self.index + 1) % [self.robs count];
            break;
            
        // right
        case UISwipeGestureRecognizerDirectionRight:
            self.index = (self.index + [self.robs count] - 1) % [self.robs count];
            break;           
    }
    
    // update Rob
    self.imageView.image = [UIImage imageNamed:[self.robs objectAtIndex:self.index]];

}


Gestures -UI*GetsureRecognizer .i.e. UIPinchGestureRecognizer



storage

NSDefaults - interface for storing persisently, settings, configurable items
SqlLite store using api, written in c
xml, json
Core Data
Property Lists - dictionary of strings , plist files - xml, key value pairs:

PList program




Wednesday, November 6, 2013

Who Knew - Coding competitions have gone mainstream

I never have been one for certifications or test taking. I do enjoy challenges. Such as it gets you focused at the specific skill at hand. For example, I have done fitness challenges over the past few years. Also, I am a regular at playing fake sports challenges known as Fantasy Sports. Anyway, with all these self learning resources available on the web it was bound to happen. Coding challenges. A sites in that space is Top Coder what even has resources to practice up on their wiki . Or how about javascript under pressure ? Moreover, Stanford has a course Introduction to Competitive Programming Contests, and Google has codejam .

Monday, November 4, 2013

Conferences, Conferences,...

Do you remember a time when a conference like Java One was the only game in town?  Luckily in this day and time, the options of enhancing your skills and learning about new trends and techniques in software industry is plentiful.  Especially with the web, the software skills of today are transferable across many different companies and industries. It's just fun learning new things.

javascript online summit

http://teamtreehouse.com/library/blend-conference-2013

http://2013.cssdevconf.com/

NCDEVFEST conference

Sunday, November 3, 2013

Harvard Mobile Course Lecture on iOS6 MVC


I finally got around again to the Harvard Building Mobile Applications Course, finishing up the lecture #2 on the Apple iOS6  MVC material. The lecture (pdf) and souce code (pdf) ,The entire zipped up code can be found here.

this lecture goes over the basics of a Single View Application (MVC) implemented with a nib , along with introducing the UIAlertView

XCode - New Project -> new empty application (delegate and window), MasterDetailApplication, SingleViewApplication, Tab Application

main.m : function - it returns  UIApplicationMain() which passes in reference to AppDelegate

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}


AppDelegate.h file:
inherits from UIResponder  - conforms to UIApplicationDelegate protocol
- has properties UIWindow *window  & ViewController  *viewController 
See: http://vimeo.com/46551853

#import <UIKit/UIKit.h>
 @class ViewController;
 @interface AppDelegateUIResponder <UIApplicationDelegate>
@property (strong, nonatomic) ViewController *viewController;
@property (strong, nonatomic) UIWindow *window;
@end

AppDelegate.m file: 
AppDelegate (.m file) - has EVENT callbacks:

  • applicationWilResignActive ()
  • ApplicationDidEnterBackground()
  • applicationWillEnterForeground()
  • applicationWillTerminate()
  • ApplicationDidBecomeActive()
  • didFinishLaunchingWithOptions()

#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}

@end

UIKit - ui sdk
UIView - something on screen (the V)
UIViewController - http://www.ralfebert.de/archive/ios/tutorial_iosdev/viewcontroller/ (the C but called ViewController)
plist is preferences files (xml).






https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html

ManagingYourApplicationsFlow
- circle is the event loop : sit waiting for you to do something or something external
- main function calls UIApplicationMain() function
- first initialization such as examples such as top scores, reference items, etc application:willFinishLaunchingWithOptions() call back
- restore ui state if you paused for example
- final ui initialization application:didFinishLaunchingWithOptions() callback
- activated app, wit for user to do something applicationDidBecomeActive ()callback
- handle events

http://www.techrepublic.com/blog/ios-app-builder/understand-the-states-and-transitions-of-an-ios-app/

program running - an apple thread can interrupt go sleep (i.e phone call)

police battery life better, may get notifications (i.e.) but have to load app

built in iOS mail more tightly coupled with the operating system





nonatomic - dont bother thread safe code, atomic - multiple threads - i.e. printing, readonly - getter, no setter




 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
. {
// refer to the window property (i.e UIWindow), allocate it, init with arguements, call mainScreen()
// bounds returns dimensions
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor] ;
// visible and key means important and return success
[self.window.makeKeyAndVisible];
return YES;


AppDelegate (.h file) - inherits from UIResponder  - conforms to UIApplicationDelegate protocol
- also has property (strong,nonatomic) ViewController * viewcontroller
- ViewController inherits from UIViewController, viewDidLoad() for any setup after when controller is loaded, didReciveMemoryWarning()


self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// @ViewController : associate Nib file with Controller
20. self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
// the most important controller
21. self.window.rootViewController = self.viewController;
22. [self.window makeKeyAndVisible];
23. return YES;

SingleViewApplication , add text field (inspector shows UITextField), add button

Create an IBOutlet property to connect GUI action to Controller UITextField

Nib: hold file owner(who owns the view) and click control (extension cord) to nib file textfield (64bit memory address), gives few outlets available, select textfield

need cable from nib back to code (opposite of outlet is IBAction)

- (IBAction)go:(id)sender

have to wire from nib to this code (ctrl from button to code i.e. file owner) go methed is presented for selection (touch up inside shown if you ctrl click button afterward)


implement the go method in .m file

- (IBAction)go:(id)sender {
 
    // wired up text field to action did 'end on exit' to owner in nib file
 
    NSLog(@"here %@", self.textField.text);
}


UIAlertView http://www.idev101.com/code/User_Interface/UIAlertView.html
http://nscookbook.com/ios-programming-quick-start-guide/




[textField resignFirstResponder]



keyboard input  - Go - alertview


Here are code take aways:


The UI Alert view

On entering text in the text field and clicking go button we get an UI Alert:

- (IBAction)go:(id)sender {
   
    // wired up text field to action did 'end on exit' to owner in nib file
   
    NSLog(@"here %@", self.textField.text);
   
    // put text field away
   
    [self.textField resignFirstResponder];
   
    NSString *textToDisplay = [NSString stringWithFormat:@"here %@", self.textField.text];
   
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hi: " message:textToDisplay
                                             delegate: self cancelButtonTitle:@"Bye" otherButtonTitles: nil];
   
    [alert show ];
   
  
}

As far as NIB file:

the button had an event of 'Touch Up Inside' with file owner of go
 the text field had an event of 'Did End On Exit' with a file owner of go , along with an Outlet of delegate.

As, the controller has a protocol as follows:
@interface ViewController : UIViewController <UIAlertViewDelegate>

Moreover, the controller had to implement this method:

- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{

    self.textField.text = nil;


}


Thus,  you enter chars in the text box, click go button, get a UIAlert presented, whereby the keyboard goes away via the call to resign first responder. At that point, the user is able to click the button on Alert and then it resets the text field.

Saturday, November 2, 2013

Got a IPhone 5S Silver

Well, I am eligible for my next phone on November 1 of 2015. As, I purchased an IPhone 5S on my lunch hour yesterday. I scouted my choices over past few months and both Verizon and AT&T were in play. As far as what phone I was considering, it was always going to be an IPhone. As, I had gone down the Android path before. I had a Samsung Galaxy I in 2009 and the battery life was grueling . For me, the phone plans between the two carriers were relatively identical.

I also got this Mophie Juice Pack Helium case and charger for extended battery life.

Tuesday, October 29, 2013

Git Hub comes to train at NCSU

I am signed up for the November GitHub training at NCSU . 
will lead you carefully through the basic skills you need to be productive with Git and to collaborate with other developers on GitHub. Learn how to convert an existing project to a Git Repository, track changes to your project, protect your work from experimental changes through branching, push code to repositories on GitHub, and collaborate with colleagues through Pull Requests
This sounds great. I have been through the basics of creating at GitHub account.  Here is an extensive list of Git resources I have found on the web.

GitHug , Git Workflow , Git Tutorials on You Tube,  Git like a Boss , Skills Matter Git Hub , Merge or Rebase , Pro Git, Git From The Bottom Up , Git Immersion , Git internals  , Git Magic ,
Git Reference, Version Control by Example, Git Succinctly , Think Like (a) Git,Git In The Trenches , Conversational Git , Code School - Try Git

Thursday, October 24, 2013

More on iOS7

I am a happy camper. The biggest complaint I had with the new version of iOS was taking away the ability to search web with the spotlight search. I tried iOS7 and its back. No more removing the url out of the safari address bar.

Yesterday I took in some of the new features of iOS7 at the lunch time learning I attended. The terminology used was that Apple did a "Design Language" overhaul with the new release.  Gone are rich and colorful, replaced flat and simplified.  I need to read up on visual deference. The coalesced updates was a new thing for apple. As in past when you got a text update, it would not trigger things the way the new iOS does.

What developers should do to get ready for the next version of iOS 7 can be found  here (Apple's Transition Guide, UI Design basics , UIKit ).

As for design, the status bar becomes part of the screen real estate.

As for development, Apple’s Xcode 5 allows developers to manage multiple versions of an app, and compare the differences using Apple’s Auto Layout. Also, the button container is gone. Using the assistant editor, you can see how your changes look in iOS6.

Other items:

  • Enterprise single sign on
  • MDM
  • air drop
  • per app vpn
  • background updates


Tuesday, October 22, 2013

A Html5 Class

I stumbled across this web site and it looked like a great class.

http://aaltowebapps.com/

The class has all sorts of examples you can run such as Storage and Offline API, Templating with Handlebars, CSS Media Queries, and more. The example code is on GitHub too.

Lectures:

Mobile Web Appplications Development with HTML5 part 1
JQuery Mobile [examples]
Mobile Web Appplications Development with HTML5 part 2
Mobile Web Appplications Development with HTML5 part 3
Mobile Web Appplications Development with HTML5 part 4 [backbone] [Canvas/Device] [web sockets] [css3] [rest]

Other talks: http://aaltowebapps.com/talks.html - https://github.com/clody69

http://gitref.org/
www.html5rocks.com
www.htmlfivewow.com
chromestatus.com caniuse.com
http://mobilehtml5.org/

Try It In Real Time

http://www.sqlfiddle.com/ - learn and practice SQL queries online
JSBin  - Remy Sharp online javascript tool
JSFiddle 
CodePen
Dabblet  - CSS
Tinker

http://hugogiraudel.com/2012/11/19/css-playgrounds/

Sunday, October 20, 2013

Week 2 of MongoDB


I have not had the time to do the homework for week 1, but i finished the lectures finally.

https://education.mongodb.com/static/m101j-october-2013/handouts/hw1-1.184820ec29b6.zip
https://education.mongodb.com/static/m101j-october-2013/handouts/hw1-3.2005b1d3b047.zip
https://education.mongodb.com/static/m101j-october-2013/handouts/hw1-4.b2846101dcff.zip



Here is the link for week 2

https://education.mongodb.com/courses/10gen/M101J/2013_October/courseware/Week_2_-_CRUD/Introduction_to_Week_2/

Javascript techniques


Module pattern

function Answer(questionID, text) {
    this.questionID = questionID;
    this.text = text;
}

Working with arrays

var list1 = Array();
list1.push(currSec);


jQuery Append to element
$('#addLink').append('<B>test</B>');


Opener
http://www.webreference.com/js/tutorial1/opener.html

Thursday, October 17, 2013

Together Native and Html5

Peter Traeg of Universal Mind has written an article at Smashing Magazine about mixing together Native and Html5 .
Exposing a portion of the user experience through HTML and JavaScript means that some of the experience can be served from the Web and thus be dynamic. As we saw earlier, it’s possible for this Web-served content to invoke native code in your application via a “bridge” that you create.
Apple allows JavaScript code to be downloaded and executed as long as it runs within the context of the UIWebView control in your iOS application. This is the only situation in which code “downloading” is allowed in iOS.
The UIWebView in iOS and its associated UIWebViewDelegate provide the mechanism that allows native code and JavaScript to communicate with each other.

https://github.com/ptraeg/html5-in-mobile-apps

Tuesday, October 15, 2013

Responsive Web Bootcamp with Jonathan Stark


JSConf: Douglas Crockford


Learn It on Web

Now a days there are so many ways to learn things on the web. Over the past year or so I have found a few site to help me improve my skills. Most of these are free resources but not all. This will be a dynamic list and will be updated periodically ...

Saturday, October 12, 2013

MongoDB Week 1

I started the MongoDB for Java developer course this week.

The lead developer of the java driver Jeff Yemin along with Andrew Erlichson are the instructors.


Non relational algebra

Json store

Json documents - collection of documents


Key values



Mongoshell - tcpconnects to mongodb

Sparq java - routes to urls
Freemarker mvc









Copy files in bin dir to c:\mongodb226

Make data dir under c drive, Under data mkdir db

Go to bin dir

c:\mongodb226>mongod
mongod --help for help and startup options
Tue Oct 08 22:44:36 [initandlisten] MongoDB starting : pid=1696 port=27017 dbpath=\data\db
\ 64-bit host=CSGRALLT10
Tue Oct 08 22:44:36 [initandlisten] db version v2.2.6, pdfile version 4.5


c:\mongodb226>mongo
MongoDB shell version: 2.2.6
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
> 

Or
mongo localhost

> db
test


      
> show collections
> db.mycollections.insert({text:'hello world'})
> show collections
mycollections
system.indexes
> db.mycollections.find()
{ "_id" : ObjectId("5254c64c2488183e2c3d49f8"), "text" : "hello world" }
> 



c:\>cd data

c:\data>cd db

c:\data\db>dir
 Volume in drive C is Windows
 Volume Serial Number is 1CEC-CA9A

 Directory of c:\data\db

10/08/2013  10:58 PM    <DIR>          .
10/08/2013  10:58 PM    <DIR>          ..
10/08/2013  10:58 PM    <DIR>          journal
10/08/2013  10:50 PM                 6 mongod.lock
10/08/2013  10:58 PM        67,108,864 test.0
10/08/2013  10:58 PM       134,217,728 test.1
10/08/2013  10:58 PM        16,777,216 test.ns
10/08/2013  10:58 PM    <DIR>          _tmp
               4 File(s)    218,103,814 bytes
               4 Dir(s)  49,962,684,416 bytes free





> mvn archetype:generate

enter 308 at prompt
    308: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetype which
ven project.)



              308

Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 308:
Choose org.apache.maven.archetypes:maven-archetype-quickstart version:
1: 1.0-alpha-1
2: 1.0-alpha-2
3: 1.0-alpha-3
4: 1.0-alpha-4
5: 1.0
6: 1.1

Choose a number: 6: 6
 mvn compile exec:java -Dexec.mainClass="org.mongodb.App"



           <dependency>
              <groupId>org.mongodb</groupId>
              <artifactId>mongo-java-driver</artifactId>
               <version>2.10.1</version>
            </dependency>
import com.mongodb.DB; 
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;

public class HelloMongoDB {

public static void main( String[] args ) throws UnknownHostException
{
MongoClient mongoStyleClient = new MongoClient(new ServerAddress("localhost", 27017));
           DB db = mongoStyleClient.getDB("test");
           System.out.println( "Hello World!" );
  DBCollection coll = db.getCollection("mycollections");
  DBObject document1 = coll.findOne();
  System.out.println(document1); }
}}
 Hello World!
{ "_id" : { "$oid" : "5254c64c2488183e2c3d49f8"} , "text" : "hello world"}

Spark Web Application Framework

http://www.sparkjava.com/

<repositories>
      <repository>
          <id>Spark repository</id>
          <url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
      </repository>
  </repositories>


<dependency>
      <groupId>spark</groupId>
      <artifactId>spark</artifactId>
      <version>0.9.9.4-SNAPSHOT</version>
     </dependency>


import spark.Request;
import spark.Response;
import spark.Route;
import spark.Spark;


public class HelloWorldSparkStyle {

public static void main( String[] args )
    {
   
      //http://localhost:4567/
        Spark.get(new Route("/") {

@Override
public Object handle(Request arg0, Response arg1) {

return "Hello Spark World!";
}
});
     
    }

}

Hello Spark World!

Template library
http://freemarker.org/

.ftl files combined with data map


      <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
      <version>2.3.19</version>
     </dependency>



Spark - Http Get , Http Post


Freemarker looping




Freemarker ...

Spark.post(new Route("/favorite_fruit")

Schemaless Mongodb example (can add columns on fly)

json - arrrays, dictionaries (associated maps)




MongoPosts

16meg limit on document