[Flex]Flex开源项目集合

mikel阅读(842)

一些不错的开源Flex项目

 

********************************************************************************************

Flex开源项目

********************************************************************************************

1. Flexbox

http://flexbox.mrinalwadhwa.com/

这是一位来自印度的flex开发者在07年2月份建立的flex组件库,里面也有不少好东西。

 

2. Flexlib

http://code.google.com/p/flexlib/

由Dougmccune等人建立的flex组件库,其中有不少实用的组件。

 

3.SpringGraph Flex Component

http://mark-shepherd.com/blog/springgraph-flex-component/

非常酷的拓扑关系组件!

 

4.Flex Visual Graph Library

http://code.google.com/p/flexvizgraphlib/

又一个拓扑图形展示的类库,动态效果那叫“惊艳”!

该项目的讨论组:

http://groups.google.com/group/flexvizgraphlib

 

5. Open Source Framework for Flex / Flash & AIR(Apollo)

http://code.google.com/p/advancedflex/

The Advanced Flex project is open source Libraries & Framework for Adobe Flex & Flash developer. This is the framework written in AS3.0 & MXML for Flex & Flash & AIR(Apollo).看起来里面涉及到了AOP及Debugger等内容,有时间要好好看看了。

 

6. Open Source Flex Component: TreeMap

http://www.zeuslabs.us/2007/11/14/open-source-flex-component-treemap/

 

7. FlexMDI

http://code.google.com/p/flexmdi/

主要解决多窗口应用生成的问题,全名叫做:Flex Multiple Document Intece ,效果很不错,对于做基于窗口的应用来说是个好的起点。

 

8. 反射组件类reflexutil

http://code.google.com/p/reflexutil/

这是作者的博客:

http://blog.deconcept.com/

 

9. 对象处理器flex-object-handles

http://code.google.com/p/flex-object-handles/

作者对该组件的介绍:

http://rogue-development.com/objectHandles.xml

WIKI:

http://code.google.com/p/flex-object-handles/wiki/ObjectHandlesUsage

功能是很强大,不过要想自己使用,还需修改一番!

 

10.CheckboxTree和Carousel组件

http://giles.roadnight.name/components.cfm

都有演示和源码!

 

11.Flex拖拽库

http://code.google.com/p/flex-drag-n-drop-lib/

新鲜出炉的类库,太棒了,以后做拖拽处理就方便多了!

 

12. birdeyehttp://code.google.com/p/birdeye/该项目是一个比较庞大的项目涉及数据可视化的多个方面:

关系分析展示:

Relational Analysis ([/b]RaVis)[/b]

空间信息分析展示:

GeoSpatial Analysis (GeoVis)[/b]

数值分析展示:

Quantitative Analysis (QaVis)

[/b]历史数据分析

Temporal Analysis (TaVis)

[/b]变形类库:

General Utility (GuVis)[/b]

 

13.antennae

http://code.google.com/p/antennae/

基于ant的Flex工程编译模版,内置FlexUnit等测试工具,很强大的说。

 

14.Degrafa:声明式的图形描述框架

官方网站

http://www.degrafa.com/

googlecode:

http://code.google.com/p/degrafa/

演示:

http://samples.degrafa.com/

个人还是喜欢用AS3和flashIDE来绘图,不太喜欢这个东西。不过这可框架有专门的组织来推动,似乎前景不错!

 

15.openflux

号称是 an open-source Flex component framework which allows developers to create radically new and custom Flex components,似乎是基于下一代Flex组件标准,但是目前还没看到更多的东西。只有这个:

http://www.bobjim.com/2008/04/04/updated-plexiglass-openflux-3d-example/

该项目的GoogleCode:

http://code.google.com/p/openflux/16.FlexReport

http://code.google.com/p/flexreport/

作者博客:

http://www.kemelyon.com/bts/

一个开源的客户端报表生成组件,目前唯一不足的是不能消除字体的锯齿问题,不过只要不放大字体,应该没问题

 

 

********************************************************************************************

AS3开源项目

********************************************************************************************

 

1.Flex/Actionscript Math Library

http://code.google.com/p/as3mathlib/

The Flex/Actionscript Math Library (as3mathlib) is intended to provide a rudimentary numerical analysis toolkit for the Actionscript/Flex programming environment.一个很不错的基础项目,不过看起来还没有完成:This library has just been converted from Actionscript 2 to Actionscript 3. It is not ready for general use.

 

2.ActionScript 3.0 library for several basic utilities

http://code.google.com/p/as3corelib/

AS3核心类库,里面有包括加密、图形文件编码等等类库。

 

3.alivepdf

http://code.google.com/p/alivepdf/

是一个Open-source AS3 PDF library,目的在于将flash内容转为pdf文件信息,通过后台程序来生成pdf文件。

 

4.Tweener

http://code.google.com/p/tweener/

A class for creating tweens in actionscript 2 and 3 – because there’s infinity between 0 and 1.

 

5.ActionScript 3 libraries for interactive visualizations on the web

http://flare.prefuse.org/

刚(10.22.2007)发布的数据可视化工具包,目前alpha版,不过有不少亮点了,很有希望。

 

 

6.Dependency injection / Inversion of control container for ActionScript 3, Flash 9, and Flex 2

http://code.google.com/p/di-as3/

 

7.as3ds

http://code.google.com/p/as3ds/

AS3 Data Structures For Game Developers以前记得这个好像是收费的,现在看起来没限制的使用了。

 

 

8.Pulse粒子系统作者对该系统的介绍:

http://www.rogue-development.com/pulseParticles.htmlGoogle code:

http://code.google.com/p/pulse-particle/演示地址:

http://rogue-development.com/pulse/explorer/

 

 

9.AS3 GIF Player Class

http://www.bytearray.org/?p=95

GoogleCode:

http://code.google.com/p/as3gif/

 

10.AS3的物理引擎(ActionScript 3 Physics Engines)

