黑夜,在两栋楼之间,眼角被这明晃晃的街灯吸引了,玻璃能看清屋里关着开着的门,看不清的是墙与墙之间的网尘。
远远的灯下,路面上经过的车流很悠然,看这种不是霓虹带来的烁光。
眼把脑拉回,却被风扇的吵杂无奈化,昏昏黄黄,茶杯里的水,丝丝冒着热气。
砰的一声,杯碎了,也听到?
黑夜,在两栋楼之间,眼角被这明晃晃的街灯吸引了,玻璃能看清屋里关着开着的门,看不清的是墙与墙之间的网尘。
远远的灯下,路面上经过的车流很悠然,看这种不是霓虹带来的烁光。
眼把脑拉回,却被风扇的吵杂无奈化,昏昏黄黄,茶杯里的水,丝丝冒着热气。
砰的一声,杯碎了,也听到?
从http://www.mongodb.org/downloads,下载了Windows 32-bit的1.8.0-rc0版本一试,解压于D盘,改名为mongodb,于其目录下新建了一个data目录,用来存放数据库文件。
运行CMD,cd进入D:\mongodb\bin目录,输入“mongod –dbpath d:\mongodb\data”,启动服务
Tue Mar 01 18:26:48 [initandlisten] MongoDB starting : pid=1080 port=27017 dbpat h=d:\mongodb\data 32-bit ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data ** see http://blog.mongodb.org/post/137788967/32-bit-limitations ** with --dur, the limit is lower Tue Mar 01 18:26:48 [initandlisten] db version v1.8.0-rc0, pdfile version 4.5 Tue Mar 01 18:26:48 [initandlisten] git version: 65a7e81df0747b6bc9380b78e018219 2bacdb4d0 Tue Mar 01 18:26:48 [initandlisten] build sys info: windows (5, 1, 2600, 2, 'Ser vice Pack 3') BOOST_LIB_VERSION=1_35 Tue Mar 01 18:26:48 [initandlisten] waiting for connections on port 27017 Tue Mar 01 18:26:48 [websvr] web admin interface listening on port 28017
新开一个CMD窗口,依旧进入D:\mongodb\bin目录,输入“mongo”
MongoDB shell version: 1.8.0-rc0 connecting to: test >
因之前,常用的数据库为SQL SERVER,所以可以参见SQL to Mongo Mapping Chart来使用一些命令。
rawChildren用于mx中hao系列容器组件中,如Canvas。
在flash Builder 4中,出现了spark系列组件,如Group。
问题,如何在Group中加入Shape组件呢?下面代码显示出如何在两组不同组件中加入Shape:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="600" height="340"> <fx:Script> <![CDATA[ import mx.core.UIComponent; protected function button1_clickHandler(event:MouseEvent):void { var shape: Shape = new Shape(); shape.graphics.beginFill(0xFFCC00); shape.graphics.drawRect(0,0,mxCanvas.width,mxCanvas.height); mxCanvas.rawChildren.addChildAt(shape, 0); } protected function button2_clickHandler(event:MouseEvent):void { var shape: Shape = new Shape(); shape.graphics.beginFill(0xFF0000); shape.graphics.drawRect(0,0,sGroup.width,sGroup.height); var uicomponent: UIComponent = new UIComponent(); uicomponent.addChild(shape); sGroup.addElementAt(uicomponent, 0); } ]]> </fx:Script> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <mx:Canvas id="mxCanvas" width="227" height="172" x="38" y="80"> <mx:Label text="Canvas.." id="label1"/> <s:Button x="86" y="42" label="Add Shape" click="button1_clickHandler(event)"/> <s:CheckBox x="86" y="81" label="CheckBox"/> </mx:Canvas> <s:Group id="sGroup" x="314" y="80" width="250" height="172"> <s:Label text="Group..." id="label2"/> <s:Button x="86" y="42" label="Add Shape" click="button2_clickHandler(event)"/> <s:CheckBox x="86" y="81" label="CheckBox"/> </s:Group> </s:Application>
UIComponent是由DisplayObject扩展而来,所有UIComponent都是DisplayObject,也就是说UIComponent都是children。UIComponent同时也实现了IVisualElement接口,因而所有的UIComponent也可以被作为elements看待。
public function get rawChildren():IChildList
容器中通常包含子组件,可以使用 Container.getChildAt() 方法和 Container.numChildren 属性枚举这些子组件。此外,容器可以包含样式元素和外观,如边框和背景。Flash Player 和 AIR 创建的子组件和外观之间没有任何差异。二者均可以使用播放器的 getChildAt() 方法和 numChildren 属性进行访问。但是,Container 类通过覆盖 getChildAt() 方法和 numChildren 属性(以及其他多个方法)可造成容器的子项是唯一的子组件的错觉。
如果您需要访问容器的所有子项(内容子项和外观),则需使用 rawChildren 属性上的方法和属性,而不是常规 Container 方法。例如,可使用 Container.rawChildren.getChildAt()) 方法。但是,如果容器为其子项创建了 ContentPane Sprite 对象,则 rawChildren 属性值将只计算 ContentPane,而不计算容器的子项。并非总能够确定容器何时包含 ContentPane。
注意:如果您调用 rawChildren 对象的 addChild 或 addChildAt 方法,则需在添加的组件上设置 tabFocusEnabled = false。这可以防止用户跳位到所添加的仅可视组件。
这个as的文件与我一起有三年了,却对它,总是远远的躲着,因为没有搞明白过。它是一个翻书的效果,被好些程序使用中,完美的很,Foxy写于2007-01-18,版本保持着1.0。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | package com.foxaweb.pageflip { import flash.geom.Point; import flash.display.BitmapData; import flash.geom.Matrix; import flash.display.Shape; /** * Computes, generates, and draws a pageflip. * * @notice PageFlip drawer * @author Foxy * @version 1.0 * @date 2007-01-18 * * Original author : * ----------------- * Didier Brun aka Foxy * webmaster@foxaweb.com * http://www.foxaweb.com * * AUTHOR * ***************************************************************************** * * authorName : Didier Brun - www.foxaweb.com * contribution : the original class * date : 2007-01-18 * * VISIT www.byteArray.org * * * LICENSE ****************************************************************************** * * This class is under RECIPROCAL PUBLIC LICENSE. * http://www.opensource.org/licenses/rpl.php * * Please, keep this header and the list of all authors * * * * Nomenclature * ------------ * * PT(0,0) PT(1,0) * --------------------------------------------------- * | <-------------------PW----------------------> | * | ^ Offset(0,0) x--> | * | | | * | | y | * | | | | * | | | | * | | V | * | | pPoints[] | * | | | * | | | * | | | * | | (T3) | * | PH ---| * | | --- / * | | --- / * | | --- / * | | --- / * | | --- / * | | --- / * | | PTD --- cPoints[] / * | | \ / * | | \ / * | | \ / * | | \ / * | | \ / * | V \ / * |-------------------------------- \/ * PT(0,1) PT(1,1) */ public class PageFlip { // ------------------------------------------------ // // ---o public static methods // // ------------------------------------------------ /** * Compute and generate a new flip. * * @param ptd Point indicating the position of the PTD point (the drag one) relative to the upper-left corner. * @param pt Point indicating the original position of the dragged point. The two possible values for its x and y properties are 0 or 1. pt(0,0) is the upper-left corner, for example, pt (1,1) is the bottom-right one. * @param pw int indicating the sheet width in pixels. * @param ph int indicating the sheet height in pixels. * @param ish If true, horizontal mode is provided, if false, vertical. * @param sens Number indicating the constraints sensibility. This parametter is a multiplicator for the constraints values. It's intended to prevent some awefull flickering effects. Its possible value is ranged between 0.9 and 1. 0.9 -> when ptd move is free (drag'n'drop), 1 -> when ptd move is progresive (tween when release). At best, you should never swap it from .9 to 1. A progressive incrementation is better. If flickering effects don't disturb you or if your ptd moves is coded, keep this parametter to 1. * * @return Object containing:<br /> * cPoints:Array - Array of points which describes the flipped part of the sheet. Note that in case of the ptd point is aligned with its original position or if the height of the shape is very small (<1) this array is set to null.<br /> * pPoints:Array - Array of points wich describes the fixed part of the sheet.<br /> * matrix:Matrix - Transformation matrix for the flipped part of the sheet.<br /> * width:Number - Sheet width.<br /> * height:Number - Sheet height. * */ public static function computeFlip(ptd:Point,pt:Point,pw:int,ph:int,ish:Boolean,sens:int):Object{ // useful vars var dfx:Number=ptd.x-pw*pt.x; var dfy:Number=ptd.y-ph*pt.y; var spt:Point=pt.clone(); var opw:int=pw; var oph:int=ph; // offset corections var temp:Number; // transform matrix var mat:Matrix=new Matrix(); if (!ish){ // size temp=pw; pw=ph; ph=temp; // ptd temp=ptd.x; ptd.x=ptd.y; ptd.y=temp; // pt temp=pt.x; spt.x=pt.y; spt.y=temp; } // pt1 & pt2 are the two fixed points of the sheet. opposed to ptd drag one. var pt1:Point=new Point(0,0); var pt2:Point=new Point(0,ph); // default points array // cPoints -> the fliped part var cPoints:Array=[null,null,null,null]; // pPoints -> the fixed part var pPoints:Array=[new Point(0,0),new Point(pw,0),null,null,new Point(0,ph)]; // compute some flip flipDrag(ptd,spt,pw,ph); // ditstance // it allows you to have a valid position for ptd. // the limit is the diagonal of the sheet here limitPoint(ptd,pt1,(pw*pw+ph*ph)*sens); // the limit is about the opposite fixed point limitPoint(ptd,pt2,(pw*pw)*sens); // first fliped point cPoints[0]=new Point(ptd.x,ptd.y); var dy:Number=pt2.y-ptd.y; var tot:Number=pw-ptd.x-pt1.x; var drx:Number=getDx(dy,tot); // fliped angle var theta:Number=Math.atan2(dy,drx); if (dy==0)theta=0; // another fliped angle var beta:Number=Math.PI/2-theta; var hyp:Number=(pw-cPoints[0].x)/Math.cos(beta); // vhyp is the hypotenuse of the fliped part var vhyp:Number=hyp; // if hyp is greater than the height of the sheet or hyp is // negative, the fliped part has 4 points // else, it's just a 3 points part (simple corner). if (hyp>ph || hyp<0)vhyp=ph; // second fliped point cPoints[1]=new Point( cPoints[0].x+Math.cos(-beta)*vhyp, cPoints[0].y+Math.sin(-beta)*vhyp); // last fliped point cPoints[3]=new Point(cPoints[0].x+drx,pt2.y); // if we have a 4 points shape if (hyp!=vhyp){ dy=pt1.y-cPoints[1].y; tot=pw-cPoints[1].x; drx=getDx(dy,tot); // push the before the last point cPoints[2]=new Point(cPoints[1].x+drx,pt1.y); // we can now find the fixed points of the sheet pPoints[1]=cPoints[2].clone(); pPoints[2]=cPoints[3].clone(); pPoints.splice(3,1); }else{ // else we delete the point cPoints.splice(2,1); // we can now find the fixed points of the sheet pPoints[2]=cPoints[1].clone(); pPoints[3]=cPoints[2].clone(); } // these two polygons are always convex ! // now we can flip the two arrays flipPoints(cPoints,spt,pw,ph); flipPoints(pPoints,spt,pw,ph); // if !ish (vertical mode) // we have to change the points orientation if (!ish){ oriPoints(cPoints,spt,pw,ph); oriPoints(pPoints,spt,pw,ph); } // flipped part transfrom matrix var gama:Number=theta; if (pt.y==0)gama=-gama; if (pt.x==0)gama=Math.PI+Math.PI-gama; if (!ish)gama=Math.PI-gama; mat.a=Math.cos(gama); mat.b=Math.sin(gama); mat.c=-Math.sin(gama); mat.d=Math.cos(gama); ordMatrix(mat,spt,opw,oph,ish,cPoints,pPoints,gama,beta); // here we fix some mathematical bugs or instabilities if (vhyp==0)cPoints=null; if (Math.abs(dfx)<1 && Math.abs(dfy)<1)cPoints=null; // now we just have to return all the stuff return {cPoints:cPoints,pPoints:pPoints,matrix:mat,width:opw,height:oph}; } /** * Draw a sheet using two Bitmap objects. * * @param ocf computeFlip() returned object * @param mc Target * @param bmp0 First page bitmap (left-top aligned) * @param bmp1 Second page bitmap (left-top aligned) * */ public static function drawBitmapSheet(ocf:Object,mc:Shape,bmp0:BitmapData,bmp1:BitmapData):void{ // affectations var wid:Number=ocf.width; var hei:Number=ocf.height; var nb:Number; var ppts:Array=ocf.pPoints; var cpts:Array=ocf.cPoints; // draw the fixed part mc.graphics.beginBitmapFill(bmp0,new Matrix(),false,true); nb=ppts.length; mc.graphics.moveTo(ppts[nb-1].x,ppts[nb-1].y); while (--nb>=0)mc.graphics.lineTo(ppts[nb].x,ppts[nb].y); mc.graphics.endFill(); // draw the flipped part if (cpts==null)return; mc.graphics.beginBitmapFill(bmp1,ocf.matrix,false,true); nb=cpts.length; mc.graphics.moveTo(cpts[nb-1].x,cpts[nb-1].y); while (--nb>=0)mc.graphics.lineTo(cpts[nb].x,cpts[nb].y); mc.graphics.endFill(); } // ------------------------------------------------ // // ---o private static methods // // ------------------------------------------------ /** * orientation correction * @private */ private static function oriPoints(pts:Array,po:Point,pw:Number,ph:Number):void{ var nb:Number=pts.length; var temp:Number; while (--nb>=0){ temp=pts[nb].x; pts[nb].x=pts[nb].y; pts[nb].y=temp; } } /** * ptdarg correction * @private */ private static function flipDrag(ptd:Point,po:Point,pw:Number,ph:Number):void{ // flip y if (po.y==0)ptd.y=ph-ptd.y; // flip x if (po.x==0)ptd.x=pw-ptd.x; } /** * flip correction * @private */ private static function flipPoints(pts:Array,po:Point,pw:Number,ph:Number):void{ var nb:Number=pts.length; // flip if (po.y==0 || po.x==0){ while (--nb>=0){ if (po.y==0)pts[nb].y=ph-pts[nb].y; if (po.x==0)pts[nb].x=pw-pts[nb].x; } } } /** * compute some trigonometry equation * * this one is more stable than Math.atan2 for our case * * @private */ private static function getDx(dy:Number,tot:Number):Number{ return (tot*tot-dy*dy)/(tot*2); } /** * limit the ptdrag position * @private */ private static function limitPoint(ptd:Point,pt:Point,dsquare:Number):void{ var theta:Number; var lim:Number; var dy:Number=ptd.y-pt.y; var dx:Number=ptd.x-pt.x; var dis:Number=dx*dx+dy*dy; // we save some times using square if (dis>dsquare){ theta=Math.atan2(dy,dx); lim=Math.sqrt(dsquare); ptd.x=pt.x+Math.cos(theta)*lim; ptd.y=pt.y+Math.sin(theta)*lim; } } /** * matric correction * @private */ private static function ordMatrix(mat:Matrix,spt:Point,opw:Number,oph:Number,ish:Boolean,cPoints:Array,pPoint:Array,gama:Number,beta:Number):void{ if (spt.x==1 && spt.y==0){ mat.tx=cPoints[0].x; mat.ty=cPoints[0].y; if (!ish){ mat.tx=cPoints[0].x-Math.cos(gama)*opw-Math.cos(-beta)*oph; mat.ty=cPoints[0].y-Math.sin(gama)*opw-Math.sin(-beta)*oph; } } if (spt.x==1 && spt.y==1){ mat.tx=cPoints[0].x+Math.cos(-beta)*oph; mat.ty=cPoints[0].y+Math.sin(-beta)*oph; if (!ish){ mat.tx=cPoints[0].x+Math.cos(-beta)*oph; mat.ty=cPoints[0].y-Math.sin(-beta)*oph; } } if (spt.x==0 && spt.y==0){ mat.tx=cPoints[0].x-Math.cos(gama)*opw; mat.ty=cPoints[0].y-Math.sin(gama)*opw; } if (spt.x==0 && spt.y==1){ mat.tx=cPoints[0].x-Math.cos(gama)*opw-Math.cos(-beta)*oph; mat.ty=cPoints[0].y-Math.sin(gama)*opw+Math.sin(-beta)*oph; if (!ish){ mat.tx=cPoints[0].x; mat.ty=cPoints[0].y; } } } } } |
加上备注,总共不过402行代码,准备研究。
为MongoDB提供技术支持的是10gen公司,MongoDB的名字源自一个形容词humongous(巨大无比的),在向上扩展和快速处理大数据量方面,它会损失一些精度,不适宜用它来处理复杂的金融事务,如证券交易,数据的一致性可能无法得到保证。
MongoDB是一个新兴的NoSQL数据库管理系统,常被用于高流量网站,在线游戏网站和搜索引擎的大规模数据管理和分类。 NoSQL数据库都被贴上不同用途的标签,如MongoDB和CouchDB都是面向文档的数据库,但这并不意味着它们可以象JSON(JavaScript Object Notation)那样以结构化数据形式存储文本文档。
面向文档的数据库与关系数据库有着显著的区别,面向文档的数据库用一个有组织的文件来存储数据,而不是用行来存储数据,在MongoDB中,一组文档被看作是一个集合,在关系数据库中,许多行的集合被看作是一张表。但同时它们的操作又是类似的,关系数据库使用select,insert,update和delete操作表中的数据,面向文档的数据库使用query,insert,update和remove做意义相同的操作。
MongoDB中对象的最大尺寸被限制为4MB,但对象的数量不受限制,MongoDB可以通过集群加快操作的执行速度,当数据库变得越来越大时,可以向集群增加服务器解决性能问题。
public function describeType(value:*):XML
语言版本: ActionScript 3.0 生成描述 ActionScript 对象(命名为方法的参数)的 XML 对象。
如果 value 参数是类型的实例,则返回的 XML 对象包括该类型的所有实例属性,但不包括任何静态属性。可以在解析 XML 对象时检查此条件,方法是检查
要获取某个类型的静态属性,请为 value 参数传递该类型本身。返回的 XML 对象不仅仅包括类型的静态属性,而且还包括它的所有实例属性。实例属性嵌套在名为
详情请参见http://help.adobe.com/zh_CN/AS3LCR/Flex_4.0/flash/utils/package.html#describeType%28%29
夜听M童说下雪了,开窗观,果然,雪正在飘飘然地,在大地上,再次降临,笑,我喜欢。
白白干净了,她自己都感觉自己很不同了,呵呵,一直在一边趴着,陪着我,只是太困了,进房间睡了,她应该还是蛮喜欢那天雪地里与亮亮玩躲迷藏吧。
嘿嘿,亮亮明天就要开学了,好快哦,脑子里却想着她在那儿低头给白白洗衣服,(^.^)
雪兔,蹦蹦跳跳,满是欢笑。。。
嘿嘿,刚走进客厅,窗外有耀眼的白,加速近前,真的白了,这雪来的还真是晚哦,不过还是让我感觉到快乐,喜欢这种外面静静的下着雪,大地就这么被雪一层一层地覆盖着,散发出来洁白的光。
M童说“断桥残雪指下雪了,大家都去看雪,把桥踩断了”,把我逗乐了,还是希望明天醒来,依旧能保留多些白的地方。
暂时,不知道,这雪会下多久,会有多厚,看不清楚,只好等。
这种喜悦能持续一段时间的,等的时间长了,也得到了,所以才这么高兴的吧。呵呵。。。
安。。我期待的雪。。
耳边是声声的烟花,不断踱到窗边看那闪闪的烟火,绚丽呀,总有一颗想要年青的心,纠结于腾空绽放的灿烂瞬间,呵呵,也许生命所需要的也是这种追求吧。。
终于声音小多了。。大家都在准备着睡觉了吧。。白白依旧在椅子上陪着我。。嘿嘿。。看着她。。白多了。。在亮亮的打理下。。她也精神了N多多。。6年的时间。。
准备准备。。一会儿也早早地睡了。。新年到了。。笑。。让一切都快乐着。。享受着闪亮。。享受生活。。