WTF , What’s Scope

I have to admit that my foundation of Js is very bad. I dont even know what is the variable scope, now is my diary: Scope defines the accessibility or visibility of variables. If variables defined inside of function, they are local variables. If variables defined outside of function, they are global variables. And mention … Continue reading WTF , What’s Scope


Error:identifier $ has already been declared

Today I got this error from nodeJS: Uncaught SyntaxError: Identifier '$' has already been declared. And I have 2 js files, counter.js and form.js in this project, and it is electron framwork, both JS files are working for one html: Obviously, why i got this error, because there are 2 let statement to require jQuery. … Continue reading Error:identifier $ has already been declared

Node.js File System Module appendFile

when i used appendfile, i got this error: fs.appendFile('filename','this is test content'); Error: [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.   In the official document, fs.appendFile(file, data[, options], callback) so we need to callback function. Solution: fs.appendFileSync(file, data[, options]) using this function instead fs.appendFile('message.txt', 'data to append', (err) => { if (err) … Continue reading Node.js File System Module appendFile


Here is the most common selectors for beginners(including me): descendant selector:one more example:one mistake I made before: adjacent selector: if tags ul does not immediately follow tag p:if tags ul is not tag p siblings: attribute selector:one more example: nth of type: child selectorMention:  difference between child selector and descendant selector:check this example

SQL basic command

create table : CREATE TABLE Project ( ProjectID int NOT NULL IDENTITY(1,1), ProjectName varchar(255) NOT NULL, CreatedDate datetime , Price int, FactoryName varchar(255), Status varchar(255), CustomerName varchar(255), Location varchar(255) ) Add constraints: ALTER TABLE @tablename ADD CONSTRAINT @defaultconstraint_name DEFAULT GETUTCDATE() FOR @columnname same as other constraints Insert data: Insert into project(ProjectName, Price, FactoryName, Status, CustomerName, Location) … Continue reading SQL basic command

SQL default constraint problem

Briefly, how to get default constraint name: -- returns name of a column's default value constraint SELECT FROM sys.all_columns INNER JOIN sys.tables ON all_columns.object_id = tables.object_id INNER JOIN sys.schemas ON tables.schema_id = schemas.schema_id INNER JOIN sys.default_constraints ON all_columns.default_object_id = default_constraints.object_id WHERE = 'dbo' AND = 'tablename' AND = 'columnname' This answer … Continue reading SQL default constraint problem