代码改变世界

随笔档案-2010年02月

【转】 LINQ TO SQL中的selectMany

2010-02-28 11:34 by AnyKoro, 471 阅读, 收藏, 编辑
摘要: 首先看SelectMany的定义: Queryable中的SelectMany 方法:将序列的每个元素投影到一个 IEnumerable<(Of <(T>)>) 并将结果序列组合为一个 IQueryable<(Of <(T>)>) 类型的序列。(引用MSDN) 在用LINQ TO SQL 来写查询语句时,有一个selectMany的语句,它标示着一对多的关系,这篇文章我想说下在LINQ TO SQL中几种可以等同selectMany的用法。 系统转换成selectMany的条件: 1:语句中不包含join ,into; 2:需要2个以上的from 阅读全文

Entity framework and many to many queries unusable?

2010-02-28 00:20 by AnyKoro, 426 阅读, 收藏, 编辑
摘要: 2 3I'm trying EF out and I do a lot of filtering based on many to many relationships. For instance I have persons, locations and a personlocation table to link the two. I also have a role and personro... 阅读全文

LINQ: difference between Single(), First(), and Take(1)

2010-02-27 14:04 by AnyKoro, 687 阅读, 收藏, 编辑
摘要: LINQ provides a few different methods that return you a single object: Single(), First(), and Take(1).It took me a while, but I think I understand the difference: Single() operates on a collection of... 阅读全文

【转】LINQ的基本查询操作符

2010-02-27 13:57 by AnyKoro, 459 阅读, 收藏, 编辑
摘要: •Distinct - 过滤集合中的相同项;延迟 •Union - 连接不同集合,自动过滤相同项;延迟 •Concat - 连接不同集合,不会自动过滤相同项;延迟 •Intersect - 获取不同集合的相同项(交集);延迟 •Except - 从某集合中删除其与另一个集合中相同的项;延迟 •Skip - 跳过集合的前n个元素;... 阅读全文

向mvc controller传递json数组

2010-02-27 00:11 by AnyKoro, 7257 阅读, 收藏, 编辑
摘要: 对于这个主题我没有找到最合适的办法,只是找出了个可以暂时规避问题的方法。发到这里非常希望各位大侠,能给小弟些思路解决此问题。一开始的需求本想实现这么一个功能这里的后台的程序这个是我最一开始的程序,刚一开始,发现整个程序怎么也不起作用(可以传到后台),一顿调试,发现时没有把json数据字符串化,后来使用了jqueryToJSON进行了字符串化,字符串化后,limit可以认出了,但是对于数组格式的li... 阅读全文

Jquery的属性选择器

2010-02-25 19:53 by AnyKoro, 206 阅读, 收藏, 编辑
摘要: Attribute Filters:Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the '@' symbol from your selectors in order to make them work ... 阅读全文

SQL 2008 - Change ‘Edit Top 200 Rows"

2010-02-24 21:37 by AnyKoro, 582 阅读, 收藏, 编辑
摘要: SQL 2008 - Change ‘Edit Top 200 Rows"Well this is a great idea from Microsoft, but what if you want them all, or you want more then 200 rows like me, I am greedy, I like everything….Any w... 阅读全文

ASP.NET MVC 2博客系列之一:强类型HTML辅助方法

2010-02-23 09:15 by AnyKoro, 484 阅读, 收藏, 编辑
摘要: 【原文地址】ASP.NET MVC 2: Strongly Typed Html Helpers 【原文发表日期】 Sunday, January 10, 2010 8:57 PM 【除了写博客外,我现在还使用Twitter发短贴和共享链接。请通过twitter.com/scottgu跟随我。】 这是我针对即将发布的ASP.NET MVC 2所撰写的贴子系列的第一篇,这个博客贴子将讨论 ASP.N... 阅读全文

【转】ASP.net MVC自定义错误处理页面的方法

2010-02-22 08:43 by AnyKoro, 798 阅读, 收藏, 编辑
摘要: 在ASP.NET MVC中,我们可以使用HandleErrorAttribute特性来具体指定如何处理Action抛出的异常.只要某个Action设置了HandleErrorAttribute特性,那么默认的,当这个Action抛出了异常时MVC将会显示Error视图,该视图位于~/Views/Shared目录下.  设置HandleError属性  可以通过设置下面这些属性来更改HandleEr... 阅读全文

