http://www.deepspacesparkle.com/2013/01/02/double-loading-painting-technique/
Plus 8 tips for teaching children art
http://www.deepspacesparkle.com/2011/11/18/top-eight-tips-for-teaching-art-to-children/
▼
2016年12月29日 星期四
2016年12月20日 星期二
[MEAN] Tutorial
https://thinkster.io/tutorials/mean-stack/creating-schemas-with-mongoose
Self-study notes:
@ AngularApp.js
define the url -> controller -> view.html relationship
define "otherwise" page redirection
.controller
@ AngularApp.js
- to tell ui-router where to place the javascript-triggered template view
return common object for different controllers
can keep data for an application lifetime
main logics should go here than in controllers
- bridge between AngularJS controller and view
- can bind with functions or variables
- {{hhhhheelllooooo}} as notation in view
- defines config, which defines routes
- defines controllers
- defines factories, blablabla ...


Reference
https://tylermcginnis.com/angularjs-factory-vs-service-vs-provider/
Self-study notes:
what is state ?
.state@ AngularApp.js
define the url -> controller -> view.html relationship
define "otherwise" page redirection
.controller
@ AngularApp.js
where is view ?
place <ui-view></ui-view> into index.ejs- to tell ui-router where to place the javascript-triggered template view
what is factory ?
kind of an Angular servicereturn common object for different controllers
can keep data for an application lifetime
main logics should go here than in controllers
what is data-binding ?
to allow showing synchronised model data into view at all time
- AngularJS will be responsible for this
- note for the special dollar signwhat is special with $scope ?
- bridge between AngularJS controller and view
- can bind with functions or variables
- {{hhhhheelllooooo}} as notation in view
Any difference between .config and .run ?
Config block > service > injector > run blockStructure of an AngularJS app:
- defines config, which defines routes
- defines controllers
- defines factories, blablabla ...

Why there is a $ sign for some variables?
AngularJS will inject these special-defined variables into the functionsA look as sample on my "sticker" function:

Reference
https://tylermcginnis.com/angularjs-factory-vs-service-vs-provider/
2016年12月19日 星期一
[MAC OS X] Add environment path
http://architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/#.WFdQqbZ96MB
2016年11月14日 星期一
[SQLServer] sql-server-linked-server-example-query
http://stackoverflow.com/questions/4091960/sql-server-linked-server-example-query
The format should probably be:
For example: DatabaseServer1.db1.dbo.table1
The format should probably be:
<server>.<database>.<schema>.<table>
For example: DatabaseServer1.db1.dbo.table1
2016年9月8日 星期四
2016年9月6日 星期二
[MongoDB] [Java] MongoJack for JSON mapping to POJO and vice versa
http://mongojack.org/
http://abhijitbashetti.blogspot.hk/2014/01/example-of-mongodb-with-mongojack.html
http://abhijitbashetti.blogspot.hk/2014/01/example-of-mongodb-with-mongojack.html
2016年7月22日 星期五
2016年7月14日 星期四
2016年6月29日 星期三
[JS] Array.prototype.map
return: an array
var numbers = [1, 4, 9];
var roots = numbers.map(Math.sqrt);
// roots is now [1, 2, 3], numbers is still [1, 4, 9]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map2016年6月20日 星期一
2016年6月14日 星期二
[ECMAScript 6] Promise
JavaScript6 Promise =/= Node.js Promise
Promise -> has a metadata "then" array storing list of functions
until resolve, the promise object puts the "then" list of functions into the queue
( previously store in the promise metadata )
javascript run through the queue
Ex 1
=============================
console.log('a');
setTimeout(function bbb() {
console.log('bbb start');
setTimeout(function bbb2() {
console.log('bbb2 here');
}, 1000);
console.log('bbb end');
}, 1000);
console.log('c');
'abc'
=============================
Result:
a
c
abc
bbb start
bbb end
bbb2 here
Ex 2
=============================
console.log('a');
var bPromise = new Promise(resolve => {
setTimeout(function bbb() {
console.log('b');
resolve(123);
}, 1000);
});
setTimeout(function ddd() {
bPromise.then(function eee() {
console.log('e');
});
}, 7000);
bPromise.then(function ccc() {
console.log('c1');
});
bPromise.then(function ccc2() {
console.log('c2');
});
console.log('oh');
'abc'
=============================
Result:
a
oh
abc
b
c1
c2
e
Ex 3
=============================
console.log('a');
var bPromise = new Promise(function (resolve) {
console.log('b');
setTimeout(function bbb() {
console.log('bbb');
resolve(123);
}, 1000);
});
var thenPromise = bPromise.then(function ccc() {
console.log('ccc');
return new Promise(resolve => {
setTimeout(function eee() {
console.log('e');
resolve(123);
}, 1000);
});
});
var thenPromise1 = bPromise.then(function ccc1(param) {
console.log('ccc1');
return 345;
});
thenPromise.then(function ddd(param) {
console.log('ddd');
});
'abc'
=============================
Result:
a
b
abc
bbb
ccc
ccc1
e
ddd
Ex 4
=============================
//create a class http which has get method which returns instance of promise
function http(url) {
this.get = new Promise(function(resolve, reject) {
var client = new XMLHttpRequest();
console.log('here');
client.open('get', url);
client.send();
client.onload = function () { //If you observe carefully this is also registering a callback fn
if (this.status == 200) {
console.log('resolve');
resolve(this.response);
} else {
console.log('reject');
reject(this.statusText);
}
};
client.onerror = function () { reject(this.statusText); }
});
}
//using http module
var successCallBack = function(res) {
console.log(res);
}
new http('/admin').get.then(successCallBack);
============================
Promise -> has a metadata "then" array storing list of functions
until resolve, the promise object puts the "then" list of functions into the queue
( previously store in the promise metadata )
javascript run through the queue
Ex 1
=============================
console.log('a');
setTimeout(function bbb() {
console.log('bbb start');
setTimeout(function bbb2() {
console.log('bbb2 here');
}, 1000);
console.log('bbb end');
}, 1000);
console.log('c');
'abc'
=============================
Result:
a
c
abc
bbb start
bbb end
bbb2 here
Ex 2
=============================
console.log('a');
var bPromise = new Promise(resolve => {
setTimeout(function bbb() {
console.log('b');
resolve(123);
}, 1000);
});
setTimeout(function ddd() {
bPromise.then(function eee() {
console.log('e');
});
}, 7000);
bPromise.then(function ccc() {
console.log('c1');
});
bPromise.then(function ccc2() {
console.log('c2');
});
console.log('oh');
'abc'
=============================
Result:
a
oh
abc
b
c1
c2
e
Ex 3
=============================
console.log('a');
var bPromise = new Promise(function (resolve) {
console.log('b');
setTimeout(function bbb() {
console.log('bbb');
resolve(123);
}, 1000);
});
var thenPromise = bPromise.then(function ccc() {
console.log('ccc');
return new Promise(resolve => {
setTimeout(function eee() {
console.log('e');
resolve(123);
}, 1000);
});
});
var thenPromise1 = bPromise.then(function ccc1(param) {
console.log('ccc1');
return 345;
});
thenPromise.then(function ddd(param) {
console.log('ddd');
});
'abc'
=============================
Result:
a
b
abc
bbb
ccc
ccc1
e
ddd
Ex 4
=============================
//create a class http which has get method which returns instance of promise
function http(url) {
this.get = new Promise(function(resolve, reject) {
var client = new XMLHttpRequest();
console.log('here');
client.open('get', url);
client.send();
client.onload = function () { //If you observe carefully this is also registering a callback fn
if (this.status == 200) {
console.log('resolve');
resolve(this.response);
} else {
console.log('reject');
reject(this.statusText);
}
};
client.onerror = function () { reject(this.statusText); }
});
}
//using http module
var successCallBack = function(res) {
console.log(res);
}
new http('/admin').get.then(successCallBack);
============================
2016年5月25日 星期三
上帝,求你教導我
上帝,求你讓我知道,我在世沒什麼價值也好,在你眼中我仍很有價值。
上帝,求你讓我知道,我與你的關係,不應受其他人的評價而有影響。
上帝,求你讓我知道,你會負責我的一切,只要我相信你。
上帝,求你讓我知道,我當如何活,讓我能看見你。
上帝,求你讓我知道,我與你的關係,不應受其他人的評價而有影響。
上帝,求你讓我知道,你會負責我的一切,只要我相信你。
上帝,求你讓我知道,我當如何活,讓我能看見你。
2016年4月22日 星期五
2016年4月10日 星期日
[System Design] Some dropdowns
For vendor system, how to handle company logos for different clients?
> which should be the most "reasonable" solution?
> effort spending vs necessity
How to break down the complicated job?
> which should work first? main flow first, ui admin later
:(
2016年4月4日 星期一
[Youtube] Hey do you know about all these
http://www.hongkiat.com/blog/youtube-keyboard-shortcuts/
Space - play / pause
F - Full Screen / Esc - Escape
Space - play / pause
F - Full Screen / Esc - Escape
2016年3月17日 星期四
[NodeJS] Learning NodeJS + Express
A handy article to present how to delv a NodeJS App from scratch:
https://hackhands.com/delving-node-js-express-web-framework/
https://hackhands.com/delving-node-js-express-web-framework/
2016年3月8日 星期二
2016年3月1日 星期二
2016年2月12日 星期五
[Agile] What is Agile
http://www.agilenutshell.com/
An interesting graphical website explaining the concepts versus traditional methodology
An interesting graphical website explaining the concepts versus traditional methodology