月度归档:2013年12月

LINQ中.AsEnumerable() 和 .ToList() 的区别:

  • .AsEnumerable()延迟执行,不会立即执行。当你调用.AsEnumerable()的时候,实际上什么都没有发生。
  • .ToList()立即执行
  • 当你需要操作结果的时候,用.ToList(),否则,如果仅仅是用来查询不需要进一步使用结果集,并可以延迟执行,就用.AsEnumerable()/IEnumerable /IQueryable
  • .AsEnumerable()虽然延迟执行,但还是访问数据库,而.ToList()直接取得结果放在内存中。比如我们需要显示两个部门的员工时,部门可以先取出放置在List中,然后再依次取出各个部门的员工,这时访问的效率要高一些,因为不需要每次都访问数据库去取出部门。
  • IQueryable实现了IEnumberable接口。但IEnumerable 换成IQueryable后速度提高很多。原因:
    IQueryable接口与IEnumberable接口的区别: IEnumerable 泛型类在调用自己的SKip 和 Take 等扩展方法之前数据就已经加载在本地内存里了,而IQueryable 是将Skip ,take 这些方法表达式翻译成T-SQL语句之后再向SQL服务器发送命令,它并不是把所有数据都加载到内存里来才进行条件过滤。
  • IEnumerable跑的是Linq to Object,强制从数据库中读取所有数据到内存先。

使用viewport设置手机浏览器网页宽度

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
width:控制 viewport 的大小,可以指定的一个值,如果 600,或者特殊的值,如 device-width 为设备的宽度(单位为缩放为 100% 时的 CSS 的像素)。
height:和 width 相对应,指定高度。
initial-scale:初始缩放比例,也即是当页面第一次 load 的时候缩放比例。
maximum-scale:允许用户缩放到的最大比例。
minimum-scale:允许用户缩放到的最小比例。
user-scalable:用户是否可以手动缩放

Copy and Paste is not working on my Remote Desktop Connection… what’s wrong?

A very annoying occurrence that I sometimes suffer is when all of a sudden the copy and paste function stops working when I am connected to a remote machine. Turns out the problem is coming from a little process called rdpclip. Rdpclip (remote desktop clipboard) is responsible for managing a shared clipboard between your local host and the remote desktop (the process runs on the remote machine not your local host).

So what do I do when clipboard stops working?

Luckily fixing the issue is pretty straightforward and involves a few simple steps.

  1. Load up task manager (right click taskbar and select Task Manager)
  2. Go to the Processes Tab
  3. Select rdpclip.exe
  4. Click End Process
  5. Go to the Application Tab
  6. Click New Process
  7. Type rdpclip
  8. Click Ok

There, copy and paste should now work normally again.

It happens so often, this process is annoying! What do I do to fix it permanently?

Unfortunately I don’t know why rdpclip stops working nor how to fix it permanently; however, there is a way to make it easier if it happens often.

  • Create a new bat file and call it whatever you want say, clipboard.bat.
  • Write the following two commands on separate lines in the new bat file
    • Taskkill.exe /im rdpclip.exe
    • Rdpclip.exe
    • Save the bat file and drag it into the toolbar quick launch section

Now whenever your copy and paste operation fails to restore it, all you need to do is click this new batch file which will kill rdpclip and restart it. Still a workaround but at least it’s a quick procedure.

– See more at: http://www.gfi.com/blog/copy-paste-working-remote-desktop-connection-whats-wrong/#sthash.AhDKFvk7.dpuf