文章分类

站点统计

  • 分类总数: 13 个
  • 文章总数: 127 篇
  • 评论总数: 9 条
  • 附件总数: 49 个
  • 建站日期: 2008-08-18
  • 访问总数: 99114 人次
  • RSS订阅: 文章|评论


完成了AStyle的.Net调用接口[AStyle.Net.Interface]

Admin 于 2008-10-18 13:41:26 发表.Net

下载AStyle.Net.Interface.rar,然后在项目中引用AStyle.Net.dll:

  1. string input = File.ReadAllText("in.txt"); 
  2. string temp = ""
  3. temp = AStyle.Net.Interface.Format(input, "--mode=cs --style=ansi --indent=tab"); 
  4. File.WriteAllText("out.txt",temp.Trim()); 

 

被阅141次, 0票AStyle 发表评论

在.NET中使用Berkeley DB

Admin 于 2008-10-12 10:54:57 发表.Net

Berkeley DB是历史悠久的嵌入式数据库系统,早期主要应用在UNIX/LINUX操作系统上,现在也有大量的Windows应用程序使用Berkeley DB存储数据。Berkeley DB的存储的是key/value键值对,可以理解为硬盘上的超级hash表,可以管理256TB数据,而且能支撑几千个并发访问。BerkeleyDB 相关资料可以从这里下载:http://www.oracle.com/technology/products/berkeley-db/index.html
    由于SQLite只支持单写多读,大多数情况下无法满足大访问量Web站点应用的并发性要求;而DB4O的Embed模式完全不支持并发;可以考虑使用Berkeley DB作为Asp.Net的Embed数据库。

目前Berkeley DB官方有C++版和Java版。要想在.NET中使用,可以使用Berkeley DB for .NET的Binding(Wrapper)。Berkeley DB for .NET 最 新版本为0.95,支持BDB 4.3和4.5。下载到libdb-dotnet_0_95.zip后,解压,在解压缩后的bin目录找到libdb_dotNET45.dll,这就是 BDB 4.5的.NET Binding,在.NET项目中引用此DLL就可以开始使用了。

被阅120次, 0票Berkeley 发表评论

Mono 2.0发布:介绍及特性列表

Admin 于 2008-10-09 07:21:46 发表.Net


Mono
是一个多平台支持的开源的.NET framework的实现,支持的操作系统有Unix, Windows, MacOS 和一些其他操作系统。

Mono 2.0包括ADO.NET 2.0/ASP.NET 2.0/Windows.Forms 2.0/System.XML 2.0/System.Drawing/Linq/GTK#等类库的实现。还包括C# 3.0/VB 8/IL编译器和很丰富的工具。 这个release比1.x更为完整和成熟了。其中,C#编译器对C# 3的支持已经完整;标准库方面,WinForms 2.0的API已经完整支持,LINQ和ASP.NET的支持也比之前更为完善;执行引擎开始共享泛型代码后占用内存量减少了。

现在的MONO已经是完全胜任.NET 2.0的工作,并且有众多3.0的特性了,连Linq都有了,SQLite的Provider也有了,现在的MONO已经走出实验室,可以进行小规模的Linux平台上应用开发了。


Microsoft Compatible APIs

  • ADO.NET 2.0 API for accessing databases.
  • ASP.NET 2.0 API for developing Web-based applications.
  • Windows.Forms 2.0 API to create desktop applications.
  • System.XML 2.0: An API to manipulate XML documents.
  • System.Core: Provides support for the Language Integrated Query (LINQ).
  • System.Xml.Linq: Provides a LINQ provider for XML.
  • System.Drawing 2.0 API: A portable graphics rendering API.

Mono APIs

  • Gtk# 2.12: A binding to the Gtk+ 2.12 and GNOME libraries for creating desktop applications on Linux, Windows and MacOS X.
  • Mono.Cecil: A library to manipulate ECMA CLI files (the native format used for executables and libraries).
  • Mono.Cairo: A binding to the Cairo Graphics library to produce 2D graphics and render them into a variety of forms (images, windows, postscript and PDF).
  • Mono's SQLite support: a library to create and consume databases created with SQLite.
  • Mono.Posix: a library to access Linux and Unix specific functionality from your managed application. With both a low-level interface as well as higher level interfaces.

Third Party APIs bundled with Mono

  • Extensive support for databases: PostgreSQL, DB2, Oracle, Sybase, SQL server, SQLite and Firebird.
  • C5 Generics Library: we are bundling the C5 generics collection class library as part of Mono.

Compilers

These compilers are part of the Mono 2.0 release:

  • C# 3.0 compiler implementation, with full support for LINQ.
  • Visual Basic 8 compiler.
  • IL assembler and disassembler and the development toolchain required to create libraries and applications.

Tools