http://henryjones.us/articles/actionscript-3-physics-engines

 

 

11. 数据可视化类库Prefuse

http://flare.prefuse.org/

the flare visualization toolkit:ActionScript 3 libraries for interactive visualizations on the web.

 

 

12.文档解析类库:vanrijkom-flashlibs

http://code.google.com/p/vanrijkom-flashlibs/其中最有用的可能是地图文件和3D文件的解析类库了!

 

13.MinimalComps: Minimal AS3 UI Component Set

http://www.bit-101.com/blog/?p=1126

 

 

14.GoogleMap Flash Intece

http://code.google.com/p/google-maps-flash-intece/

可惜的是written in ActionScript 2,不过应该有借鉴意义。

 

 

15.ScaleBitmap : 9-slice bitmap class

http://www.bytearray.org/?p=118

一个缩放位图的类,很有用!

 

16.开源AS3即时通讯类库XIFF

http://www.igniterealtime.org/projects/xiff/

 

17.另一粒子系统Flint Particle system

http://flintparticles.org/

 

 

******************************************************************************

AS3 3D项目

********************************************************************************************

 

1. PV3D虽然该项目发布不长时间,但是它已经名声远扬了,遗憾的是这段时间它的官方博客不能访问了,只能访问它其他网站

Google code

http://code.google.com/p/vision3d/

Wiki

http://wiki.vision3d.org/

John Grden

http://www.rockonflash.com/blog/

 

2. away3D:官方网站:

http://www.away3d.com/google code:

http://code.google.com/p/away3d/同pv3d一样,是基于actionscript 3的flash3D引擎:

Away3D is a realtime 3d engine for flash in actionscript 3, originally derived from Papervision3D

 

************************************************************************************

与JS相关类库

************************************************************************************

 

1.SWFAddress

http://www.asual.com/swfaddress/

项目地址:

http://sourceforge.net/projects/swfaddressSWFAddress is a small, but powerful library that provides deep linking for Flash and Ajax. It’s a developer tool, allowing creation of unique virtual URLs that can point to a website section or an application state. SWFAddress enables a number of important capabilities which are missing in today’s rich web technologies该类库解决了swf的难题,深度链接,也是flex3的一个重要特色,值得关注!2. 不可不提的swfobject

http://code.google.com/p/swfobject/

SWFObject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file

 

3.HTMLWrapper

http://code.google.com/p/htmlwrapper

Motion & Color Inc. today open-sourced a public beta version of

Wrapper, formerly used for closed-sourced projects. Wrapper is a

cross-browser compliant HTML/CSS rendering engine written in

ActionScript that sits on top of your standards compliant HTML page.

Wrapper eliminates cross-browser issues and makes integrating

ActionScript and HTML/CSS projects possible without needing to

compile. Wrapper will be available free from

 

***********************************************************************************

企业级组件库

********************************************************************************************

 

1.YahooFlex/Flash组件ASTRA GaloreASTRA Galore: New Flash and Flex Components

http://www.yswfblog.com/blog/2008/01/30/astra-galore-new-flash-and-flex-components/

官方的话是这么说的:

Our ASTRA library of components has just been updated with three new Flash components and seven (yeah, we are serious about this) new Flex components, as well as some important updates to the existing ones.Yahoo,真棒!

 

***********************************************************************************

ROR与Flex相关类库

***********************************************************************************

 

1.The Ruby on Rails RIA SDK by Adobe

http://code.google.com/p/rubyonrails-ria-sdk-by-adobe/

 

2. as3Stomp – Project site and source code

http://flexonrails.net/?p=99

该项目在Googlecode地址:

as3-stomp

This library is an actionscript 3 implementation of the Stomp protocol. It enables communication between Flash or Flex and any Stomp broker.It has been primarily designed to work with Apache ActiveMQ.

 

 

*************************************************************************************

测试类库

********************************************************************************************

 

1. 使用FlexUnit

http://www.adobe.com/devnet/flex/articles/unit_testing.html

http://code.google.com/p/as3flexunitlib/2. 可视化Flex单元测试框架visualflexunit:

Announcing Visual FlexUnit – A Visual Testing Extension for FlexUnit该项目的home page在google code。

作者Douglas McCarroll与合作公司Allurent共同建立了这个项目,并开源供大家使用。

 

 

**************************************************************

FlexMap组件

********************************************************************************************

 

1. uMap(免费)

homepage:

http://www.afcomponents.com/components/umap_as3/

demos:

http://ccgi.arutherford.plus.com/website/flex/UMap/UMapFlexDemo/

mouSEOver to to show picture:

http://ccgi.arutherford.plus.com/website/flex/modestmaps/sampleCCTV/

 

2.modesMap(开源)

homepage:

http://modestmaps.com/

demos:

http://modestmaps.com/example.html

http://modestmaps.com /tutorial-actransit /actransit.html

 

 

************************************************************************

Flex 框架类库

********************************************************************************************

 

1、针对Cairngorm的扩展框架:Flexcairngoamhttp://code.google.com/p /flexcairngorm/Adobe官方的cairngorm框架早就被人们诟病,这次这个非官方的补充,看来是个容易让人接受的框架了!

[Adobe]Adobe Creative Suite 4 Production Premium F

mikel阅读(836)


Adobe Creative Suite 4设计开发套装已经登场,诸多新特性让人眼前一亮,但同时也对电脑软硬件配置提出了新的要求。
Adobe CS4分为六个子套装,各自包含不同的程序组件和共享服务,面向不同层次的设计师,因此对系统的具体要求也略有不同,比如Master Collection就是最苛刻的,Web和Deisgn系列则轻松一些。







Adobe® Creative Suite® 4 Production Premium 软件是需要通过广播、在线和设备按时制作出世界级视频、音频和交互式媒体的创意专业人士不可或缺的解决方案。

获取更多详细信息 (美国站点)*

