惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - lovecherry

Java避坑宝典《Java业务开发常见错误100例》上线了 招聘前端、Java后端开发、测试、Mysql DBA 我的另一个博客 一个MVC框架的原型 有关网站UI实现的几种方式的讨论 httpmodule和httphandler配合的又一应用——合并脚本样式 - lovecherry - 博客园 如何把ASP.NET TRACE HANDLER的信息持久化保存 .NET 4.0改进(一) 到底怎么样的面试才是最公平的才能找到合适的人又不产生误判 最近项目的一些心得(纯贴代码) 有关CPU占用和缓存的一些见解,希望给大家一些启发 ADO.NET EF不方便之处(BUG)收集帖 2005-2008年度个人总结和写书计划? SOA概念误解实施要点 我对SOA的认识以及心得 MCTS Self-Paced Training Kit (Exam 70-503) Microsoft® .NET Framework 3.5—Windows® Communication Foundation 书评 【翻译】微软应用程序架构指南:如何组织应用程序的结构 代朋友发招聘信息,C++程序员 有关写书。。。。。。。。。。。
没有linq让我怎么活
lovecherry · 2009-03-06 · via 博客园 - lovecherry

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.IO;public partial class Default8 : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    {
        var data 
= new List<WordComponents>();
        (
new DirectoryInfo(Server.MapPath("data"))).GetFiles("*.xml").ToList().ForEach(file =>
            {
                XDocument doc 
= XDocument.Load(file.FullName);
                var q 
= from w in doc.Descendants("entry")
                        select 
new WordComponents
                        {
                            Word 
= w.Descendants("hw").FirstOrDefault().Value.Replace("_""").Replace("^"""),
                            idioms 
= (from i in w.Descendants("idiom")
                                      select i.Element(
"phrase").Value).ToList(),
                            phrases 
= (from p in w.Descendants("phraserec")
                                       select p.Element(
"phrase").Value).ToList() ,
                            phrasalverbs 
= (from pv in w.Descendants("phrasal_verb")
                                            select pv.Element(
"phrase").Value).ToList(),
                        };
                data.AddRange(q.ToList());
            }
        );

        var qu 

= from w in data orderby w.runons.Count + w.phrases.Count + w.phrasalverbs.Count descending select w;
        qu.Take(
500).ToList().ForEach(w => Response.Write(string.Format("<strong>{0}</strong> contains {4} elements (idiom count:{1}/phrase count:{2}/phrasal verb count:{3})<br/>", w.Word, w.idioms.Count, w.phrases.Count, w.phrasalverbs.Count, w.idioms.Count+ w.phrases.Count+ w.phrasalverbs.Count)));
    }
public class WordComponents
    {
        
public string Word { getset; }
        
public List<string> runons { getset; }
        
public List<string> idioms { getset; }
        
public List<string> phrases { getset; }
        
public List<string> phrasalverbs { getset; }public WordComponents()
        {
            runons 
= new List<string>();
            idioms 
= new List<string>();
            phrases 
= new List<string>();
            phrasalverbs 
= new List<string>();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.IO;
using System.Data;public partial class Default7 : System.Web.UI.Page
{
    
public class stat
    {
        
public string Name { getset; }
        
public string Value { getset; }
    }
protected void Page_Load(object sender, EventArgs e)
    {       
        var data 
= new List<stat>();
        (
new DirectoryInfo(Server.MapPath("data"))).GetFiles("*.xml").ToList().ForEach(file =>
            {
                XDocument doc 
= XDocument.Load(file.FullName);
                data.AddRange((from w 
in doc.Descendants("entry").Descendants()
                               
where w.Attribute("url"!= null
                               select 
new stat
                                  {
                                      Value 
= w.Attribute("url").Value,
                                      Name 
= w.Name.LocalName
                                  }).ToList());
            });

        (from d 

in data
         group d by d.Name into g
        select 
new { g.Key, Num = g.Count() }).ToList().ForEach(
         a 
=> Response.WriteLine(string.Format("{0}:{1}", a.Key, a.Num)));

    }
}

public static class ext
{
    
public static void WriteLine(this HttpResponse response, object o)
    {
        response.Write(o.ToString() 
+ "<br/>");
    }
}