Mono includes profiling tools, the standard development kit tools that are part of the .NET framework

  • Debugger: this is the first release when we support a debugger for managed code.
  • Gendarme: is an extensible rule-based tool to find problems in .NET applications and libraries. Gendarme inspects programs and libraries that contain code in ECMA CIL format (Mono and .NET) and looks for common problems with the code, problems that compiler do not typically check or have not historically checked.
  • Mono Linker: a linker that allows developers to reduce the size of their executables and libraries by removing features from libraries using an XML definition of the desired public API.
  • Mono Tuner: a tool to apply arbitrary user-defined transformations to assemblies. Mono uses this library to produce the Silverlight core libraries from the main system libraries.
  • Mono Documentation Tools: the Mono Documentation framework has been upgraded to support documenting generics and extension methods. The tools can be used to produce online and offline documentation for any any APIs, and are used by the project to document our own APIs.

2.0 Release Notes: http://www.mono-project.com/Release_Notes_Mono_2.0

Mono Project Announces Mono 2.0 for Cross-Platform Microsoft .NET Development: http://www.novell.com/news/press/mono-project-announces-mono-2-0-for-cross-platform-microsoft-net-development/

Miguel de Icaza's :http://tirania.org/blog/archive/2008/Oct-06.html

被阅113次, 0票Mono 发表评论

微软修改了Managed Extensibility Framework(MEF)的协议

Admin 于 2008-10-09 06:51:24 发表.Net

      Managed Extensibility Framework(MEF)是.NET平台下的一个扩展性管理框架,它是一系列特性的集合,包括依赖注入(DI)以及Duck Typing等。MEF为开发人员提供了一个工具,让我们可以轻松的对应用程序进行扩展并且对已有的代码产生最小的影响,开发人员在开发过程中根据功能要 求定义一些扩展点,之后扩展人员就可以使用这些扩展点与应用程序交互;同时MEF让应用程序与扩展程序之间不产生直接的依赖,这样也允许在多个具有同样的 扩展需求之间共享扩展程序。进一步了解MEF可以看看TerryLee的文章:使用Managed Extensibility Framework方便的扩展应用程序

      MEF之前放到了CodePlex的时候所使用的协议并不是开源协议,MS-LPL或者叫Microsoft Limited Permissive,这个协议要求代码只能在Windows平台上运行,不能在*unix平台上运行,在这个项目在CodePlex上放出来后,在开发社区,包括Mono之父Miguel De Icaza 对它提出了批评,微软积极听取社区的意见,意识到开源社区的价值,Glenn宣布了将这个项目的协议更改为开源的 MS-PL 协议

      MEF现在采用MS-PL协议和社区的声音和微软员工的努力分不开,以及微软认同开源社区的价值。大家也许已经知道开源项目Castle项目的创始人Hamilton Verissimo,加入了微软,担任微软MEF项目经理,这是它在Msdn的 Hamilton Verissimo blog

      刚刚看到开源运动和MVP,里面有很多回帖,对微软和开源之间存在很大的误解,需要有时间来修正。微软已经改变了 Enterprise Library 4 源代码的许可协议, 以基于开源友好的 Microsoft Public License (Ms-PL) 许可协议发布,可以在Mono下使用Enterprise Library 4.0。微软还在CodePlex上开源的很多项目都将将有利于在Unix上通过Mono重用这些类库,繁荣开源社区。

被阅89次, 0票MEF 发表评论

介绍Reflexil

Admin 于 2008-10-05 07:08:02 发表.Net

Reflexil是一个.NET程序集编辑器,方便开发人员对.NET程序进行修改;可以作为一个Reflector插件修改程序集的IL并保存到磁盘文件,也可以在自己的.NET程序中调用进行更为灵活的.NET程序集修改。Reflexil使用的Mono.Cecil[作者:Jb Evain ]。

Reflexil是个开源项目,位于http://sourceforge.net/projects/reflexil/ ,作者:Sebastien LEBRETON ,blog:http://sebastien.lebreton.free.fr/blog/,使用GPL License。

下载最新版本

CodeProject上一篇详细介绍文章:Assembly Manipulation and C#/VB.NET Code Injection

被阅108次, 0票Reflexil Reflector 发表评论

Lucene.Net基本用法

Admin 于 2008-10-04 09:02:02 发表.Net

