Markdown 语法

概述

宗旨

Markdown 的目标是实现「易读易写」。

可读性,无论如何,都是最重要的。一份使用 Markdown 格式撰写的文件应该可以直接以纯文本发布,并且看起来不会像是由许多标签或是格式指令所构成。Markdown 语法受到一些既有 text-to-HTML 格式的影响,包括 SetextatxTextilereStructuredTextGrutatextEtText,而最大灵感来源其实是纯文本电子邮件的格式。

总之, Markdown 的语法全由一些符号所组成,这些符号经过精挑细选,其作用一目了然。比如:在文字两旁加上星号,看起来就像*强调*。Markdown 的列表看起来,嗯,就是列表。Markdown 的区块引用看起来就真的像是引用一段文字,就像你曾在电子邮件中见过的那样。

兼容 HTML

Markdown 语法的目标是:成为一种适用于网络的书写语言。

Markdown 不是想要取代 HTML,甚至也没有要和它相近,它的语法种类很少,只对应 HTML 标记的一小部分。Markdown 的构想不是要使得 HTML 文档更容易书写。在我看来, HTML 已经很容易写了。Markdown 的理念是,能让文档更容易读、写和随意改。HTML 是一种发布的格式,Markdown 是一种书写的格式。就这样,Markdown 的格式语法只涵盖纯文本可以涵盖的范围。 Continue reading “Markdown 语法”

install gulp

1. Install gulp globally:

$ npm install --global gulp

2. Install gulp in your project devDependencies:

$ npm install --save-dev gulp

3. Create a gulpfile.js at the root of your project:

var gulp = require('gulp');

gulp.task('default', function() {
  // place code for your default task here
});

4. Run gulp:

$ gulp

The default task will run and do nothing.

To run individual tasks, use gulp <task> <othertask>.
在项目的根目录新建gulpfile.js,require需要的module

var gulp = require('gulp'),

    minifycss = require('gulp-minify-css'),

    concat = require('gulp-concat'),

    uglify = require('gulp-uglify'),

    rename = require('gulp-rename'),

    del = require('del');

压缩css

gulp.task('minifycss', function() {

    return gulp.src('src/*.css')      //压缩的文件

        .pipe(gulp.dest('minified/css'))   //输出文件夹

        .pipe(minifycss());   //执行压缩

});

压缩js

gulp.task('minifyjs', function() {

return gulp.src('src/*.js')

.pipe(concat('main.js'))    //合并所有js到main.js

.pipe(gulp.dest('minified/js'))    //输出main.js到文件夹

.pipe(rename({suffix: '.min'}))   //rename压缩后的文件名

.pipe(uglify())    //压缩

.pipe(gulp.dest('minified/js'));  //输出

});

执行压缩前,先删除文件夹里的内容

gulp.task('clean', function(cb) {

del(['minified/css', 'minified/js'], cb)

});

默认命令,在cmd中输入gulp后,执行的就是这个命令

gulp.task('default', ['clean'], function() {

gulp.start('minifycss', 'minifyjs');

});

 

Visual Studio 2012 / 2013 Update 1 2 3 4 5 Offline Installer

  1. Get the update from Microsoft here. (updated with Update 4 link)
  2. Save the file to a folder.
  3. open the folder
  4. Pro tip – Shift + right-click the background of the folder and choose ‘Open command window here’
  5. open_command_window
  6. in the command window type VS2013.4.exe /Layout
  7. (or VS2013.1.exe /Layout or VS2013.2.exe /Layout depending on your update)
  8. command_window
  9. It will then ask you where you would like to save and extract the files.
  10. vs2012_update_2_download_location
  11. This step will take some time depending on your download speed.  This is the step that adds time to the install when you choose the web installer.
  12. downloading_extracting_update_2
  13. You will now see a folder with the update installer along with all the source files.  You can now store this safe on a network share or your hard drive and update your installation of Visual Studio without downloading 2GB of files!
  14. vs2012_extracted
  15. This should work for any version of Visual Studio going forward.

Oracle Data Provider for .NET / ODP.NET connection strings

Using TNS

Data Source=TORCL;User Id=myUsername;Password=myPassword;

Example:

Data Source=localhost:1521/orcl; User Id=scott; Password=scott;

Using integrated security

Data Source=TORCL;Integrated Security=SSPI;

Using ODP.NET without tnsnames.ora

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));
User Id=myUsername;Password=myPassword;

Using the Easy Connect Naming Method (aka EZ Connect)

The easy connect naming method enables clients to connect to a database without any configuration.

Data Source=username/[email protected]//myserver:1521/my.service.com;

Port 1521 is used if no port number is specified in the connection string.

Make sure that EZCONNECT is enabled in the sqlnet.ora file. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

‘//’ in data source is optional and is there to enable URL style hostname values

Easy Connect Naming Method to connect to an Instance

This one does not specify a service or a port.

Data Source=username/[email protected]//instancename;

Easy Connect Naming Method to connect to a dedicated server instance

This one does not specify a service or a port.

Data Source=username/[email protected]/myservice:dedicated/instancename;

Other server options: SHARED, POOLED (to use instead of DEDICATED). Dedicated is the default.

Specifying Pooling parameters

By default, connection pooling is enabled. This one controls the pooling mechanisms. The connection pooling service creates connection pools by using the ConnectionString property to uniquely identify a pool.

Data Source=myOracle;User Id=myUsername;Password=myPassword;Min Pool Size=10;
Connection Lifetime=120;Connection Timeout=60;Incr Pool Size=5;Decr Pool Size=2;

