置顶随笔

今天一个同事问我一个需求,如何点击一个button, 使datagrid按特定的某列排序,于是简单写了个demo:
<?xml version="1.0"?>
<!-- DataGrid control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
           import mx.collections.XMLListCollection;
           import mx.collections.Sort;
           import mx.collections.SortField;

            private function sortByColumn(sort:Boolean):void
            {
                arrColl.sort = new Sort();
                var f:SortField = new SortField("idx", false, true);
                f.descending = sort;
                arrColl.sort.fields = [f];
                arrColl.refresh();                
            }

            
        ]]>
    </mx:Script>

    <mx:ArrayCollection id="arrColl">
        <mx:source>
            <mx:Array>
                <mx:Object idx="1" c1="One.1" c2="One.2" />
                <mx:Object idx="2" c1="Two.1" c2="Two.2" />
                <mx:Object idx="3" c1="Three.1" c2="Three.2" />
                <mx:Object idx="4" c1="Four.1" c2="Four.2" />
                <mx:Object idx="5" c1="Five.1" c2="Five.2" />
                <mx:Object idx="6" c1="Six.1" c2="Six.2" />
                <mx:Object idx="7" c1="Seven.1" c2="Seven.2" />
                <mx:Object idx="8" c1="Eight.1" c2="Eight.2" />
                <mx:Object idx="9" c1="Nine.1" c2="Nine.2" />
                <mx:Object idx="10" c1="Ten.1" c2="Ten.2" />
                <mx:Object idx="11" c1="Eleven.1" c2="Eleven.2" />
                <mx:Object idx="12" c1="Twelve.1" c2="Twelve.2" />
                <mx:Object idx="13" c1="Thirteen.1" c2="Thirteen.2" />
            </mx:Array>
        </mx:source>
    </mx:ArrayCollection>


    <mx:Panel title="DataGrid Control Example" height="100%" width="100%"
        paddingTop="10" paddingLeft="10" paddingRight="10">

        <mx:Label width="100%" color="blue"
            text="Select a row in the DataGrid control."/>

        <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{arrColl}">
            <mx:columns>
                <mx:DataGridColumn dataField="idx" headerText="Name"/>
                <mx:DataGridColumn dataField="c1" headerText="Phone"/>
                <mx:DataGridColumn dataField="c2" headerText="Email"/>
            </mx:columns>
        </mx:DataGrid>
    <mx:CheckBox id="srotChk"/>
        <mx:Button id="sortBtn" label="sort" click="sortByColumn(srotChk.selected)"/>
        
    </mx:Panel>
</mx:Application>     

posted @ 2009-09-10 22:32 bruce.peng 阅读(299) | 评论 (0)编辑 收藏

2009年9月10日

今天一个同事问我一个需求,如何点击一个button, 使datagrid按特定的某列排序,于是简单写了个demo:
<?xml version="1.0"?>
<!-- DataGrid control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
           import mx.collections.XMLListCollection;
           import mx.collections.Sort;
           import mx.collections.SortField;

            private function sortByColumn(sort:Boolean):void
            {
                arrColl.sort = new Sort();
                var f:SortField = new SortField("idx", false, true);
                f.descending = sort;
                arrColl.sort.fields = [f];
                arrColl.refresh();                
            }

            
        ]]>
    </mx:Script>

    <mx:ArrayCollection id="arrColl">
        <mx:source>
            <mx:Array>
                <mx:Object idx="1" c1="One.1" c2="One.2" />
                <mx:Object idx="2" c1="Two.1" c2="Two.2" />
                <mx:Object idx="3" c1="Three.1" c2="Three.2" />
                <mx:Object idx="4" c1="Four.1" c2="Four.2" />
                <mx:Object idx="5" c1="Five.1" c2="Five.2" />
                <mx:Object idx="6" c1="Six.1" c2="Six.2" />
                <mx:Object idx="7" c1="Seven.1" c2="Seven.2" />
                <mx:Object idx="8" c1="Eight.1" c2="Eight.2" />
                <mx:Object idx="9" c1="Nine.1" c2="Nine.2" />
                <mx:Object idx="10" c1="Ten.1" c2="Ten.2" />
                <mx:Object idx="11" c1="Eleven.1" c2="Eleven.2" />
                <mx:Object idx="12" c1="Twelve.1" c2="Twelve.2" />
                <mx:Object idx="13" c1="Thirteen.1" c2="Thirteen.2" />
            </mx:Array>
        </mx:source>
    </mx:ArrayCollection>


    <mx:Panel title="DataGrid Control Example" height="100%" width="100%"
        paddingTop="10" paddingLeft="10" paddingRight="10">

        <mx:Label width="100%" color="blue"
            text="Select a row in the DataGrid control."/>

        <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{arrColl}">
            <mx:columns>
                <mx:DataGridColumn dataField="idx" headerText="Name"/>
                <mx:DataGridColumn dataField="c1" headerText="Phone"/>
                <mx:DataGridColumn dataField="c2" headerText="Email"/>
            </mx:columns>
        </mx:DataGrid>
    <mx:CheckBox id="srotChk"/>
        <mx:Button id="sortBtn" label="sort" click="sortByColumn(srotChk.selected)"/>
        
    </mx:Panel>
</mx:Application>     