包含组件如下:
After Effects CS4
Adobe Premiere Pro CS4
Photoshop CS4 Extended
Flash CS4 Professional
Illustrator CS4
Soundbooth CS4
Adobe OnLocation CS4*
Encore CS4*
Adobe Bridge CS4
Adobe Device Central CS4
Dynamic Link
 

语言版本本产品提供以下语言版本:

  • 英语
  • 法语
  • 德语
  • 意大利语
  • 日语
  • 朝鲜语 (仅限 Windows)
  • 西班牙语

系统要求Windows

  • DV 需要 2GHz 或更快的处理器; HDV 需要 3.4GHz 处理器; HD 需要双核 2.8GHz 处理器**
  • Microsoft® Windows® XP (带有 Service Pack 2, 推荐 Service Pack 3) 或 Windows Vista® Home Premium、Business、Ultimate 或 Enterprise (带有 Service Pack 1, 通过 32 位 Windows XP 以及 32 位和 64 位 Windows Vista 认证†)
  • 2GB 内存 (运行多个组件时推荐使用更大内存)
  • 16.3GB 可用硬盘空间用于安装; 安装过程中需要额外的可用空间 (无法安装在基于闪存的设备上)
  • 1,280×900 屏幕, OpenGL 2.0 兼容图形卡
  • 某些 GPU 加速功能需要 Shader Model 3.0 图形支持
  • DV 和 HDV 编辑需要专用的 7200 转硬盘驱动器; HD 需要条带磁盘阵列存储 (RAID 0); 首选 SCSI 磁盘子系统
  • SD/HD 工作流程需要经 Adobe 认证的卡以捕获并导出到磁带
  • 需要 OHCI 兼容型 IEEE 1394 端口进行 DV 和 HDV 捕获、导出到磁带并传输到 DV 设备
  • DVD-ROM 驱动器 (创建 DVD 需要 DVD+-R 刻录机)
  • 创建蓝光盘需要蓝光刻录机
  • Microsoft Windows Driver Model 兼容或 ASIO 兼容声卡
  • 使用 QuickTime 功能需要 QuickTime 7.4.5 软件
  • 在线服务需要宽带 Internet 连接‡

Mac OS

  • Intel® 多核处理器
  • Mac OS X 10.4.11 – 10.5.4 版
  • 2GB 内存 (运行多个组件时推荐使用更大内存)
  • 20.6GB 可用硬盘空间用于安装; 安装过程中需要额外的可用空间 (无法安装在使用区分大小写的文件系统的卷或基于闪存的设备上)
  • 1,280×900 屏幕, OpenGL 2.0 兼容图形卡
  • 某些 GPU 加速功能需要 Shader Model 3.0 图形支持
  • DV 和 HDV 编辑需要专用的 7200 转硬盘驱动器; HD 需要条带磁盘阵列存储 (RAID 0); 首选 SCSI 磁盘子系统
  • DVD-ROM 驱动器 (DVD 创建需要 SuperDrive)
  • 创建蓝光盘需要蓝光刻录机
  • Core Audio 兼容声卡
  • 使用 QuickTime 功能需要 QuickTime 7.4.5 软件
  • 在线服务需要宽带 Internet 连接‡

**AMD 系统需要支持 SSE2 的处理器。
Adobe® Photoshop® Extended 本机支持 64 位版本的 Windows Vista。Adobe Premiere® Pro、After Effects®、Soundbooth®、Encore® 和 Adobe OnLocation™ 经过 64 位 Windows Vista 认证。
‡本产品可能允许您访问在线提供的特定功能 (“在线服务”), 前提是高速 Internet 连接可用。可能不提供所有国家/地区、语言和/或货币的在线服务及其特定功能, 它们也可能全部或部分停止, 恕不另行通知。使用在线服务受到单独使用条款和 Adobe 在线隐私策略的约束, 并且使用这些服务可能需要用户进行注册。包括最初免费提供的服务在内的某些在线服务可能会收取额外费用。有关更多详细信息或要查看使用条款及在线隐私策略, 请访问 www.adobe.com/cn/

  种子下载

 http://www.demonoid.com/files/download/HTTP/1655690/4170021

 INSTRUCTIONS
1. Run each (*.exe) file to extract the content
2. Run setup for each. Start in "Production Premium"Adobe CS4"Setup.exe" folder.
3. NO Serial/Keygen/Crack provided. You must wait for those.

4. ENJOY! – Not Yet

 

Adobe CS4改变了激活的策略,取消了电话激活的功能,不联网,CS4不用激活
处理方法就更简单了,在host文件里把activate.adobe.com 屏蔽掉即可

