仓酷云

标题: NET网页编程之使用C#完成词频统计 [打印本页]

作者: 不帅    时间: 2015-1-16 14:25
标题: NET网页编程之使用C#完成词频统计
中间码是基于一个虚拟机器。源代码是最高层的,理论上从源代码开始直接编译成本地码能提供最大优化的。而中间码只能是转译成本地码,效率上难免受到损耗。根据虚拟机器所设定的体系结构的特点,和本地机器的差异的多少。未几说了,间接上源码:

usingSystem;
usingSystem.Drawing;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Windows.Forms;
usingSystem.Data;
namespaceWindowsApplication1
{
publicclassForm1:System.Windows.Forms.Form
{
privateSystem.Windows.Forms.TextBoxtextBox1;
privateSystem.Windows.Forms.TextBoxtextBox2;
privateSystem.Windows.Forms.Buttonbutton1;

privateSystem.ComponentModel.Containercomponents=null;

publicForm1()
{
InitializeComponent();
}

protectedoverridevoidDispose(booldisposing)
{
if(disposing)
{
if(components!=null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}

privatevoidInitializeComponent()
{
this.textBox1=newSystem.Windows.Forms.TextBox();
this.textBox2=newSystem.Windows.Forms.TextBox();
this.button1=newSystem.Windows.Forms.Button();
this.SuspendLayout();

this.textBox1.Location=newSystem.Drawing.Point(8,32);
this.textBox1.Multiline=true;
this.textBox1.Name="textBox1";
this.textBox1.ScrollBars=System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size=newSystem.Drawing.Size(176,344);
this.textBox1.TabIndex=0;
this.textBox1.Text="";

this.textBox2.Location=newSystem.Drawing.Point(328,32);
this.textBox2.Multiline=true;
this.textBox2.Name="textBox2";
this.textBox2.ScrollBars=System.Windows.Forms.ScrollBars.Both;
this.textBox2.Size=newSystem.Drawing.Size(168,344);
this.textBox2.TabIndex=1;
this.textBox2.Text="";

this.button1.Location=newSystem.Drawing.Point(216,8);
this.button1.Name="button1";
this.button1.TabIndex=2;
this.button1.Text="词频统计";
this.button1.Click+=newSystem.EventHandler(this.button1_Click);

this.AutoScaleBaseSize=newSystem.Drawing.Size(6,14);
this.ClientSize=newSystem.Drawing.Size(512,397);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name="Form1";
this.Text="Form1";
this.ResumeLayout(false);
}

[STAThread]
staticvoidMain()
{
Application.Run(newForm1());
}

privatevoidbutton1_Click(objectsender,System.EventArgse)
{
strings=textBox1.Text;
char[]c={,,,.,?,,:,;,!};
string[]ss=s.Split(c);
Hashtableha=newHashtable();

foreach(stringsssinss)
{
if(ha.Contains(sss))
{
ha[sss]=(int)ha[sss]+1;
}
else
{
ha.Add(sss,1);
}
}

foreach(DictionaryEntrydeinha)
{
textBox2.AppendText(de.Key+":"+de.Value+"
");
}

}
}
}
归根到底,Java跨平台可以,但是要重新编写代码,否则还分什么J2EE/J2SE/J2ME呢!
作者: 乐观    时间: 2015-1-18 14:19
众所周知,Windows以易用而出名,也因此占据不少的服务器市场。
作者: 分手快乐    时间: 2015-2-2 11:30
目前在微软的.net战略中新推出的ASP.net借鉴了Java技术的优点,使用CSharp(C#)语言作为ASP.net的推荐语言,同时改进了以前ASP的安全性差等缺点。但是,使用ASP/ASP.net仍有一定的局限性,因为从某种角度来说它们只能在微软的WindowsNT/2000/XP+IIS的服务器平台上良好运行(虽然像ChilliSoft提供了在UNIX/Linux上运行ASP的解决方案.
作者: 小女巫    时间: 2015-2-7 19:13
碰到复杂点的问题都不知道能不能解决,现在有点实力的公司都选择自已在开源的基础上做开发。但没听说过有人在IIS上做改进的,windows、sqlserver集群方面的应用也很少见。
作者: 山那边是海    时间: 2015-2-23 09:07
网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!
作者: 仓酷云    时间: 2015-3-7 07:35
提供基于组件、事件驱动的可编程网络表单,大大简化了编程。还可以用ASP.NET建立网络服务。
作者: 柔情似水    时间: 2015-3-14 16:53
可以看作是VC和Java的混合体吧,尽管MS自己讲C#内核中更多的象VC,但实际上我还是认为它和Java更象一些吧。首先它是面向对象的编程语言,而不是一种脚本,所以它具有面向对象编程语言的一切特性。
作者: 老尸    时间: 2015-3-21 13:21
弱类型造成潜在的出错可能:尽管弱数据类型的编程语言使用起来回方便一些,但相对于它所造成的出错几率是远远得不偿失的。




欢迎光临 仓酷云 (http://ckuyun.com/) Powered by Discuz! X3.2