posted @ 2009-09-10 22:32 bruce.peng 阅读(299) | 评论 (0)编辑 收藏

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
   xmlns:mx="http://www.adobe.com/2006/mxml"
   layout="vertical"
   creationComplete="setDataProvider()">
 
   <mx:Script>
      <![CDATA[
         import mx.collections.XMLListCollection;
        
         [Bindable]
         private var xmlOriginal : XML =
            <root>
               <item name="Alpha" letter="Z"/>
               <item name="Beta" letter="P"/>
               <item name="Gamma" letter="X"/>
               <item name="Delta" letter="P"/>
            </root>
           
         private var xmlUpdated : XML =
            <root>
               <item name="Alpha" letter="F"/>
               <item name="Beta" letter="U"/>
               <item name="Gamma" letter="A"/>
               <item name="Delta" letter="P"/>
               <item name="Epsilon" letter="F"/>
            </root>  
        
         private function setDataProvider() : void
         {
            dataGrid.dataProvider = new XMLListCollection( xmlOriginal..item );
         }
        
      ]]>
   </mx:Script>
 
   <mx:DataGrid
      id="dataGrid"/>
 
   <mx:Button
      label="Simulate Update"
      click="XMLListCollection( dataGrid.dataProvider ).source = xmlUpdated..item"/>
 
</mx:Application>

简单替换

posted @ 2009-09-10 21:32 bruce.peng 阅读(231) | 评论 (0)编辑 收藏

2009年9月5日

When creating the link, you determine which user should connect to the remote database to access the data.
The following table explains the differences among the categories of users involved in database links:
当创建link时,你必须是哪个user连接 remote database 访问数据
下表解释了不同user 如何调用database link:
 User Type

usre 类型
Sample Link Creation Syntax

创建link的语法
 Connected user  ---connetcted user 不是创建link的user,只是可以访问这个link的user
一个本地user可以通过指定username和pwd访问database link,那么他就是connected user。
system 通过public link 查询,这时connected user是system,并且remote数据库会连接到system schema
 CREATE PUBLIC DATABASE LINK hq USING 'hq';
 Current user  --global user必须有 X.509 认证(一个SSL-authenticated enterprise user)并且这个user 必须可以调用这个database link。current user 是oracle security的一个方面。

详情可以参见 oracle database advanced security. administrator 手册中的global security 相关信息
 CREATE PUBLIC DATABASE LINK hq CONNECT TO CURRENT_USER using 'hq';
 Fixed user  --当定义创建定义一个database link 时,Fixed user 的username/password 会出现在定义语句中。
当一个link中包含了fixed user的用户名和密码,那么这个用户名和密码将用于连接remote database.
 CREATE PUBLIC DATABASE LINK hq CONNECT TO jane IDENTIFIED BY doe USING 'hq';

posted @ 2009-09-05 10:42 bruce.peng 阅读(318) | 评论 (0)编辑 收藏

2009年8月13日

1st stp:
update the tomcat's catalina.bat file:
added on line under
:gotTmpdir
set JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,server=y,address=8000 -Xms256m -Xmx1024m

at here, we added listen for 8000, and also add memory for tomcat jvm.


2nd stp:
confin the eclipse
1, open "Debug Configurations" dialog window.
2, found the "Remote java Application" and right click ->  click "new" action
3, select connect tab and config the project which deploy to war.
4, select source tab, and added the projects what would u want debug.

for now every things is okay, we start tomcat.
tomcat should be listen foe 8000 and waiting for that.
start the debug that 2nd stp.

posted @ 2009-08-13 10:42 bruce.peng 阅读(228) | 评论 (0)编辑 收藏

added this word in mvn.bat file:
set MAVEN_OPTS=-Xms256m -Xmx512m

mvn build common:
mvn -Dmaven.test.skip=true clean package install



Tomecat 增加内存也是:set JAVA_OPTS=-Xms256m -Xmx1024m

posted @ 2009-08-13 10:27 bruce.peng 阅读(497) | 评论 (0)编辑 收藏

2009年3月1日

net.sf.ehcache.CacheException:error setting options
被这个错误折磨好久,这几天给工程配cache.竟然有莫名其妙的问题.同样的环境在我的台式机的Windows XP(正版)上面运行很正常,到了我的本本上面的Windows XP(D 版)系统上就不行了.抛出异常: "net.sf.ehcache.CacheException:error setting options". 后面我换到Linux系统(装的双系统)下配起环境,运行又okay.(应该不是D版的原因吧?......)
后面看到文章:http://hiok.blog.sohu.com/66514288.html,我出的问题和这篇文章上差不多.
根据上面讲的 将hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider换成hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider后在windows 下面又可以running了.
还没搞明白什么原因,先记着吧,正好尝试丢掉D版Windows,有时间再回来探个究竟.

posted @ 2009-03-01 23:24 bruce.peng 阅读(3639) | 评论 (0)编辑 收藏

2009年2月27日

http://www.smartfoxserver.com/_cn/docs/
官方网址:http://www.smartfoxserver.com/
SmartFoxServer 是专门为Adobe Flash设计的跨平台socket服务器,让开发者高效地开发多人应用及游戏. 该服务器主要用来创建多玩家游戏。
第一次发现这个网站。貌似很强大,很多东西都不用自己写了,里面有很多模板,想当初写游戏是怎么没看到这个东东啊,幸亏是付费的,不然真的是悔死了,呵呵。

posted @ 2009-02-27 16:44 bruce.peng 阅读(524) | 评论 (0)编辑 收藏

仅列出标题