【转】常用正则表达式

2010-02-22 08:11 by AnyKoro, 218 阅读, 收藏, 编辑
摘要: 正则表达式用于字符串处理、表单验证等场合,实用高效。现将一些常用的表达式收集于此,以备不时之需。匹配中文字符的正则表达式: [\u4e00-\u9fa5]评注:匹配中文还真是个头疼的事,有了这个表达式就好办了匹配双字节字符(包括汉字在内):[^\x00-\xff]评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)匹配空白行的正则表达式:\n\s*\r评注:可以用来删除空白行匹配HTML标记的正则表达式:<(\S*?)[^>]*>.*?</\1>|<.*? />评注:网上流传的版本太糟糕,上面这个也仅仅能匹配部分,对于复杂的嵌套 阅读全文

Output caching in ASP.NET MVC application

2010-02-21 13:19 by AnyKoro, 627 阅读, 收藏, 编辑
摘要: Goal: Here, I am going to explain, how we can improve performance of ASP.Net MVC application using output caching. Advantage:It enables us to cache the content returned by Controller action.It stops c... 阅读全文

Sortable List using ASP.net MVC and jQuery

2010-02-21 10:28 by AnyKoro, 1531 阅读, 收藏, 编辑
摘要: Sorting is one of the most basic and essential algorithm form the early days of computation, In this article we will be discussing about sorting a list of items in a web application, this is one of th... 阅读全文

Hierarchical Treeview with ASP.NET MVC & jQuery

2010-02-21 10:22 by AnyKoro, 1010 阅读, 收藏, 编辑
摘要: First of all, an apology for being so quiet over the past few weeks. I've been putting my blogging aside for a while to chase some pet projects I'm working on. More on that later.I did, however, run i... 阅读全文

你的第一杯Web 2.0 —— 快速浏览jQuery、Spring MVC和XStream/Jettison

2010-02-21 09:43 by AnyKoro, 723 阅读, 收藏, 编辑
摘要: 不再有页面刷新:使用jQuery相关厂商内容免费迷你书下载:Flex入门指南——PHP开发者Flash Builder 4 Beta和FlexUnit下的测试驱动开发下载Flex 4 SDK,构建超级棒的Flex应用 使用Pixel Bender Toolkit制作特效——创建vintage tone过滤器(Part 2)在Flash Builder... 阅读全文

MVC JSON - JsonResult and jQuery

2010-02-21 09:22 by AnyKoro, 3046 阅读, 收藏, 编辑
摘要: The latest release of the MVC framework provides the JsonResult forController actions. I was surprised that I did not find a weatlh of examplesfor usage so I figured it shouldn't be too hard to get a ... 阅读全文

WCF REST & ASP.NET MVC authorization

2010-02-19 00:21 by AnyKoro, 1257 阅读, 收藏, 编辑
摘要: Last week I needed to implement an authorization scheme in our MVC and WCF apps. I found a bunch of resources on how to implement Role or Claims-based authorization in both frameworks, but they all re... 阅读全文

【转】VS 常用快捷键

2010-02-17 17:59 by AnyKoro, 206 阅读, 收藏, 编辑
摘要: 1 转到定义: F12; 2 设置书签:Ctr+K+K; 3 设置任务: //TODO:something,查看任务Ctrl+W+T; 4 查找:Ctrl+ F, Ctrl+Shift+F; 5 强迫智能感知:Ctrl+J; 6 强迫智能感知显示参数信息:Ctrl-Shift-空格; 7 格式化整个块:Ctrl+K+F; 8 全屏幕:Alt+Shift+Enter; 9 设置书签:Ctrl+B+T,跳转书签:Ctrl+B+N 10 检查括号匹配(在左右括号间切换): Ctrl +] 11 选中从光标起到行首(尾)间的代码: Shift + Home(End) 12 在方法定义和调用之点切换:C 阅读全文

[转]jQuery and JavaScript CSS !important

2010-02-17 11:40 by AnyKoro, 951 阅读, 收藏, 编辑
摘要: Everyone who is familiar with CSS !important statement understood that it means that the style have the highest priority regardless of other priority. However, !important should be avoided as much as possible and order priority should be practice in CSS instead. In jQuery, there are times when we ne 阅读全文