[C#]Db4o for .NET

mikel阅读(1524)

当你想要快速的开发系统原型,用于演示功能、探索需求、消除风险时,用db4o吧;
当你的程序的数据量不算特别大,而又想最快的提高开发速度时,用db4o吧;
当你不想在程序的可配置信息的存储、解析上花费时间时,用db4o吧;
当你不懂SQL也不想学SQL时,用db4o吧。

Db4o是对象数据库,有java和.net两个分支。这里没有sql,没有表,一切都是原生对象。官方网站对Db4o的描述是:
•完全原生于Java和.NET
•100% 面向对象, 抛开对象-关系映射
•为嵌入式应用优化
•开源,可以基于GPL协议免费使用

Db4o的使用十分简单,以本地数据库为例子:

(1)打开数据库
IObjectContainer ObjectContainer = Db4oFactory.OpenFile("data.yap");
这句话打开本地数据库data.yap,如果该文件不在,则自动创建数据库文件。
(2)关闭数据库
ObjectContainer.Close();
(3)查询对象
IList<YourClass> rlist = ObjectContainer.Query< YourClass >();
这句话查询数据库中全部的YourClass对象。
Db4o提供了多种对象查询方式,详情可见官方文档。
(4)Activate对象
默认从数据库提取的对象只有一定的深度,更深的被引用的对象为null,为了提取更深的对象,需要Activate已提取的对象:
ObjectContainer.Activate(YourObject, depth)
(4)储存/更新对象
ObjectContainer.Store(YourObject)
如果YourObject不是从数据库中通过查询获得的实例,则将YourObject及它所持有的对象,及持有的持有的……所有可达对象全部储存入数据库。
如果 YourObject是从数据库通过查询获得的实例,则更新YourObject的属性。默认不进行级联更新,你也可以设置级联更新,如:
 Db4objects.Db4o.Db4oFactory.Configure().ObjectClass(typeof(YourClass)).CascadeOnUpdate(true);
(5)删除对象
ObjectContainer.Delete(YourObject)

以上是最基本的操作,很快很敏捷。更多的操作可见官方文档。

我现在用最懒惰的方法在用db4o:设置一个Root Object,其它Objects都挂接在Root Object之下,程序启动时就从数据库中把第一个Root实例提取出来,把要用的对象都Activate出来,数据变动时就 Store(ObjectChanged)一下子。

Db4o官方网站http://www.db4o.com/
JackyXu 的博客有数篇关于db4o的笔记:http://www.cnblogs.com/JackyXu/
db4o 中的数据库重构: http://www.ibm.com/developerworks/cn/java/j-db4o3.html

[Flash]Linux下的Flash Player 10

mikel阅读(742)

Linux在Flash播放器领域终于成为了主流的操作系统了,Adobe今天发布了支持Linux的Adobe Flash Player 10,给Linux的多种媒体封装格式带来了极大的方便。在过去Linux在这个领域只能算是二流的成员,得不到Flash播放器的青睐,2007年Linux用户就是在其他主流平台使用Flash 9长达6个月之后,才迎来Linux版本。

   如今,当微软决定将Linux平台Silverlight技术推迟发布之后,Adobe给Linux平台带来了“平等”的播放器,并称“Flash播放 器已经占据了互联网桌面市场98%的份额”,同时,“80%的在线视频均采用Adobe的Flash技术”,而且在9个月之后,Flash9将占据互联网 桌面市场90%的份额。
  Flash Player 10是配合Adobe Creative Suite (CS) 4发布的客户端软件,提供了对Photoshop和Illustrator创建矢量绘图的支持,并支持2D和3D多种特效。
  Adobe反复强调他的“Open Screen Project”,在今年5月份他就提出这个计划,称他们将免费开放的文件格式和API,使得Flash可以在移动设备上和桌面市场一样被广泛使用。
  在Microsoft Silverlight 发布不久, mono小组就开始了linux下的Silverlight实现,名称叫Moonlight,代码olive,也就是在短短的一个月左右的时间,Moonlight已经可以运行。

  GNOME的创始人Miguel deIcaza称,Flash还不能在免费和开源软件社区大出风头,作为一个非盈利的组织,肯定担心Abobe在多媒体获得太多的控制权。他们已经开发了Flash的替代品Gnash,只使用免费授权的软件和编解码器。
  Flash 10 已经发布了支持Linux, Windows, 和 Macintosh平台的版本,支持Solaris的版本将在年底发布。同时Flash10还支持Adobe AIR。
  访问:多个平台的Flash10

[C#]等比例缩放图片

mikel阅读(881)

看到海东兄的按比例缩放图片 ,我就把我写的js版本的也拿出来show一下,哈哈!
js版本:
function resizeImage(obj, MaxW, MaxH)
{
 var imageObject = obj;
    var state = imageObject.readyState;
 if(state!='complete')
 {
        setTimeout("resizeImage("+imageObject+","+MaxW+","+MaxH+")",50);
  return;
    }
    var oldImage = new Image();
    oldImage.src = imageObject.src;
    var dW = oldImage.width;
    var dH = oldImage.height;
    if(dW>MaxW || dH>MaxH)
 {
        a = dW/MaxW; b = dH/MaxH;
        if( b>a ) a = b;
        dW = dW/a; dH = dH/a;
    }
    if(dW > 0 && dH > 0)
 {
        imageObject.width = dW;
  imageObject.height = dH;
 }
}
使用很简单:<img src="../pic.jpg" onload='resizeImage(this,60,90)> 就OK了;
注:等比例放缩的时候会出现抖动的情况,处理方法很简单,你在img的属性先设置它的widht和height,这样的话加载的时候绝对不会超过这个尺寸,等你js运行好之后就会调到你所规定的比例,绝对不会以下撑到很大。

同时也附上C#版本的
C#版本—海东兄 http://www.cnblogs.com/ghd258/archive/2005/11/07/270447.html
1/// <summary>
 2        /// 按比例缩放图片
 3        /// </summary>
 4        /// <param name="imgUrl">图片的路径</param>
 5        /// <param name="imgHeight">图片的高度</param>
 6        /// <param name="imgWidth">图片的宽度</param>
 7        /// <returns></returns>

 8        public static string GetImageSize(string imgUrl,int imgHeight,int imgWidth)
 9        {
10            string fileName = System.Web.HttpContext.Current.Server.MapPath(imgUrl);
11            string strResult = string.Empty;
12            if(System.IO.File.Exists(fileName) && imgHeight != 0 && imgWidth != 0)
13            {
14                decimal desWidth;decimal desHeight;                                            //目标宽高
15                System.Drawing.Image objImage = System.Drawing.Image.FromFile(fileName);
16                decimal radioAct = (decimal)objImage.Width/(decimal)objImage.Height;        //原始图片的宽高比
17                decimal radioLoc = (decimal)imgWidth/(decimal)imgHeight;                    //图片位的宽高比
18                if(radioAct > radioLoc)                                                        //原始图片比图片位宽
19                {        
20                    decimal dcmZoom = (decimal)imgWidth/(decimal)objImage.Width;
21                    desHeight = objImage.Height*dcmZoom;
22                    desWidth = imgWidth;
23                }

24                else
25                {
26                    decimal dcmZoom = (decimal)imgHeight/(decimal)objImage.Height;
27                    desWidth = objImage.Width*dcmZoom;
28                    desHeight = imgHeight;
29                }

30                objImage.Dispose();                //释放资源
31                strResult = "width=\"" + Convert.ToString((int)desWidth) + "\" height=\""
32                    + Convert.ToString((int)desHeight) + "\" ";
33            }

34            return strResult;
35        }

[MVC]ASP.NET MVC Beta版发布

mikel阅读(707)

一大早来看到了一个不好也不坏的消息,经过了漫长的从Preview 1到Preview 5的预览,好的是ASP.NET MVC终于发布Beta版了,坏的是UCenter.NET项目又得进行升级了。这次发布的Beta版本相对于ASP.NET MVC Preview 5来说,变化不是很大,主要包括:

1. 改变验证信息使其对最终用户更加友好

2. 在Controller中添加了Url属性,类型为UrlHelper

3. 重命名CompositeViewEngine为AutoViewEngine

4. 在IViewEngine中新添加了ReleaseView方法

5. 移除了HtmlHelper中的大多数方法,变为HtmlHelper的扩展方法,并且放在了System.Web.Mvc.Html命名空间下

6. 添加了新的HttpVerbs枚举,包含了常用的Http谓词:GET, POST, PUT, Delete, HEAD

7. 从ViewContext中移除了ViewName属性

还有其他的一些变化,就不列举了,大家可以到这里下载ASP.NET MVC Beta版本

官方站点:http://www.codeplex.com/aspnet

[C#]Db4o for .NET 使用心得(1、2):Trace db4o;慎用struct

mikel阅读(817)

Db4o(http://www.db4o.com/)是著名的开源对象数据库,使用它能够将持续层代码量降低到忽略不计的程度。如果数据量不大,用它能够将开发速度提高一个层次。
我手中的小项目需要储存约十万个联系人的数据,考察了SQLite与db4o,最终决定选用db4o. 我使用的是db4o 7.4 for .NET 2.0。关于db4o网上有很多文档,然而有一些问题,在网上不容易找到解决办法,总结一下,写在下面。

(1) Trace db4o

ObjectManager是官方查看db4o数据库的客户端,然而,db4o7.4这个版本对应的ObjectManager不再免费,用不了 了。要弄清楚在程序中db4o数据库到底做了哪些事情,除了ObjectManager外,还可以打开db4o 的日志,进行跟踪。

在打开数据库之前,进行Trace操作的代码如下:

Code

 

这样,在VS的output窗口或者控制台里会有相关的操作日志,如:

[db4o 7.4.60.11658   20081016 07:59:06
 
17563 update Orc.ContactManager.Contact, 联系人管理器
[db4o 
7.4.60.11658   20081016 07:59:06
 
346372 new System.Guid, mscorlib
[db4o 
7.4.60.11658   20081016 07:59:06
 
346415 new Orc.ContactManager.ChannelType, 联系人管理器
[db4o 
7.4.60.11658   20081016 07:59:06
 
17770 update Orc.ContactManager.Contact, 联系人管理器
[db4o 
7.4.60.11658   20081016 07:59:06
 
346571 new System.Guid, mscorlib

 

2 尽量少用struct, enum

目前db4o处理普通struct及enum还不尽如意。
对于普通的struct及enum,db4o不能辨别待储存/更新的实例与数据库中原有实例是否同一实例,因此当update时,即使值没有变 动,db4o也会将它new一个出来,储存入数据库。如果仅仅只是这样,不过浪费了一些无谓的IO操作,更大的问题是它储存进去一个新值,却不删除原有的 值,导致数据库文件中存在大量的垃圾数据。

通过下面小程序就可以验证这一缺陷:

Code

 

程序运行结束后,数据库文件test.yap 大小为2k.

运行日志如下:


[db4o 
7.4.60.11658   20081016 09:42:39]
 
914 update Db4oTest.Contact, Db4oTest
[db4o 
7.4.60.11658   20081016 09:42:39]
 
914 update Db4oTest.Contact, Db4oTest
[db4o 
7.4.60.11658   20081016 09:42:39]
 
914 update Db4oTest.Contact, Db4oTest
[db4o 
7.4.60.11658   20081016 09:42:39]
 
914 update Db4oTest.Contact, Db4oTest
[db4o 
7.4.60.11658   20081016 09:42:39]
 
914 update Db4oTest.Contact, Db4oTest

可见,每次运行ObjectContainer.Store(c)均对c进行update。

将Contact的代码改为:

Code

 

编译程序,删除test.yap文件,重新运行程序,得到新的test.yap文件大小为144k,可见其中存在大量的垃圾数据。查看日志信息可以发现问题所在:


2352 update Db4oTest.Contact, Db4oTest
[db4o 
7.4.60.11658   20081016 09:48:56]
 
99639 new System.Guid, mscorlib
[db4o 
7.4.60.11658   20081016 09:48:56]
 
99682 new Db4oTest.ContactType, Db4oTest
[db4o 
7.4.60.11658   20081016 09:48:56]
 
2352 update Db4oTest.Contact, Db4oTest
[db4o 
7.4.60.11658   20081016 09:48:56]
 
99716 new System.Guid, mscorlib
[db4o 
7.4.60.11658   20081016 09:48:56]
 
99759 new Db4oTest.ContactType, Db4oTest

 

可见每update一次Contact c,db4o都要new一个Guid,new 一个ContactType,存入数据库,原有的Guid/ContactType,则变成垃圾,依旧呆在数据库中,导致数据库文件急剧增长。

.net下,Int32也是一种struct,然而,从上例日志中却未发现新建Int32 Code,我猜测是db4o对Int32这些常用struct进行了特殊处理。

为了避免垃圾数据,使用db4o时最好慎用struct。

[Adobe]Adobe发布的Adobe Flash Player10下载

mikel阅读(665)

Adobe Systems周三在毫无征兆的情况下发布了Adobe Flash Player 10软件,版本号10.0.12.36,内置3D处理能力,并支持数种Flash特效。

Flash Player 10是配合Adobe Creative Suite (CS) 4发布的客户端软件,提供了对Photoshop和Illustrator创建矢量绘图的支持。

下载:Adobe Flash Player 10

[FCKEditor]Integrating FCKeditor in ASP.Net

mikel阅读(959)

Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

In Basic ASP.NET, FCKeditor can be easily integrated. Here is the link where I found that.

http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/ASP.NET

However, to integrate FCKeditor in ASP.NET MVC environment, we have to follow some tricky steps. Here I will show how to integrate using core JavaScript as well as using JQuery.

Using JavaScript

Step 1

Download the FCKeditor from http://www.fckeditor.net/download.

Step 2

Unzip the package and put in your project content directory. I liked to make a directory "JavaScript" under "Content" directory and put "unzipped fckeditor" here. I have also put fckeditorapi.js in "Javascript" folder. You can get more information on FCKeditor API here

http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API

Step 3

I have added a MVC view file in Home folder and named it as "Fck.aspx". To view this file, I included a method in HomeController, as follows.

/// <summary>
/// Show FCK Editor View Page
/// </summary>
public void Show()
{
RenderView("Fck");
}  

Step 4

In Fck.aspx, include the fckeditor.js and fckeditorapi.js file:

<script type="text/javascript" src="../../Content/Javascript/fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="../../Content/Javascript/fckeditorapi.js"></script>

Include the following to replace textarea (named 'content') by FCKeditor. Here I have included InsertContent(), ShowContent() and ClearContent() methods to perform some extra actions.

<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'content' ) ;
oFCKeditor.BasePath = "/Content/Javascript/fckeditor/" ;
oFCKeditor.Height = 300;
oFCKeditor.ReplaceTextarea() ;
}
function InsertContent()
{
var oEditor = FCKeditorAPI.GetInstance('content') ;
var sample = document.getElementById("sample").value;
oEditor.InsertHtml(sample);
}
function ShowContent()
{
var oEditor = FCKeditorAPI.GetInstance('content') ;
alert(oEditor.GetHTML());
}
function ClearContent()
{
var oEditor = FCKeditorAPI.GetInstance('content');
oEditor.SetHTML("");
}
</script>

Here is the html content:

<div>
<input id="sample" type="text" />
<input id="cmdInsert" type="button" value="Insert Content" onclick="InsertContent()" />
<input id="cmdClear" type="button" value="Clear Content" onclick="ClearContent()" />
<br /> <br />
<textarea id="content" cols="30" rows="10"></textarea>
<br />
<input id="cmdShow" type="button" value="Show Content" onclick="ShowContent()" />
</div> 

Step 5

Now build the application and run. Click the "FCK Editor" link and get the result.

Using JQuery

Step 1

Download JQuery from http://www.jquery.com. I have put jQuery-1.2.6.pack.js and jQuery.FCKEditor.js in my "Javascript" folder".

Step 2

I have added a MVC view file in Home folder and named it as "FckjQuery.aspx". To view this file, I included a method in HomeController, as follows.

/// <summary>
/// Show FCK Editor By JQuery
/// </summary>
public void View()
{
RenderView("FckJquery");
}

Step 3

In FckJquery.aspx, include the jquery-1.2.6.pack.js, fckeditor.js and jquery.FCKEditor.js file:

<script type="text/javascript" src="../../Content/Javascript/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="../../Content/Javascript/fckeditor/fckeditor.js"></script>
<script type="text/javascript" src="../../Content/Javascript/jquery.FCKEditor.js"></script>

Include the following to replace textarea (named 'content') by FCKeditor. Here I have included InsertContent(), ShowContent() and ClearContent() methods to perform some extra actions.

<script type="text/javascript">
$(document).ready(function(){
$.fck.config = {path: '/Content/Javascript/fckeditor/', height: 300 };
$('textarea#content').fck();
});
function InsertContent()
{
var sample = document.getElementById("sample").value;
$.fck.insertHtml('fck1', sample);
}
function ShowContent()
{
alert($.fck.content('fck1', ''));
}
function ClearContent()
{
$.fck.clearHtml('fck1');
}
</script>

Here is the html content:

<div>
<input id="sample" type="text" />
<input id="cmdInsert" type="button" value="Insert Content" onclick="InsertContent()" />
<input id="cmdClear" type="button" value="Clear Content" onclick="ClearContent()" />
<br /> <br />
<textarea id="content" cols="30" rows="10"></textarea>
<br />
<input id="cmdShow" type="button" value="Show Content" onclick="ShowContent()" />
</div>

Step 4

In jquery.FCKEditor.js file, I have included two functions. Function insertHtml() inserts html content into fckeditor and clearHtml() clears the content.

// insert Html Content
insertHtml: function(i, v) {
try{
var x = FCKeditorAPI.GetInstance(i);
if(v) x.InsertHtml(v);
else return '';
}
catch(e) { return ''; };
},
// clear Html Content
clearHtml: function(i) {
try{
var x = FCKeditorAPI.GetInstance(i);
x.SetHTML('');
}
catch(e) { return ''; };
},

Step 5

Now build the application and run. Click the "FCK Editor By JQuery" link and get the result. Enjoy It!

References

http://docs.fckeditor.net

http://www.jquery.com

http://www.fyneworks.com/jquery/FCKEditor

Conclusion

Next I will try to give some demonstration on how to build plugins in FCKeditor. Till then bye.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Mohammad Jahedur Rahman

I am a .Net Developer working now in a leading software company Brain Station-23 Bangladesh.

Occupation: Web Developer
Company: Brain Station-23
Location: Bangladesh Bangladesh

[CSS]面向对象的CSS

mikel阅读(660)

时下流行面向对象,那么有没有可能把样式表也面向对象一下呢,将现在的CSS(Cascading Style Sheets层叠样式表)进

化一下,演变成面向对象的样式表给套了个概念上去,以下叫“OOCSS”,即 Object oriented Cascading Style Sheets。

 

 ◆ 为什么会这样想?

      没办法,被逼的, 俺们公司的美工只做图片,其它的是啥都不管,近来弄个WEB项目,都做差不多了,老总说要能换肤。呵呵

还好之前有所考虑,三两天就搞定了。

      我的方法是,页面全部用CSS控制,主要有 common.css、list.css、addedit.css等10来个css文件和图片,全部放一个叫

Common/Skins的目录下 ,Common/Skins下每套皮肤一个文件夹,最终目录结构大致如下。

Code

 

      共定义有5、6套皮肤,CSS和图片文件急剧上涨,由原来的10来个一下子上升到了7,8十个,虽然数量是有点吓人,不过每套

皮肤,CSS和图片都大部分差不多,也没花多少功夫就搞定了,不管了,甩一边。

      几天后的某一天早晨,好大的台风,呼呼的,雨也不小,让人觉得很不爽,就像出事前的预兆 !

      果然,没坐下多久,老总过来说“和美工讨论了下,有几个地方,布局要变下……”。

      一阵的嘻哩哗啦之后,我心里除了佩服老总口才不错之外,觉得自己命好苦呀!

      那么多CSS,得改多久呀,以后要再变的话不还得改吗!

      仔细分析下CSS,其实每套皮肤都大体差不多,不同的地方一般都是边框、文字的颜色和背景色,还有图片、字号,于是我决定

所有的皮肤都用同一套公共的CSS文件,另外,每套皮肤再加一个独立CSS文件(Settings.css),而该CSS中只定义基本的样式,

相当于配置文件一样的,然后作用于其余几个公共的CSS文件。

      我坚信这样的思路是对的,可是怎么实现呢?

      首先想到的,当然是用CSS的组合,将之前部分CSS规则分离,公共部分提取出来放在 Settings.css中定义,如:

      将List.css中规则 
               .ToolBar{color:#f0e000;border:1px solid gray;} 
          分离为
               .DefaultColor{color:#f0e000;}定义在Settings.css中
               .ToolBar{border:1px solid gray;}仍然保留在List.css中

          然后将HTML中对 .ToolBar 的引用“class='ToolBar'”改为“class='DefaultColor ToolBar '”

      再将其它color属性相同的CSS规则进行同样的分离。这样每套皮肤不同的地方就只是 settings.css文件里.DefaultColor类型

的规则。

      而这样做又引发的新的问题,必须得每个页面改HTML中的class属性,而背景图片只能依靠 expression 来解决,expression

又常常造成页面的死锁,无奈之下只有另谋出路。

      

 ◆ 面向对象的CSS: OOCSS 基本构思

      继承:

            OOCSS中,类(样式规则)可以继承自另一类,如

例一

            .Base{font-size:20pt;}
            .Sun{color:red;}

            假如用如下语法可以实现继承

            .Base{font-size:20pt;}
            .Sun (inherit .Base)
            {
                    color:red;
            }

 

            而现在类 .Sun 则不单单拥有 “color:red;”属性,应该拥有从基类 .Base 中继承的 “font-size:20pt”属性 ,

     cssText应该是 “font-size:20pt;color:red”。

      覆盖:

           将上例中的 .Sun 更改如下:

            .Base{font-size:20pt;}
            .Sun (inherit .Base)
            {
                    font-size:10pt;
                    color:red;
            }

            则实现了对基类“font-size:20pt”的覆盖,.Sun中的font-size则为10pt。

 

     子类访问基类

例二

            .Base
            {
                    v:20;
                    font-size:20pt;
            }

            .Sun (inherit .Base)
            {
                    padding : (base.v+10)px;
                    font-size:(base.fontSize/2)pt;
                    color:red;
            }

            .Sun2 (inherit .Base)
            {
                    padding : (base.v+20)px;

            }

 

           在基类 .Base 中定义了变量 “v:20”和style属性“font-size:20pt”,子类 .Sun和.Sun2中style属性padding和

     font-size通过访问基类变量和属性计算而来,而最终 .Sun 中 padding等于30px,.Sun2中padding等于40px;.Sun中

     fong-size等于10pt,.Sun2没有覆盖基类中的font-size,所以font-size继承基类,值仍为20pt。

 

     多继承

例三

            .Base{font-size:20pt;}

            .Base2{color:red;}

            .Sun (inherit .Base,.Base2)
            {
                    padding:20px;
            }

            .Grandson (inherit .Base)
            {

            }

 

          类.Sun继承自两个基类.Base和.Base2,所以.Sun的cssText为“font-size:20pt;color:red;padding:20px;”,而

     .Grandson继承自.Sun,本身没有任何自定义属性,因此cssText和.Sun一样,仍为“font-size:20pt;color:red;

     padding:20px;”。

      

     私有(假如用private作为关键字)

例四

            .Base
             {
                    font-size:20pt;
                    private color:red;
             }

            .Sun (inherit .Base)
            {
                    padding:10px;
            }

 

          子类 .Sun 继承基类 .Base 中的fontSize属性,因为 .Base中color属性受private(私有)限制,不能被.Sun继承,最终

     .Sun的cssText是“font-size:20pt;padding:10px”。

 

     更多特性待琢磨……

 

 

  ◆ 这样做有意义吗?

       我的回答是“有”     !

       1.  CSS的优点之一“一处定义,多处使用”

               目前的CSS多处使用指的是,一个CSS规则可以由多个HTML元素引用。可CSS规则间不能互操作。

       2.  CSS的继承

               CSS的继承不是真正意义上的继承,而是HTML元素对外层元素Style属性的继承,且部分Style属性、HTML元素是不能

          继承的,如backgroundColor属性、border属性、padding属性、table元素等等(当然,部分不支持继承也是合理的)。

      3.  CSS优先级

               当多个CSS规则作用于同一个HTML元素时,CSS将根据CSS规则权重 、规则定义的先后配合HTML元素的层次关系决

          定最终的有效值,这样的解决方案有时很巧妙,可当HTML层次结构过深、而作用于同一个HTML元素的CSS规则过多时,

          CSS规则的优先级控制是相当的不容易,有时候不得不用蹩脚的“! important”来解决问题,可“! important”不符合标

          准,支持的浏览器很少。

      OOCSS在保留CSS特性(或者说是优点)的前提下,将从某种程度上解决以上问题

     1.  OOCSS中,类可以访问基类甚至没有依赖关系的其他类,应用灵活……。

     2.  OOCSS中,继承是类对基类属性的继承,不同于CSS中的继承(HTML元素对上层元素Style属性的继承),子类直接继承

          基类不受private(私有)关键字修饰的属性。

     3.  OOCSS实现继承后,就会在一定程度上避免CSS组合的应用,便会减少意外的HTML元素匹配,同时HTML元素在class属

          性中应用子类时,权重跟基类无关,和子类一致,如例三中,子类 .Sun 的权重跟基类 .Base1、.Base2无关 。

 

 

 ◆ 我认为OOCSS很有趣,也有用,那么该怎么做呢?

           上面的想法都是建立在假如的基础上的,都只是我一种猜想而已

            .Base
             {
                    font-size:20pt;
                    private color:red;
             }

            .Sun (inherit .Base)
            {
                    padding:10px;
            }

            这样的代码各位都不认识,浏览器又怎么会认识呢,那么是不是就不能实现呢?不是的,我们可以通过一些其他方法模拟,

       虽然有些尴尬!

            我的做法是,写个JS解析,基本实现以上想法,代码太多,不方便贴出来,供下截

                 下载:http://www.66s.com.cn/oocss/OOCSSDemo.rar
                         http://files.cnblogs.com/kuiyouli/OOCSSDemo.rar

                 演示:http://www.66s.com.cn/oocss/

                 有兴趣的朋友可进入QQ群:15774494

                 注:目前只支持IE浏览器

       实现功能如下:

       1.  继承 

                因为浏览器不支持 .Sun (inherit .Base) 这样的语法,所以改为如下形式:

                    .DefaultColor{color:red;}
                    .Sun
                    {
                         base: .DefaultColor;
                         font-size:9pt;
                    }
                用 “base”关键字指定基类,注意是“.DefaultColor”,而不是“DefaultColor”,基类必须是类全称,可以指定多个基

          类,如:

                    .BaseHeight{height:30px;}
                    .DefaultColor{color:red;}
                    .Sun
                    {
                         base: .DefaultColor,.BaseHeight;
                         font-size:9pt;
                    }          

 

       2.  附加

                跟继承类似,实现的却是CSS的组合功能。

                    .BaseHeight{height:30px;}
                    .DefaultColor{color:red;}
                    .Sun
                    {
                         append: .DefaultColor,.BaseHeight;
                         font-size:9pt;
                    } 

               当HTML元素引用类 .Sun 时,OOCSS会自动将 .DefaultColor、.BaseHeight附加到HTML元素的class属性,如:

                    <div class=".Sun"></div>

               则该div最后的class属性值为“.Sun .DefaultColor .BaseHeight”。因此,.DefaultColor、.BaseHeight中的属性受

          其优先级的影响,跟.Sun的优先级无关。

      3.   eval表达式

               eval表达式类似expression表达式,不同之处在于,eval只在初始化时执行一次。

                     .TestEval
                    {
                         E-height: eval(20+30);
                    }

               相当于:

                     .TestEval
                    {
                         height: 50px;
                    }

 

               可以在eval中访问脚本变量,如:

                    <script>
                         var skin={color:'red', defaultSize:'9pt'}
                    </script>

                    <style>
                         .TestEval
                         {
                              E-color: eval(skin.color);
                              E-font-size: eval(skin.defaultSize);
                         } 

                         .LargeFont
                         {
                              e-font-size:eval(     (parseInt(skin.defaultSize)+3)+"pt"     )
                         }
                    </style>

               以上代码相当于:

                    <style>
                         .TestEval
                         {
                              color: red;
                              font-size: 9pt;
                         }
 

                         .LargeFont
                         {
                              font-size:12pt;
                         }
                    </style>                    

     4.  .Global或.Init初始化

          可以类名为 .Global或 .Init的类配合eval关键字初始化。

                   <style>

                         .Global
                         {
                              E-init: eval(     window.skin={color:'red', defaultSize:'9pt'}     );
                         }

                         .TestEval
                         {
                              E-color: eval(skin.color);
                              E-font-size: eval(skin.defaultSize);
                         }
                    </style>

               以上代码相当于:

                    <style>
                         .TestEval
                         {
                              color: red;
                              font-size: 9pt;
                         }
                    </style> 

 

 

     5.  访问基类

          通过eval关键字和base关键字,访问基类对象。

                    .DefaultHeight{height:30px;}
                    .Sun
                    {
                         base: .DefaultHeight;
                         E-height: eval(parseInt(base.height)+20);
                    }

           相当于:

                    .Sun
                    {
                         height: 50px;
                    }

           当有多个基类时,则可以这样访问:

                    .DefaultColor{color:red;}                    
                    .DefaultHeight{height:30px;}
                    .Sun
                    {
                         base: .DefaultColor ,.DefaultHeight;
                         E-height: eval(parseInt(base[1].height)+20);
                    }

           也可以这样访问

                    .DefaultColor{color:red;}                    
                    .DefaultHeight{height:30px;}
                    .Sun
                    {
                         base: .DefaultColor ,.DefaultHeight;
                         E-height: eval(parseInt(base[DefaultHeight].height)+20);
                    }

           相当于:

                    .Sun
                    {
                         color: red;
                         height: 50px;
                    }

  

     6.  私有成员

          下一版本实现……