博客园 - feichexiauuid:24b78886-0ed1-41c2-8670-e3f31dcf42c4;id=1455522014-06-20T06:55:30Zfeichexiahttps://www.cnblogs.com/feichexia/feed.cnblogs.comhttps://www.cnblogs.com/feichexia/p/3495554.htmlJava程序性能优化Tip - feichexia本博客是阅读这本小书后整理的读书笔记性质博客,增加了几个测试代码,代码可以在此下载:java时空间性能优化测试代码,文件StopWatch是一个秒表计时工具类,它的代码在文末。1. 时间优化1.1 标准代码优化a.将循环不变量的计算移出循环 我写了一个测试例子如下:import util.StopWatch;/** * 循环优化: * 除了本例中将循环不变量移出循环外,还有将忙循环放在外层 * @author jxqlovejava * */public class LoopOptimization { public int size() { try { ...2013-12-28T09:17:00Z2013-12-28T09:17:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】本博客是阅读这本小书后整理的读书笔记性质博客,增加了几个测试代码,代码可以在此下载:java时空间性能优化测试代码,文件StopWatch是一个秒表计时工具类,它的代码在文末。1. 时间优化1.1 标准代码优化a.将循环不变量的计算移出循环 我写了一个测试例子如下:import util.StopWatch;/** * 循环优化: * 除了本例中将循环不变量移出循环外,还有将忙循环放在外层 * @author jxqlovejava * */public class LoopOptimization { public int size() { try { ... <a href="https://www.cnblogs.com/feichexia/p/3495554.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/p/MysqlDataBackup.htmlMySQL数据备份之mysqldump使用 - feichexiamysqldump常用于MySQL数据库逻辑备份。1、各种用法说明 A. 最简单的用法:mysqldump -uroot -pPassword [database name] > [dump file] 上述命令将指定数据库备份到某dump文件(转储文件)中,比如:mysqldump -uroot -p123 test > test.dump 生成的test.dump文件中包含建表语句(生成数据库结构哦)和插入数据的insert语句。 B. --opt 如果加上--opt参数则生成的dump文件中稍有不同: . 建表语句包含drop table if exists tableN..2013-10-24T10:48:00Z2013-10-24T10:48:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】mysqldump常用于MySQL数据库逻辑备份。1、各种用法说明 A. 最简单的用法:mysqldump -uroot -pPassword [database name] > [dump file] 上述命令将指定数据库备份到某dump文件(转储文件)中,比如:mysqldump -uroot -p123 test > test.dump 生成的test.dump文件中包含建表语句(生成数据库结构哦)和插入数据的insert语句。 B. --opt 如果加上--opt参数则生成的dump文件中稍有不同: . 建表语句包含drop table if exists tableN.. <a href="https://www.cnblogs.com/feichexia/p/MysqlDataBackup.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/06/09/3129889.html理解ASP.NET MVC中的模型绑定 - feichexia本文主要讲述ASP.NET MVC中模型绑定的概念及提供一些实际例子参考2013-06-09T12:13:00Z2013-06-09T12:13:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】本文主要讲述ASP.NET MVC中模型绑定的概念及提供一些实际例子参考 <a href="https://www.cnblogs.com/feichexia/archive/2013/06/09/3129889.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/05/28/3104832.htmlC#中的表达式树 - feichexia本人之前从未接触过表达式树的概念,所以特意从网上找到两篇这方面的资料学习了下。本文为阅读笔记性质博客! 表达式树是.NET 3.5之后引入的,它是一个强大灵活的工具(比如用在LINQ中构造动态查询)。 先来看看Expression类的API接口: using System.Collections.ObjectModel; namespace System.Lin...2013-05-28T14:29:00Z2013-05-28T14:29:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】本人之前从未接触过表达式树的概念,所以特意从网上找到两篇这方面的资料学习了下。本文为阅读笔记性质博客! 表达式树是.NET 3.5之后引入的,它是一个强大灵活的工具(比如用在LINQ中构造动态查询)。 先来看看Expression类的API接口: using System.Collections.ObjectModel; namespace System.Lin... <a href="https://www.cnblogs.com/feichexia/archive/2013/05/28/3104832.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/04/18/3029177.html【翻译】C#获取方法调用信息 - feichexia使用[CallerMemberName]、[CallderFilePath]和[CallerLineNumber]获取方法调用信息2013-04-18T10:12:00Z2013-04-18T10:12:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】使用[CallerMemberName]、[CallderFilePath]和[CallerLineNumber]获取方法调用信息 <a href="https://www.cnblogs.com/feichexia/archive/2013/04/18/3029177.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/04/06/3002111.html【转载】创建定制ASP.NET MVC视图引擎 - feichexiaASP.NET MVC started off with the premise of being a very ‘pluggable’ framework and we can see it almost everywhere. You can plug in any IoC container, Testing Framework even View Engines! There are two view engines provided by default - the WebForms View engine (views with .aspx extention) and the R2013-04-06T03:49:00Z2013-04-06T03:49:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】ASP.NET MVC started off with the premise of being a very ‘pluggable’ framework and we can see it almost everywhere. You can plug in any IoC container, Testing Framework even View Engines! There are two view engines provided by default - the WebForms View engine (views with .aspx extention) and the R <a href="https://www.cnblogs.com/feichexia/archive/2013/04/06/3002111.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/04/04/ChromePlugins.html【转载】27个Web开发者可以尝试的Chrome插件 - feichexia自Chrome推出以来,由于其极快的启动速度和页面加载速度、日益剧增的强大的插件以及简洁清新的界面,越来越受用户及开发者的欢迎,其市场占有率也在不断攀升,人们也相信,其取代IE、Firefox的地位也只是时间问题。在Chrome浏览器中,用户可以轻松添加各式各样的插件来提高日常工作的效率,这里我们为设计者和开发者精选了27款实用的Chrome插件,希望能够对您有所帮助。1. AppJump 应用程序发起者和管理者当您添加了以上插件后,您肯定会需要工具管理您的插件。 AppJump是一个Chrome插件,让您能从工具栏下拉菜单上快速找到并启动您的应用程序和其他插件。AppJump的一个很酷的功能2013-04-04T09:01:00Z2013-04-04T09:01:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】自Chrome推出以来,由于其极快的启动速度和页面加载速度、日益剧增的强大的插件以及简洁清新的界面,越来越受用户及开发者的欢迎,其市场占有率也在不断攀升,人们也相信,其取代IE、Firefox的地位也只是时间问题。在Chrome浏览器中,用户可以轻松添加各式各样的插件来提高日常工作的效率,这里我们为设计者和开发者精选了27款实用的Chrome插件,希望能够对您有所帮助。1. AppJump 应用程序发起者和管理者当您添加了以上插件后,您肯定会需要工具管理您的插件。 AppJump是一个Chrome插件,让您能从工具栏下拉菜单上快速找到并启动您的应用程序和其他插件。AppJump的一个很酷的功能 <a href="https://www.cnblogs.com/feichexia/archive/2013/04/04/ChromePlugins.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/03/29/2989390.htmlC#闭包解析 - feichexia闭包在计算机学上的定义如下:“In computer science, a closure is a first-class function with free variables that are bound in the lexical environment.”懂了没有?没懂,那么继续读下去。函数是一等公民(Your Functions Are First Class) 那么什么是”first-class function“?它是这样一种函数:我们的编程语言将它与一般数据类型同等对待。这意味着我么可以将一个函数赋值给一个变量、将函数作为参数传递或者像普通函数一样调用它…C#中可以通过匿2013-03-29T10:13:00Z2013-03-29T10:13:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】闭包在计算机学上的定义如下:“In computer science, a closure is a first-class function with free variables that are bound in the lexical environment.”懂了没有?没懂,那么继续读下去。函数是一等公民(Your Functions Are First Class) 那么什么是”first-class function“?它是这样一种函数:我们的编程语言将它与一般数据类型同等对待。这意味着我么可以将一个函数赋值给一个变量、将函数作为参数传递或者像普通函数一样调用它…C#中可以通过匿 <a href="https://www.cnblogs.com/feichexia/archive/2013/03/29/2989390.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/02/25/2932639.html【翻译】让你的网站飞起来 - feichexia翻译自:http://www.netmagazine.com/tutorials/make-your-sites-load-faster 速度对每个网站都至关重要。众所周知Google将网站速度作为搜索结果的一个衡量标准。这说明访问者更喜欢速度快的网站,这毫无争议! Jakob Nielsen在1993年写过一篇文章 the three limits of response ...2013-02-25T11:46:00Z2013-02-25T11:46:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】翻译自:http://www.netmagazine.com/tutorials/make-your-sites-load-faster 速度对每个网站都至关重要。众所周知Google将网站速度作为搜索结果的一个衡量标准。这说明访问者更喜欢速度快的网站,这毫无争议! Jakob Nielsen在1993年写过一篇文章 the three limits of response ... <a href="https://www.cnblogs.com/feichexia/archive/2013/02/25/2932639.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/02/21/2920802.htmlDaily Python 1: 元组转字典 - feichexiaDaily Python系列1:元组转字典2013-02-21T08:09:00Z2013-02-21T08:09:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】Daily Python系列1:元组转字典 <a href="https://www.cnblogs.com/feichexia/archive/2013/02/21/2920802.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/20/UnsafeJavaScriptAccessFrame.htmlUnsafe JavaScript attempt to access frame with URL https://xxx with URL http://xxx. - feichexiaUnsafe JavaScript attempt to access frame with URL https://xxx with URL http://xxx.The frame requesting access has a protocol of 'http', the frame being accessed has a protocol of 'https'. Protocols must match. 在做某铁道部网站的某个小工具时遇到这个问题。具体看下面截图: 追究其原因是因为http://www.12306.cn/mormhweb/kyfw/2013-01-20T05:57:00Z2013-01-20T05:57:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】Unsafe JavaScript attempt to access frame with URL https://xxx with URL http://xxx.The frame requesting access has a protocol of 'http', the frame being accessed has a protocol of 'https'. Protocols must match. 在做某铁道部网站的某个小工具时遇到这个问题。具体看下面截图: 追究其原因是因为http://www.12306.cn/mormhweb/kyfw/ <a href="https://www.cnblogs.com/feichexia/archive/2013/01/20/UnsafeJavaScriptAccessFrame.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/13/CSharp_SealedKeyword.htmlC# sealed关键词 - feichexiasealed 修饰符可以应用于类、实例方法和属性。 被sealed修饰的类是密封类,它不能被继承。 被sealed修饰的方法是密封方法。密封方法会重写基类中的方法,但其本身不能在任何派生类中进一步重写。当应用于方法或属性时,sealed 修饰符必须始终与 override一起使用。 在类声明中使用 sealed 修饰符可防止继承此类,例如:sealed class SealedClass { public int x; public int y;} sealed修饰类时,该类不能再被abstract修饰,即不能同时是抽象类和密封类。 此外,注意结构(s...2013-01-13T10:00:00Z2013-01-13T10:00:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】sealed 修饰符可以应用于类、实例方法和属性。 被sealed修饰的类是密封类,它不能被继承。 被sealed修饰的方法是密封方法。密封方法会重写基类中的方法,但其本身不能在任何派生类中进一步重写。当应用于方法或属性时,sealed 修饰符必须始终与 override一起使用。 在类声明中使用 sealed 修饰符可防止继承此类,例如:sealed class SealedClass { public int x; public int y;} sealed修饰类时,该类不能再被abstract修饰,即不能同时是抽象类和密封类。 此外,注意结构(s... <a href="https://www.cnblogs.com/feichexia/archive/2013/01/13/CSharp_SealedKeyword.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/11/2857111.html【转载】C# LINQ to SQL - feichexia1、Concat(连接不同的集合不会自动过滤相同项。会延迟计算) var q = (from c in db.Customers select c.Phone ).Concat( from e in db.Employees select e.HomePhone); var q = (from c in db.Cu...2013-01-11T14:03:00Z2013-01-11T14:03:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】1、Concat(连接不同的集合不会自动过滤相同项。会延迟计算) var q = (from c in db.Customers select c.Phone ).Concat( from e in db.Employees select e.HomePhone); var q = (from c in db.Cu... <a href="https://www.cnblogs.com/feichexia/archive/2013/01/11/2857111.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/10/2855358.htmlAttribute使用详解 - feichexia注意:Attribute翻译为特性,Property翻译为属性。本篇博客参考自多篇网络文章,不一一列举,但向那些博客的作者表示感谢. Attributes是一种新的描述信息,我们既可以使用attributes来定义设计期信息(例如 帮助文件,文档的URL),还可以用attributes定义运行时信息(例如,使XML中的元素与类的成员字段关联起来)。我们也可以用attributes来创建一个“自描述”的组件。Attribute与Java中的Annotation非常类似。1、C# AttributeUsage有三个属性: ValidOn:定义特性该在何种程序实体前放置,比如AttributeTa.2013-01-10T12:29:00Z2013-01-10T12:29:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】注意:Attribute翻译为特性,Property翻译为属性。本篇博客参考自多篇网络文章,不一一列举,但向那些博客的作者表示感谢. Attributes是一种新的描述信息,我们既可以使用attributes来定义设计期信息(例如 帮助文件,文档的URL),还可以用attributes定义运行时信息(例如,使XML中的元素与类的成员字段关联起来)。我们也可以用attributes来创建一个“自描述”的组件。Attribute与Java中的Annotation非常类似。1、C# AttributeUsage有三个属性: ValidOn:定义特性该在何种程序实体前放置,比如AttributeTa. <a href="https://www.cnblogs.com/feichexia/archive/2013/01/10/2855358.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/09/2853706.html监测EF和Linq to SQL产生的SQL - feichexia简单记录下,原文在:http://www.dotnetjalps.com/2012/12/Where-I-can-find-SQL-Generated-by-Entity-framework.html1、监测EF产生的SQLusing System;using System.Runtime.CompilerServices;using System.Linq;using System.Data; namespace EntityframeworkSQL{ class Program { static void Main(string[] args) { ...2013-01-09T13:47:00Z2013-01-09T13:47:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】简单记录下,原文在:http://www.dotnetjalps.com/2012/12/Where-I-can-find-SQL-Generated-by-Entity-framework.html1、监测EF产生的SQLusing System;using System.Runtime.CompilerServices;using System.Linq;using System.Data; namespace EntityframeworkSQL{ class Program { static void Main(string[] args) { ... <a href="https://www.cnblogs.com/feichexia/archive/2013/01/09/2853706.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/09/2853693.html【翻译】ASP.NET 4中的可扩展输出缓存 - feichexia翻译自:http://weblogs.asp.net/scottgu/archive/2010/01/27/extensible-output-caching-with-asp-net-4-vs-2010-and-net-4-0-series.aspx输出缓存的前世今生 ASP.NET 1.0引入输出缓存的概念,这使得开发者可以缓存页面、控件、控制器以及HTTP响应的输出到内存中。在后续的Web请求,ASP.NET就可以使用缓存中的内容更快响应。 ASP.NET的输出缓存系统足够灵活,使得我们可以根据不同的查询字符串或者表单post参数来缓存不同版本的内容。例如test.aspx?catego2013-01-09T13:33:00Z2013-01-09T13:33:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】翻译自:http://weblogs.asp.net/scottgu/archive/2010/01/27/extensible-output-caching-with-asp-net-4-vs-2010-and-net-4-0-series.aspx输出缓存的前世今生 ASP.NET 1.0引入输出缓存的概念,这使得开发者可以缓存页面、控件、控制器以及HTTP响应的输出到内存中。在后续的Web请求,ASP.NET就可以使用缓存中的内容更快响应。 ASP.NET的输出缓存系统足够灵活,使得我们可以根据不同的查询字符串或者表单post参数来缓存不同版本的内容。例如test.aspx?catego <a href="https://www.cnblogs.com/feichexia/archive/2013/01/09/2853693.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2013/01/04/2844873.htmlSQL优化建议备忘录 - feichexiaSQL优化2013-01-04T13:42:00Z2013-01-04T13:42:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】SQL优化 <a href="https://www.cnblogs.com/feichexia/archive/2013/01/04/2844873.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2012/12/31/2840806.html【翻译】优化JavaScript代码的几点建议 - feichexia客户端脚本能够使得应用更加具有吸引力,但是浏览器对脚本代码的解释执行可能也会导致效率低下。 这里我们探讨几个优化JavaScript代码的最佳实践建议。 1、处理字符串 字符串拼接在IE 6、7下的垃圾回收性能很差。虽然IE 8已经解决了这个问题。如果你的用户中有相当一部分人使用IE 6、7,那么你得谨慎构建你的字符串了。 比如这个例子...2012-12-31T09:03:00Z2012-12-31T09:03:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】客户端脚本能够使得应用更加具有吸引力,但是浏览器对脚本代码的解释执行可能也会导致效率低下。 这里我们探讨几个优化JavaScript代码的最佳实践建议。 1、处理字符串 字符串拼接在IE 6、7下的垃圾回收性能很差。虽然IE 8已经解决了这个问题。如果你的用户中有相当一部分人使用IE 6、7,那么你得谨慎构建你的字符串了。 比如这个例子... <a href="https://www.cnblogs.com/feichexia/archive/2012/12/31/2840806.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2012/12/29/ASPDoNET_DarkMagic_AsyncProgramming.htmlASP.NET MVC中的Dark Magic之异步编程 - feichexia参考自:http://www.codeguru.com/csharp/.net/net_asp/mvc/working-with-asynchronous-operations-in-asp.net-mvc.htm ASP.NET MVC 4加入了async关键词,使得异步编程变得很容易,但本文不是关于这个的,而是关于另外一个我没见过的实现ASP.NET MVC异步编程的方法,我估计很多人也没见过,所以我称之为Dark Magic(不常见但可能比较强大的东东)。 先看一段代码:public void Foo() { A(); B(); C();} A()、B()、C()如果是远程方...2012-12-28T18:03:00Z2012-12-28T18:03:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】参考自:http://www.codeguru.com/csharp/.net/net_asp/mvc/working-with-asynchronous-operations-in-asp.net-mvc.htm ASP.NET MVC 4加入了async关键词,使得异步编程变得很容易,但本文不是关于这个的,而是关于另外一个我没见过的实现ASP.NET MVC异步编程的方法,我估计很多人也没见过,所以我称之为Dark Magic(不常见但可能比较强大的东东)。 先看一段代码:public void Foo() { A(); B(); C();} A()、B()、C()如果是远程方... <a href="https://www.cnblogs.com/feichexia/archive/2012/12/29/ASPDoNET_DarkMagic_AsyncProgramming.html" target="_blank">阅读全文</a>https://www.cnblogs.com/feichexia/archive/2012/12/29/ASPDoNET_7_Best_Practices.html【翻译】7个ASP.NET MVC最佳实践 - feichexia翻译自:http://www.codeguru.com/csharp/.net/net_asp/mvc/top-10-asp.net-mvc-best-practices.htmASP.NET MVC是一个轻量级的、高度可测试的展示框架。问题:如何从ASP.NET MVC3迁移到ASP.NET MVC4?1、在web.config文件定位下面文本: System.Web.Mvc, Version=3.0.0.0 System.Web.WebPages, Version=1.0.0.0 System.Web.Helpers, Version=1.0.0.0 Sys...2012-12-28T16:59:00Z2012-12-28T16:59:00Zfeichexiahttps://www.cnblogs.com/feichexia/【摘要】翻译自:http://www.codeguru.com/csharp/.net/net_asp/mvc/top-10-asp.net-mvc-best-practices.htmASP.NET MVC是一个轻量级的、高度可测试的展示框架。问题:如何从ASP.NET MVC3迁移到ASP.NET MVC4?1、在web.config文件定位下面文本: System.Web.Mvc, Version=3.0.0.0 System.Web.WebPages, Version=1.0.0.0 System.Web.Helpers, Version=1.0.0.0 Sys... <a href="https://www.cnblogs.com/feichexia/archive/2012/12/29/ASPDoNET_7_Best_Practices.html" target="_blank">阅读全文</a>