Sky Chen
Sharing for experience on Node.js, Mobile Apps and Web Development
Friday, August 4, 2017
Get started with machine learning for test automation
Now, AI and machine learning are very hit topic. So as a developer, it will be great that the AI can help us to write the tests, and verify the newly developed features. So I started the ai-tester.com project.
The very first step is to setup a blog website, so that I can keep this projects going, and write down the interesting learning during this project.
I will update with more information to the blog ai-tester.com.
Wednesday, August 29, 2012
Useful JavaScript Methods
The following is an example to short multiple keys in an array which containing both numbers and string.
// Function by takes a member name string and an // optional minor comparison function and returns // a comparison function that can be used to sort an // array of objects that contain that member. The // minor comparison function is used to break ties // when the o[name] and p[name] are equal. var by = function (name, minor) { return function (o, p) { var a, b; if (o && p && typeof o === 'object' && typeof p === 'object') { a = o[name]; b = p[name]; if (a === b) { return typeof minor === 'function' ? minor(o, p) : 0; } if (typeof a === typeof b) { return a < b ? -1 : 1; } return typeof a < typeof b ? −1 : 1; } else { throw { name: 'Error', message: 'Expected an object when sorting by ' + name; }; } }; }; //Here is an example to sort by last name then first name: var s = [ {first: 'Joe', last: 'Besser'}, {first: 'Moe', last: 'Howard'}, {first: 'Joe', last: 'DeRita'}, {first: 'Shemp', last: 'Howard'}, {first: 'Larry', last: 'Fine'}, {first: 'Curly', last: 'Howard'} ]; s.sort(by('last', by('first'))); // s is [ // {first: 'Joe', last: 'Besser'}, // {first: 'Joe', last: 'DeRita'}, // {first: 'Larry', last: 'Fine'}, // {first: 'Curly', last: 'Howard'}, // {first: 'Moe', last: 'Howard'}, // {first: 'Shemp', last: 'Howard'} // ]
Another example is the "bind" function.
Function.method('bind', function (that) { // Return a function that will call this function as // though it is a method of that object. var method = this, slice = Array.prototype.slice, args = slice.apply(arguments, [1]); return function ( ) { return method.apply(that, args.concat(slice.apply(arguments, [0]))); }; }); //We can now bind the value to the x function. var x = function ( ) { return this.value; }.bind({value: 666}); console.log(x( )); // 666
Sunday, July 1, 2012
How to get start with Node.js
The first site is http://www.nodebeginner.org/. It provides good background knowledge of Node.js, as well as the hands-on examples. It is easy to follow, and can give you more confidence to start with your Node.js journey.
Felix’s Node.js Guide is also worth reading. It provides the Style Guide of Node.js, and also provide some tips for you to convince your boss to adopt Node.js.
The last site I would like to introduce is Node.js Manual. It provides a set of Tutorial and Guide of Node.js, and complete reference of Node.js and JavaScript.
Hope these info helps. I read the above links and developed my first Node.js web site: http://chat.skychen.com/
Sky Chen
QE Manager in Yahoo! Taiwan
Thursday, June 28, 2012
How to set up your own domain name
I recently setup my own domain: chat.skychen.com. Why? Because I would like to have a domain name for my node.js Social Chat Website (http://chat.skychen.com/), and for my upcoming web sites.
It is not hard, and here is some experience when setting up my domain:
The first step is to find a good service provider. I am using onlydomains.com, because I saw its ads in Google search result. You can also consider the recommendations from Jason - Five Best Domain Name Registrars.
The second step is to make sure the domain name you are looking for is available. Most of the
Domain Name Registrars provided the search function for you. I am decided to use my own name as the domain name, because I would like to use this domain for my own works/hacks and so on.
If your domain is available, then you just need to pay for it. It takes about USD 10 for a domain name per year.
It will take a few days to make your domain registered. The last step is to setup your domain, to route the traffics to your web servers: Adding DNS Records.
Sky Chen
QE Manager in Yahoo! Taiwan