CSS中大于号空格的区别

空格作用于所有的后裔

大于号作用于第一层后裔

<html>
<style>
    div { border: 1px solid black; margin-bottom: 10px; }
    .a b { color: red; } /* 所有的John是红色 */
    .b > b { color: red; } /* 只有John3和John4是红色 */
</style>
<body>
    <div class="a">
        <p>
            <b>John1</b>
        </p>
        <p>
            <b>John2</b>
        </p>
        <b>John3</b>
        <b>John4</b>
    </div>

    <div class="b">
        <p>
            <b>John1</b>
        </p>
        <p>
            <b>John2</b>
        </p>
        <b>John3</b>
        <b>John4</b>
    </div>
</body>
</html>

参考


CSS

这篇文章: 有用 无用
创建 2018-04-20 05:01:28 / 更新 2018-04-20 05:03:09

Transact-SQL

DECLARE

DECLARE @gender varchar(30);   

DECLARE @find varchar(30) = 'Man%';

DECLARE @lastName varchar(30), @firstName varchar(30), @rows int;

DECLARE @age INT;

SET

SET @gender = 'Fema';

SET @gender += 'le';

SET @rows = (SELECT COUNT(*) FROM Customer);  

SET @age = 18;

SELECT

SELECT @gender = 'Man';

-- If CustomerID 1000 does not exists, @gender will retain its present value.
SELECT @gender = Gender FROM Customer WHERE CustomerID = 1000;

-- If CustomerID 1000 does not exists, @gender will be NULL
SELECT @gender = (SELECT Gender FROM Customer WHERE CustomerID = 1000);

GETDATE

SELECT GETDATE() as "Now"

IF

IF @gender IS NOT NULL
BEGIN
    { sql_statement | statement_block }
END

-- To define a statement block, use the control-of-flow keywords BEGIN and END.
IF Boolean_expression   
   { sql_statement | statement_block }   
[ ELSE   
   { sql_statement | statement_block } ]   

WHILE

DECLARE @cnt INT = 0;

WHILE @cnt < 3
BEGIN
    PRINT @cnt
    SET @cnt = @cnt + 1;
END;

SQLServer

这篇文章: 有用 无用
创建 2018-01-21 00:50:32 / 更新 2018-12-06 00:58:36

sql server Tips

Concept

DDL is Data Definition Language : it is used to define data structures.

For example, with SQL, it would be instructions such as create table, alter table, ...

DML is Data Manipulation Language : it is used to manipulate data itself.

For example, with SQL, it would be instructions such as insert, update, delete, ...

System

-- Find SQLServer Version
SELECT @@VERSION

-- Find names of the ServerName and ServiceName
SELECT @@SERVERNAME AS 'Server Name', @@SERVICENAME AS 'Service Name' 

-- Find names of the HostName and LoginUser
SELECT HOST_NAME() AS HostName, SUSER_NAME() LoggedInUser

-- Find all instance names (Command Prompt)
reg query "HKLM\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL

-- Detect READ_COMMITTED_SNAPSHOT is enabled?
SELECT is_read_committed_snapshot_on FROM sys.databases WHERE name= 'YourDatabase'

-- Detect current transaction level? 
DBCC useroptions

-- Find database object(table, procedures...)
select * from sys.objects where name like '%keyword%'

Tip

-- Default join behaviour test is inner join
DECLARE @A TABLE (x INT)
INSERT INTO @A
    SELECT 1 UNION ALL
    SELECT 2

DECLARE @B TABLE (x INT)
INSERT INTO @B
    SELECT 2 UNION ALL
    SELECT 3

SELECT 
    A.x AS 'A.x', 
    B.x AS 'B.x'
FROM @A A
JOIN @B B
    ON A.x = B.x

Recursion

WITH [Dates] as (
SELECT convert(datetime, '1/20/2017') as [Date]
UNION ALL
SELECT DATEADD(DAY, 1, [Date])
FROM [Dates]
WHERE [Date] < '12/21/2017'
) SELECT
    * from [Dates]
option (maxrecursion 0)

参考:


SQLServer

这篇文章: 有用 无用
创建 2018-01-17 01:04:08 / 更新 2019-04-10 22:36:03

说说Linux下的文件和目录的权限

文件的权限

r 可以读取文件
w 可以编辑该文件的内容(但不能删除该文件)
x 该文件可以被系统执行

目录的权限

 r 可以读取目录结构列表,表示可以查询该目录下的文件名数据
 w 在该目录内新建新的文件和目录,删除该目录内已经存在的文件和目录(不论该文件的权限为何),转移该目录内的文件和目录的位置,重命名该目录内的文件和目录
 x 是否可以进入(cd)该目录,如果没有x权限,无法读取该目录下的文件的内容

总结

如果你要读取一个文件的内容,不仅要拥有文件的 r 权限,而且要拥有文件所在目录的 x 权限

如果你要删除一个文件,只需要拥有该文件所在目录的 w 权限即可


Liunx

这篇文章: 有用 无用
创建 2017-08-28 10:47:10 / 更新 2018-04-20 04:49:17