- 180+ cognitive biases, codified and categorized by Buster Benson: Cognitive bias cheat sheet
- printed poster version: now available from Design Hacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.getJSON("/some/url", function (data) { | |
// Now use this data to update your view models, | |
// and Knockout will update your UI automatically | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 重置AD域用户的密码,设置AD用户头像和缩略图必须使用管理员权限才可以,普通用户的时候,系统会拒绝访问 | |
public bool ModifyAdUserAvatarJpegPhoto(DirectoryEntry userEntry,byte[] imgData) | |
{ | |
try | |
{ | |
string sAMAccountName = String.Empty; | |
#region sAMAccountName | |
if (userEntry.Properties.Contains("sAMAccountName")) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jsonp传输方式 | |
$.ajax({ | |
type: "get", | |
async: false, | |
url: "ajax.ashx", | |
dataType: "jsonp", | |
jsonp: "callbackparam", //传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(默认为:callback) | |
jsonpCallback: "success_jsonpCallback",//自定义的jsonp回调函数名称,默认为jQuery自动生成的随机函数名 | |
success: function (json) { alert(json); alert(json[0].name); }, | |
error: function () { alert('fail'); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//添加 | |
string id = txt_id.Text.Trim(); | |
string username = txt_username.Text.Trim(); | |
string ps = txt_ps.Text.Trim(); | |
string date = txt_date.Text.Trim(); | |
string conn_string ="Data Source=localhost;Initial Catalog=SQLtest;Integrated Security=True"; | |
SqlConnection connection =newSqlConnection(conn_string); | |
SqlCommand sqcommand =newSqlCommand("InsertInto", connection); | |
sqcommand.CommandType=CommandType.StoredProcedure;// 将命令变为存储过程的方式 | |
SqlParameter sp_id =newSqlParameter("ID", id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//匿名类型匿名方法 | |
namespace Anonymous_Type | |
{ | |
delegate void Speak(string a); | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//匿名类型 | |
var n = new {name = "school",age=25}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region 将DataTable转换为List对象 | |
/// <summary> | |
/// 利用反射将DataTable转换为List<T>对象 | |
/// </summary> | |
/// <param name="dt">DataTable 对象</param> | |
/// <returns>List<T>集合</returns> | |
public static List<T> DataTableToList<T>(DataTable dt) where T : class,new() { | |
// 定义集合 | |
List<T> ts = new List<T>(); | |
//定义一个临时变量 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTime.Now.ToString("ddHHmmssff") | |
DateTime.Now.ToString("yyyy-mm-dd") | |
DateTime.Now.ToString("D") //输出成"2016年11月16日" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dynamic dyn = 1; | |
int j = dyn; | |
//下面这句话会无法通过编译,typeof 运算符无法用在动态类型上 | |
//如果你是typeof(dynamic)会报typeof运算符无法用在动态类型上的错误 | |
//Console.WriteLine(typeof(dynamic)); | |
Console.WriteLine(typeof(List<dynamic>)); | |
//在大多数情况下, dynamic 类型与 object 类型的行为是一样的 | |
//但是,不会用编译器对包含 dynamic 类型表达式的操作进行解析或类型检查 | |
// 编译器将有关该操作信息打包在一起,并且该信息以后用于计算运行时操作 |
OlderNewer