【转】CSS优先级

2010-02-17 11:31 by AnyKoro, 287 阅读, 收藏, 编辑
摘要: CSS样式使用优先级判断修正前,再次谢谢hax的指点。最正确的说法:http://www.w3.org/TR/CSS21/cascade.html#specificity参见这里的相关内容,一下只是我个人偷懒的理解方式,只解决常规情况下的绝大部分问题。不是预期使用的样式,如何判断那个样式会最终起作用呢?到底谁说了算,可以依据下面几个原则:CSS样式定义多了,常常出现显示效果与预期不一致的情况。其中... 阅读全文

ADO.NET Entity Framework : Working with Stored Procedure

2010-02-17 00:17 by AnyKoro, 453 阅读, 收藏, 编辑
摘要: Here we go, I generally get questions from developers that if they will have to scrub the existing powerful stored procedure they have written by investing time and money. The answer to that is &ldquo... 阅读全文

Using stored procedures with ADO.NET entity framework

2010-02-17 00:17 by AnyKoro, 664 阅读, 收藏, 编辑
摘要: IntroductionAt Info Support we work with stored procedures in SQL 2000/2005 to access our data, this has a couple of advantages, like decoupling the interface from the actual table structure, reduce t... 阅读全文

[转] Entity Framework Stored Procedure Generation

2010-02-17 00:16 by AnyKoro, 744 阅读, 收藏, 编辑
摘要: At work my team and I are utilizing the ADO.NET Entity Framework as a means to mitigate the object-relational impedance mismatch. Simply put, we’re utilizing it as an object-relational mapper fo... 阅读全文

[转]详解ASP.NET 4中的URL Routing功能

2010-02-16 17:37 by AnyKoro, 472 阅读, 收藏, 编辑
摘要: 本文将从URL Routing的概念开始讲起,同时介绍ASP.NET 4.0中关于URL Routing的功能问题。希望本文能对大家有所帮助。 什么是URL Routing 首先,URL routing其实在ASP.NET 5 SP1中就被引入了,但是介于之前一直没有用到,况且微软的很多关于ASP.NET 4的介绍都本文将从URL Routing的概念开始讲起,同时介绍ASP.NET 4.0中关于... 阅读全文

IIS Search Engine Optimization Toolkit,sitemap

2010-02-16 14:18 by AnyKoro, 207 阅读, 收藏, 编辑
摘要: IIS Search Engine Optimization ToolkitManaging robots.txt and SitemapsUsing IIS Search Engine Optimization ToolkitUsing Site Analysis to crawl a web siteUsing Site Analysis ReportsIIS Site Analysis - ... 阅读全文

使用JQuery进行WCF通信的学习记录

2010-02-15 10:51 by AnyKoro, 324 阅读, 收藏, 编辑
摘要: 先架设一个wcf服务,然后,需要住的是在对应的协议上添加上: [OperationContract] [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] ForTestDat... 阅读全文

发两个javascript文件的工具

2010-02-14 17:56 by AnyKoro, 161 阅读, 收藏, 编辑
摘要: jslint,jsmin,前者是验证JavaScript代码质量的,后者是压缩工具,就是去除空格和解释对应的网址分别是http://www.jslint.com/,http://fmarcia.info/jsmin/test.html 阅读全文

[转]Nested MasterPage Not Firing Page_Load Event

2010-02-14 15:10 by AnyKoro, 249 阅读, 收藏, 编辑
摘要: Nested MasterPage Not Firing Page_Load EventI faced a situation today where I am trying to attach to the page_load event of a child nested master page to load some data on the master page itself. The ... 阅读全文

[转]jQuery教程:jQuery 1.4新特性及其变化

2010-02-14 14:20 by AnyKoro, 482 阅读, 收藏, 编辑
摘要: 为庆祝jQuery的四周年生日,jQuery官方团队正式发布了jQuery的1.4版本。在这个版本中,jQuery官方团队做了大量的编码、测试和文档工作,相对之前版本自然改进不少,让我们一起来看看有那些新变化吧。本文分上下两篇,上篇主要总体介绍jQuery 1.4版本的相关使用及更新,下篇通过一些代码示例来展示更新的方法及新添加的方法。【下载及调用】像以往一样,官方提供了jQuery的两份拷贝,一... 阅读全文

