source control & knockout

18
Moretto Carlo – www.morettocarlo.eu ts.eestec .it Client Technology

Upload: eestec-lc-trieste

Post on 11-May-2015

578 views

Category:

Documents


3 download

DESCRIPTION

www.morettocarlo.eu ts.eestec.it

TRANSCRIPT

Page 1: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Client Technology

Page 2: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

• jQuery• Toastr• Knockout

Client

Page 3: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Download: http://jquery.com/

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

jQuery

Page 4: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

https://github.com/CodeSeven/toastr

Sample:• toastr.warning(‘Warning!') ;• toastr.success('Have fun storming the

castle!', 'Miracle');• toastr.error(‘Please check your data‘);

Toastr: JS notification

Page 5: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

http://knockoutjs.com/

Knockout is a Javascript library that allows developers to create rich, responsive display and editor user interfaces with a clean underlying data model.

Knockout

Page 6: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

• Declarative bindings• Automatic UI refresh (when the

data model's state changes, the UI updates automatically)

• Dependency tracking• Templating 

Features

Page 7: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

MVVM facilitates a clear separation of the development of the graphical user interface (either as markup language or GUI code) from the development of the business logic or back end logic known as the model.

MVVM - Model View ViewModel

Page 8: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

View (HTML)

<p>First name: <input data-bind="value: firstName" /></p><p>Last name: <input data-bind="value: lastName" /></p><h2>Hello, <span data-bind="text: fullName"> </span>!</h2>

View Model (Javascript)

function ViewModel() { this.firstName = ko.observable(‘Mario’); this.lastName = ko.observable(‘Rossi’); this.fullName = ko.computed(function() { return this.firstName() + " " + this.lastName(); }, this); } ko.applyBindings(new ViewModel());

Example

Page 9: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Example• Control Type

knockoutjs.com/examples/controlTypes.html

• Observable Arrays knockoutjs.com/documentation/observableArrays.html

• Cart Editor knockoutjs.com/examples/cartEditor.html

Page 10: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Download and save the data

Save$.ajax({ type: "POST", url: "/api/yyy?param=zzz", data: dataJs, success: function (data) { toastr.success(‘:-)'); }, error: function () { toastr.error(‘:-('); }});

Download $.getJSON("/api/yyy?par=zzz", function (data) { viewModelJs = data; viewModel = addComputed(viewModelJs); ko.mapping.fromJS(viewModelJs); ko.applyBindings(viewModel);})});

Page 11: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Useful links

•https://github.com/CodeSeven/KoLite - asyncCommand, activity, dirtyFlag

•http://www.knockmeout.net - knockout tutorial

•https://github.com/ericmbarnard/Knockout-Validation - knockout validation

Page 12: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Source Control

Page 13: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

• TFS• SVN• Git• Mercurial

Source Control

Page 14: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Compatible successor to the widely used Concurrent Versions System (CVS):

• Versioning of directories• Atomic commits• Metadata versioning• Abstraction from the network layer

SVN

Page 15: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Git

+ Dramatic increase in operation speed+ Cheap branch operations+ Full history tree available offline+ Distributed, peer-to-peer model- Learning curve for those used to SVN- Not optimal for single developers- Limited Windows support compared to Linux

Page 16: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Mercurial+ Easier to learn than Git+ Better documentation+ Distributed model- No merging of two parents- Extension-based rather than scriptability- Less out of the box power

Page 17: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

• http://biz30.timedoctor.com/git-mecurial-and-cvs-comparison-of-svn-software/ - git vs mercurial vs cvs

• http://blogs.atlassian.com/2012/02/mercurial-vs-git-why-mercurial/ - command line git, mercurial

• http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/ - Intro to Distributed Version Control

• https://github.com/ - github• http://codeplex.com/ - codeplex• https://bitbucket.org/ - bitbuket• http://code.google.com/intl/it/ - google code

Useful links

Page 18: Source control & Knockout

Moretto Carlo – www.morettocarlo.eu ts.eestec.it

Email: [email protected]: www.morettocarlo.euEESTEC: ts.eestec.it

Contacts