The first connection opened creates the connection pool. The service initially creates the number of connections defined by the Min Pool Size parameter.

The Incr Pool Size attribute defines the number of new connections to be created by the connection pooling service when more connections are needed.

When a connection is closed, the connection pooling service determines whether the connection lifetime has exceeded the value of the Connection Lifetime attribute. If so, the connection is closed; otherwise, the connection goes back to the connection pool.

The connection pooling service closes unused connections every 3 minutes. The Decr Pool Size attribute specifies the maximum number of connections that can be closed every 3 minutes.

Restricting Pool size

Use this one if you want to restrict the size of the pool.

Data Source=myOracle;User Id=myUsername;Password=myPassword;Max Pool Size=40;
Connection Timeout=60;

The Max Pool Size attribute sets the maximum number of connections for the connection pool. If a new connection is requested, but no connections are available and the limit for Max Pool Size has been reached the connection pooling service waits for the time defined by the Connection Timeout attribute. If the Connection Timeout time has been reached, and there are still no connections available in the pool, the connection pooling service raises an exception indicating that the request has timed-out.

Disable Pooling

Data Source=myOracle;User Id=myUsername;Password=myPassword;Pooling=False;

Using Windows user authentication

Oracle can open a connection using Windows user login credentials to authenticate database users.

Data Source=myOracle;User Id=/;

If the Password attribute is provided, it is ignored.

Operating System Authentication is not supported in a .NET stored procedure.

Privileged Connections

Oracle allows database administrators to connect to Oracle Database with either SYSDBA or SYSOPER privileges.

Data Source=myOracle;User Id=myUsername;Password=myPassword;DBA Privilege=SYSDBA;

SYSOPER is also valid for the DBA Privilege attribute.

Runtime Connection Load Balancing

Optimizes connection pooling for RAC database by balancing work requests across RAC instances.

Data Source=myOracle;User Id=myUsername;Password=myPassword;Load Balancing=True;

This feature can only be used against a RAC database and only if pooling is enabled (default).

批处理

摘自网络

例一、先给出一个最easy的批处理脚本让大家和它混个脸熟,将下面的几行命令保存为name.bat然后执行(以后文中只给出代码,保存和执行方式类似):

ping sz.tencent.com > a.txt
ping sz1.tencent.com >> a.txt
ping sz2.tencent.com >> a.txt
ping sz3.tencent.com >> a.txt
ping sz4.tencent.com >> a.txt
ping sz5.tencent.com >> a.txt
ping sz6.tencent.com >> a.txt
ping sz7.tencent.com >> a.txt
exit

是不是都能看的懂?是不是很easy?但它的作用却是很实用的,执行这个批处理后,可以在你的当前盘建立一个名为a.txt的文件,它里面记录的信息可以帮助你迅速找到速度最快的QQ服务器,从而远离“从服务器中转”那一痛苦的过程。这里>的意思,是把前面命令得到的东西放到后面所给的地方,>>的作用,和>的相同,区别是把结果追加到前一行得出的结果的后面,具体的说是下一行,而前面一行命令得出的结果将保留,这样可以使这个a.txt文件越来越大(想到如何搞破坏了??)。By the way,这个批处理还可以和其他命令结合,搞成完全自动化判断服务器速度的东东,执行后直接显示速度最快的服务器IP,是不是很爽?后面还将详细介绍。

例二、再给出一个已经过时的例子(a.bat):

@echo off
if exist C:\Progra~1\Tencent\AD\*.gif del C:\Progra~1\Tencent\AD\*.gif
a.bat

为什么说这是个过时的例子呢?很简单,因为现在已经几乎没有人用带广告的QQ了(KAO,我的QQ还显示好友三围呢!!),所以它几乎用不上了。但曾经它的作用是不可小窥的:删除QQ的广告,让对话框干干净净。这里用的地址是QQ的默认安装地址,默认批处理文件名为a.bat,你当然可以根据情况自行修改。在这个脚本中使用了if命令,使得它可以达到适时判断和删除广告图片的效果,你只需要不关闭命令执行后的DOS窗口,不按CTRL+C强行终止命令,它就一直监视是否有广告图片(QQ也再不断查看自己的广告是否被删除)。当然这个脚本占用你一点点内存,呵呵。

例三,使用批处理脚本查是否中冰河。脚本内容如下:

@echo off
netstat -a -n > a.txt
type a.txt | find “7626” && echo “Congratulations! You have infected GLACIER!”
del a.txt
pause & exit

这里利用了netstat命令,检查所有的网络端口状态,只需要你清楚常见木马所使用的端口,就能很easy的判断出来是否被人种了冰河。然这不是确定的,因为冰河默认的端口7626,完全可以被人修改。这里介绍的只是方法和思路。这里介绍的是方法和思路稍做改动,就变成可以检查其他木马的脚本了,再改动一下,加进去参数和端口及信息列表文件后,就变成自动检测所有木马的脚本了。呵呵,是不是很过瘾?脚本中还利用了组合命令&&和管道命令|,后面将详细介绍。

例四,借批处理自动清除系统垃圾,脚本如下:

Continue reading “批处理”

UML Class Diagram Relationship总结

在UML类图中,常见的有以下几种关系: 泛化(Generalization),  实现(Realization),关联(Association),聚合(Aggregation),组合(Composition),依赖(Dependency)

1. 泛化(Generalization

【泛化关系】:是一种继承关系,表示一般与特殊的关系,它指定了子类如何特化父类的所有特征和行为。例如:老虎是动物的一种,即有老虎的特性也有动物的共性。 Continue reading “UML Class Diagram Relationship总结”