本文仅记录一些简单的使用方法,供初学者参考。[from:http://www.rainsts.net/article.asp?id=313]

被阅127次, 0票Lucene.Net 发表评论

.NET Interface(wrapper) of AStyle[uncompleted]

Admin 于 2008-10-02 05:24:55 发表.Net

被阅106次, 0票AStyle 发表评论

Lucene.Net简单应用

Admin 于 2008-10-01 02:24:25 发表.Net

Lucene.Net是一个性能很好的信息检索库(或者叫搜索引擎内核)。Lucene.Net提供一套完整的API供应用程序实现全文索引与精确查询功能。这里只描述最基本的应用:

 1、建立索引

  1. //state the file location of the index 
  2. string indexFileLocation = @"C:\Index";  
  3. Lucene.Net.Store.Directory dir = 
  4.     Lucene.Net.Store.FSDirectory.GetDirectory(indexFileLocation, true); 
  5.  
  6. //create an analyzer to process the text 
  7. Lucene.Net.Analysis.Analyzer analyzer = new 
  8. Lucene.Net.Analysis.Standard.StandardAnalyzer();  
  9.  
  10. //create the index writer with the directory and analyzer defined. 
  11. Lucene.Net.Index.IndexWriter indexWriter = new 
  12. Lucene.Net.Index.IndexWriter(dir, analyzer,  
  13.            /*true to create a new index*/ true);  
  14.  
  15. //create a document, add in a single field 
  16. Lucene.Net.Documents.Document doc = new 
  17. Lucene.Net.Documents.Document(); 
  18.  
  19. Lucene.Net.Documents.Field fldContent =  
  20.   new Lucene.Net.Documents.Field("content",  
  21.   "The quick brown fox jumps over the lazy dog"
  22.   Lucene.Net.Documents.Field.Store.YES,  
  23.   Lucene.Net.Documents.Field.Index.TOKENIZED,  
  24.   Lucene.Net.Documents.Field.TermVector.YES); 
  25.  
  26. doc.Add(fldContent); 
  27.  
  28. //write the document to the index 
  29. indexWriter.AddDocument(doc); 
  30.  
  31. //optimize and close the writer 
  32. indexWriter.Optimize();  
  33. indexWriter.Close(); 

 这里用到了5个主要类:Directory、Analyzer、IndexWriter、Document和Field。通过Directory 实例记录需要存储的索引;Analyzer用于分析目标文本;结合Directory与Analyzer创建IndexWriter实例;结合 Document实例与Field实例保存文档要被IndexWriter存储的内容。然后调用IndexWriter的Optimize方法与 Close方法。
    1、Lucene.Net.Store.Directory  - Directory代表目标索引目录。Lucene.Net中包含了两种实现:FSDirectory与RAMDirectory,分别将索引结果存放于 文件系统与内存。开发人员也可以通过继承Directory来实现自己的存储方法。
    2、Lucene.Net.Analysis.Analyzer - Analyzer用于将文本分割成词语或词组,同时可去除多余的词语(比如英语里的and、a、the等等)。StandardAnalyzer实例化时 可传递要忽略的词语列表,如果传递的参数为空则使用Lucene.Net默认的设置。开发人员可通过继承Analyzer实现自己的文档索引方式。
    3、Lucene.Net.Index.IndexWriter - 用于配合Analyzer将分析结果保存到Directory。
    4、Lucene.Net.Docuemnts.Docuemnt - 用于代表一封EMail、或者一个网页、一篇文章等。
    5、Lucene.Net.Documents.Field - Docement包含一个用于描述文档的Field列表。每个Field包括一个name与相应的value,其中value包含了可用于查询的文本。 Field.Store用于告诉IndexWriter将field的value保存到索引以便检索时取出。此外,Field.Index用于告诉 IndexWriter如何索引当前field,比如Field.Index.TOKENIZED表示将文本拆 分,Field.Index.UNTOKENIZED则相反。

2、在索引中进行查找

  1. //state the file location of the index 
  2. string indexFileLocation = @"C:\Index"
  3. Lucene.Net.Store.Directory dir = 
  4.     Lucene.Net.Store.FSDirectory.GetDirectory(indexFileLocation, true); 
  5.  
  6. //create an index searcher that will perform the search 
  7. Lucene.Net.Search.IndexSearcher searcher = new 
  8. Lucene.Net.Search.IndexSearcher(dir); 
  9.  
  10. //build a query object 
  11. Lucene.Net.Index.Term searchTerm =  
  12.   new Lucene.Net.Index.Term("content""fox"); 
  13. Lucene.Net.Search.Query query = new Lucene.Net.Search.TermQuery(searchTerm); 
  14.  
  15. //execute the query 
  16. Lucene.Net.Search.Hits hits = searcher.Search(query); 
  17.  
  18. //iterate over the results. 
  19. for (int i = 0; i < hits.Length(); i++) 
  20.     Document doc = hits.Doc(i); 
  21.     string contentValue = doc.Get("content"); 
  22.  
  23.     Console.WriteLine(contentValue); 

 涉及的类有:Directory、IndexSearch、Query、Hits、Term。其中Query有多种实现:TermQuery, BooleanQuery, PhraseQuery, PrefixQuery, PhrasePrefixQuery, RangeQuery, FilteredQuery, 及 SpanQuery。Lucene.Net.Search.Hits用于表示查找的结果。

被阅138次, 0票Lucene.Net 发表评论
1 / 7 / 49 | « 1 2 3 4 » |
Powered by MiniBoke v2.0.0.8 Build 0828

Copyright © 2008 开源吧!. All rights reserved.

粤ICP备07500939号