[转]Routing with ASP.NET Web Forms

2010-02-14 00:30 by AnyKoro, 491 阅读, 收藏, 编辑
摘要: Routing with ASP.NET Web FormsScott Allen Code download available from the MSDN Code Gallery Browse the Code Online Contents What Is Routing? A Brief History of URL Rewriting Of Routes and Route Handl... 阅读全文

VS里面的快捷键

2010-02-10 11:38 by AnyKoro, 750 阅读, 收藏, 编辑
摘要: 这个下面列举了,vs中的各种快捷键应用。由于本人翻译不好,如果有错误敬请见谅。另外,翻译是逐步逐步进行的。不好意思了,本人懒。。。。一般 快捷键     描述 Ctrl-X orShift-Delete剪切当前所选项到剪贴版 Ctrl-C orCtrl-Insert复制当前所选项到剪贴版 Ctrl-V orShift-Insert粘贴剪贴板项目 Ctrl-Z orAlt-Backspace撤销先前... 阅读全文

[转载]IP to Integer

2010-02-09 08:55 by AnyKoro, 399 阅读, 收藏, 编辑
摘要: 有时候我们要判断某个IP是否在某个段内,如何实现呢? 一个简单办法就是把IP转换成Integer,然后判断整数是否在某个范围内就可以实现这个判断。转换的算法如下:比如我们要转换的IP为: 058.062.042.000First Octet: 058 Second Octet: 062 Third Octet: 042 Fourth Octet: 000 计算公式如下: (first octet ... 阅读全文

[WPF]The differences between Text Box and Text Block in Blend

2010-02-07 19:15 by AnyKoro, 311 阅读, 收藏, 编辑
摘要: Both TextBlocks and TextBoxes can be used to display text, they can be set to specific Height and Width or be set to Auto so that they grow in size with the text. They can both set font size, font typ... 阅读全文

[转]URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series)

2010-02-07 19:02 by AnyKoro, 439 阅读, 收藏, 编辑
摘要: URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series) [In addition to blogging, I have recently been using Twitter to-do quick posts and share links. You can follow me on Twitter at: www.... 阅读全文

如何解决ado.net entity framework的使用,再别的调用项目中依然正常

2010-02-06 21:36 by AnyKoro, 523 阅读, 收藏, 编辑
摘要: ado.net entity framework,在生产实体模型后。会生成一长串的connectionstring。如果此时你又新建了一个project,去调用原先放实体模型的project中的实体模型。这个时候就会发现问题,他总会抛出异常。。。具体的忘记了,大致意思说是找不到有效地连接字符串。此时,如果要解决的,最简单的办法就是直接把放实体模型的项目的config文件复制到调用的那个项目中。这样... 阅读全文

[转]理解REST软件架构

2010-02-04 22:12 by AnyKoro, 301 阅读, 收藏, 编辑
摘要: 一种思维方式影响了软件行业的发展。REST软件架构是当今世界上最成功的互联网的超媒体分布式系统。它让人们真正理解我们的网络协议HTTP本来面貌。它正在成为网络服务的主流技术,同时也正在改变互联网的网络软件开发的全新思维方式。AJAX技术和Rails框架把REST软件架构思想真正地在实际中很好表现出来。今天微软也已经应用REST并且提出把我们现有的网络变成为一个语义网,这种网络将会使得搜索更加智能化... 阅读全文

【翻译】ado.net entity framework FAQ-1

2010-02-04 20:37 by AnyKoro, 442 阅读, 收藏, 编辑
摘要: 1. 介绍1.1. 关于这个FAQ…你可以在这个网址(http://blogs.msdn.com/dsimmons/pages/entity-framework-faq.aspx)找到最新的EF的FAQ. 这个FAQ是来源于许多博客和论坛的.还有很多相关问题的问题没有能收录进来。1.2. 哪里是我能够获得更多EF知识的地方?在网上有很多优秀的资源,这里仅仅提供一些,以开始之用:MSD... 阅读全文
点击右上角即可分享
微信分享提示