http://stackoverflow.com/questions/793897/check-if-keyvaluepair-exists-with-linqs-firstordefault 问题: I have a dictionary of type Dictionary<Guid,int> I want to return the first instance where a condition is met using var available = m_AvailableDict.…
问题:oadrunner录制时弹出invalid application path!please check if application exists对话框 原因:IE浏览器地址不对,需要手动重新选择IE浏览器路径 解决:我把浏览器的地址重新指向了一下 IE一般是:C:\Program Files\Internet Explorer\iexplore.exe 这样就可以啦!…
Sometime you need to check one prop exists on the object and value should not be ´null´ or ´undefined´. One problem people may occur with: const {get} = require('lodash') } const existing = typeof get(obj, 'a') !== undefined // true Here we missed if…
kill -0 pid sending the signal 0 to a given PID just checks if any process with the given PID is running and you have the permission to send a signal to it. $ man 2 kill If sig is 0, then no signal is sent, but error checking is still performed; this…
Restriction Operators Where - Simple public void Linq1() { , , , , , , , , , }; var lowNums = from n in numbers select n; Console.WriteLine("Numbers < 5:"); foreach (var x in lowNums) { Console.WriteLine(x); } } Where - Simple public void Lin…
更多LeetCode解题详解 Easy Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M). More formally check if there exists two indices i and j such that : i != j 0 <= i, j < arr.length arr[i]…
<果壳中的C# C# 5.0 权威指南> ========== ========== ==========[作者] (美) Joseph Albahari (美) Ben Albahari[译者] (中) 陈昇 管学理 曾少宁 杨庆川[出版] 中国水利水电出版社[版次] 2013年08月 第1版[印次] 2013年08月 第1次 印刷[定价] 118.00元========== ========== ========== [前言] C# 5.0 是微软旗舰编程语言的第4次重大升级. C# 5.…
原本我是使用批处理调用 MSBuild 完成解决方案编译的,新版的 MSBuild 在 Visual Studio 2015 会自带安装. 当然在Visual Studio 2015 中,MSBuild 是一个独立的安装包,可以单独安装,而无须安装 Visual Studio 2015. 刚开始,我在 Windows Server 2008 R2 上使用 MSBuild 编译使用 .NET Framework 4.5.2 版本 开发的项目,也不是那么顺利的. 期间,遇到并且解决了很多问题,依次顺…
petapoco是个基于T4模板的轻量级ORM,好用效率高,具体介绍略了 获取注释基本原理是调用数据库::fn_listextendedproperty函数,获取扩展属性MS_Description technet参考资料:sys.fn_listextendedproperty (Transact-SQL) 直接上代码 首先是PetaPoco.Core.ttinclude 106行原始: ... public string SequenceName; public bool Ignore; ..…
参考自这位大狮的:  https://github.com/Pencroff/Dapper-DAL/blob/master/Dapper-DAL/Models/ModelGenerator.tt 项目Demo下载 http://download.csdn.net/detail/qq_21533697/9904071 支持Oracle,MSSQL,SQLite Demo项目是个抽奖小程序,抽奖只用到了LuckDraw表 用的SQLite包含库方便直接运行 里面用到Dapper就只写了Model层的…
最近抽空做个小工具,使用AWSSDK 对本地文件目录监控,并自动同步上传文件到S3 的过程,使用的是多线程异步上传,针对大文件进行了分块 参考文献: https://www.codeproject.com/Articles/131678/Amazon-S-Sync https://aws.amazon.com/cn/documentation/s3/ Introduction The SprightlySoft S3 Sync application allows you to take a f…
sql的行转列(PIVOT)与列转行(UNPIVOT)   在做数据统计的时候,行转列,列转行是经常碰到的问题.case when方式太麻烦了,而且可扩展性不强,可以使用 PIVOT,UNPIVOT比较快速实现行转列,列转行,而且可扩展性强 一.行转列 1.测试数据准备 CREATE TABLE [StudentScores] ( [UserName] NVARCHAR(20), --学生姓名 [Subject] NVARCHAR(30), --科目 [Score] FLOAT, --成绩 )…
一.错误信息 Entity Framework 6.0数据迁移:Add-Migration XXXX 命令发生错误 System.Reflection.TargetInvocationException: 调用的目标发生了异常. ---> System.TypeInitializationException: “System.Data.Entity.SqlServer.SqlProviderServices”的类型初始值设定项引发异常. ---> System.TypeLoadExceptio…
1.ConnectionString,数据库链接 Web.config <configuration> <connectionStrings> <!-- 数据库 SQL Server --> <add name="ConnectionString" connectionString="Data Source=**IP地址**;Initial Catalog=**数据库名**;User ID=**用户名**;Password=**密码*…
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CA.TCP { using System.Net; using System.Net.Sockets; using System.Threading; using System.Configuration; class Program { sta…
第五篇 前言 本篇主要讲解图片缓存类的知识,虽然只涉及了图片方面的缓存的设计,但思想同样适用于别的方面的设计.在架构上来说,缓存算是存储设计的一部分.我们把各种不同的存储内容按照功能进行切割后,图片缓存便是其中的一个. 我们在封装自己的图片缓存管理对象的时候,SDWebImageCache能够提供大约90%的代码给我们直接使用,基于这些代码,我们需要分析出作者的设计思想是什么?当需要缓存某个列表时,基于SDWebImageCache的设计思想,我们就能够设计出比较合理的缓存管理对象了. 所谓举一…
异常处理汇总 ~ 修正果带着你的Net飞奔吧!http://www.cnblogs.com/dunitian/p/4599258.html 先参考:http://www.cnblogs.com/dunitian/p/4981572.html 网站部署好后==>继续404 网站日记如下: 2015-11-19 23:51:52,119 [15] ERROR log - System.InvalidOperationException: 未找到具有固定名称“System.Data.SqlClient…
1.Oracel数据库没有字段自增长属性,要实现自增长通常是通过查询序列或者触发器来实现的. 设置自增长主键 alter table SUB_SUBSCRIPTION add primary key(ID); ) NOT NULL AUTO_INCREMENT; 2.MySQL如何获取行号 MySQL中没有直接获取行号的函数,但是可以自己创建一个函数. -- 创建行号函数 CREATE FUNCTION func_rowNumber() RETURNS int NO SQL NOT DETERM…
Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the "right" of i. For any interval i, you ne…
首先,SDWebImage的git地址是:https://github.com/rs/SDWebImage.我们可以直接到这里进行下载,然后添加到自己的项目中去. 一.使用场景(前提是已经导入了SDWebImage这个库) 1.场景一.加载图片 使用SDWebImage可以去加载远程图片,而且还会缓存图片,下次请求会看一下是否已经存在于缓存中,如果是的话直接取本地缓存,如果不是的话则重新请求.使用方法很简单,在需要使用该场景的类中导入 //导入头文件#import "UIImageView+We…
转载来自: http://www.infocool.net/kb/PHP/201607/168683.html a 函数 说明 abs 绝对值 acos 反余弦 acosh 反双曲余弦 addcslashes 以 C 语言风格使用反斜线转义字符串中的字符 addslashes 使用反斜线引用字符串 apache_child_terminate 在本次请求结束后终止 apache 子进程 apache_getenv 获取 Apache subprocess_env 变量 apache_get_mo…
今天(周六)下午我在公司加班时不知道要干什么,就打开公司的一个wordpress项目网站,想看下之前自己做的一个网页是否有问题. 打开网站首页,我习惯性的打开了chrome的调试工具,然后鼠标开始滚动页面,然后问题就出来了:页面无法向下滚动,调试工具的console里报了好多undefined的错误. 我马上意识到是我写的js代码错误的在首页被执行导致的问题,我的代码大致是这样: if ($('#a')) { // some code ... $('#b').doSomething; // so…
以下是转载于网上的一个很好的config文件的实现,留存以备案 //Config.h #pragma once #include <string> #include <map> #include <iostream> #include <fstream> #include <sstream> /* * \brief Generic configuration Class * */ class Config { // Data protected:…
463. Island Perimeterhttps://leetcode.com/problems/island-perimeter/就是逐一遍历所有的cell,用分离的cell总的的边数减去重叠的边的数目即可.在查找重叠的边的数目的时候有一点小技巧,就是沿着其中两个方向就好,这种题目都有类似的规律,就是可以沿着上三角或者下三角形的方向来做.一刷一次ac,但是还没开始注意codestyle的问题,需要再刷一遍. class Solution { public: int islandPerime…
linux内核的linux-3.6.5\Documentation\kbuild\makefiles.txt Linux Kernel Makefiles This document describes the Linux kernel Makefiles. === Table of Contents === Overview === Who does what === The kbuild files --- 3.1 Goal definitions --- 3.2 Built-in obje…
function dateGetter(name, size, offset, trim) { offset = offset || 0; return function (date) { var value = date['get' + name](); if (offset > 0 || value > -offset) value += offset; if (value === 0 && offset == -12) value = 12; return padNumb…
UiAutomator自动化测试框架介绍 环境搭建 1         必要条件 1.1       JDK 1.2       SDK(API高于15) 1.3       Eclipse 2         简要步骤 2.1       安装JDK并添加bin目录到环境变量 2.2       添加SDK中的tools目录和platform-tools到环境变量 2.3       安装Eclipse并安装ADT插件 建立工程 1         用eclipse建立Java project…
Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the "right" of i. For any interval i, you ne…
上次一篇“你写的try…catch真的有必要吗”引起了很多朋友的讨论.本次我在code review又发现了一个问题,那就是有人有意无意的写出了return null这样的代码,例如: public User GetUser(Guid userId) { if ( /*for some reason*/) return null; return DB.GetByUserId(userId); } 这样的写法有木有问题? 在我看来没有充分的理由不应该返回null,因为方法的使用者并不知道在何种条件…
B 树(B-Tree)是为磁盘等辅助存取设备设计的一种平衡查找树,它实现了以 O(log n) 时间复杂度执行查找.顺序读取.插入和删除操作.由于 B 树和 B 树的变种在降低磁盘 I/O 操作次数方面表现优异,所以经常用于设计文件系统和数据库. B 树内的节点关系 B 树的定义 B 树的操作 B 树的变种 B+ 树的优势 B+ 树 C# 代码实现 在 1972 年,在 Boeing Research Labs 工作的 Rudolf Bayer 和 Ed McCreight 发明了 B 树.当时…