Tuesday, June 12, 2018

JavaScript Object Prototypes

All JavaScript objects inherit properties and methods from a prototype.
in the previous chapter we learned how to use an object constructor.
function Person( first, last, age, eyecolor) {
    this.firstName = first;
    this.lastName = last;
    this.age = age;
    this.eyecolor  = color;
}
var myFather = new Person("John", "Doe", 50, "blue");
var myMother = new Person("Sally", "Rally", 48, "green");

Prototype Inheritance
All JavaScript objects inherit properties and methods from a prototype.
Date objects inherit from Data.prototype. Array objects inherit from Array.prototype. Person objects inherit from Person.prototype. The Object.prototype is on the top of the prototype inheritance chain:
Date objects, Array objects, and Person objects inherit from Object.prototype.

Adding Properties and Methods to Objects
Somtimes you want ot add new proerties (or methods) to all existing objcts of a given type.
sometimes you want to add new properties( or methods) to an object constructor.

Using the Prototype Property
The JavaScript prototype property allows you to add new properties to object constructors:
function Person( first, last, age, eyecolor)
{
    this.firstName = first;
    this.lastName = last;
    this.age = age;
    this.eyecolor = color;
}
Person.prototype.nationality = "English";

Saturday, June 2, 2018

SQL Server 打開SA 帳號,並確保可以正常工作的工具與流程

這邊可以確定是已sa來login了
sql server configuration manager這邊的TCP/IP要確定打開,除此之外
防火牆設定(
https://docs.microsoft.com/zh-tw/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-2017
)也必須確認沒有被擋 

上面的檔案預設可以在這個路徑上找得到 C:\Windows\SysWOW64



關於 SQL server connectionstring

1. select "manage user secrets" option from project file.
2.  found such kind of string
{
  "ConnectionStrings:DefaultConnection": "Data Source=TERENCELIU_HP_N;Initial Catalog=RetailStuff;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
}



3. in red, you can copy such kind of string from SQL Server Explorer directly,
4. see this picture


you could see a connectionstring field, just copy and paste it.

Friday, June 1, 2018

AngularJS

ng-init --> we are not use this directive often. it is only for

<div ng-app="myApp" ng-controller="myCtrl">
{{firstName+" "+lastName}}
</div>

<script>
var app = angular.module("myApp",[]);
app.controller("myCtrl", function($scope) {
    $scope.firstName = "Terence";
    $scope.lastName = "Liu";
});
</script>