2008-09-01ãã1ã¶æéã®è¨äºä¸è¦§
java.lang.Iterableãå®è£ ããã°OKã /** * æ¡å¼µforæã§ã«ã¼ãã§ããã¯ã©ã¹ */ class Test implements Iterable<String> { public Iterator<String> iterator () { return Arrays.asList( new String[] { "a", "b", "c" } ).iterator(); } } for ( String str : new Test() )</string></string>â¦
åãã©ã¡ã¼ã¿ã§æå®ãããåãå¼æ°ã§åãåãã¡ã½ããããã£ã¦ã class Test<T> { void add( T value ) {} } ãã®ã¨ãããaddãã®å¼æ°ã¨ãã¦æå®ã§ããã®ã¯ãTã¨ä»£å ¥äºææ§ãããã¯ã©ã¹(T or Tã®æ´¾çã¯ã©ã¹)ãã«ãªãã¾ããã§ãããã¨åãããªã§ãä¸æ¬ç»é²çã®ã</t>â¦
ObjectProxyã使ãã¨ãªãã¸ã§ã¯ãã®å±æ§å¤æ´ãç£è¦ããä»çµã¿ãããã£ã¨ä½ãã¾ãã使ãæ¹ã¯ä»¥ä¸ã®éãã ç£è¦ãããªãã¸ã§ã¯ããä½æã ä½æãããªãã¸ã§ã¯ããå¼æ°ã¨ãã¦ãObjectProxyãä½æãã¦ã©ããã ãaddEventListener()ãã§ObjectProxyã«å±æ§å¤æ´ãªâ¦
ãã£ã«ã¿ã使ãã¨ãã¹ãã©ã¤ããããããããã«ããããã·ã£ãã¦ããã©ã¼ãªã©ã®å¹æãé©ç¨ãããã¨ãã§ãã¾ãã ãã£ã«ã¿ã¯flash.filtersããã±ã¼ã¸é ä¸ã«ããããããã¾ãã ã¹ãã©ã¤ããªã©DisplayObjectæ´¾çã®ã³ã³ãã¼ãã³ãã§ããã°ããã£ã«ã¿ãä½æãã¦fâ¦
æ¨æ¥ã®ç¶ããXMLãªãã©ã«ã使ã£ã¦æååãçæããå ´åã®æ§è½ã測ã£ã¦ã¿ã¾ããã 20æåç¨åº¦ã®æååãããæååé£çµããXMLãªãã©ã«ããXMLãªãã©ã«+åãè¾¼ã¿ãã®ããããã§50000åçæããå ´åã®æç¨æéãè¨æ¸¬ã ãããã5å試è¡ããå¹³åãåã£ã¦ãã¾ãâ¦
ActionScriptã§é·ãã®è¤æ°è¡æååãä½ãã®ã£ã¦ã¡ã³ãã¦ã§ããããRubyã¿ããã«ãã¢ããã¥ã¡ã³ãã¨ã使ããã°ããã®ã«ã¼ãã¨ããæã«XMLãªãã©ã«ã使ãã¾ã! // XMLãªãã©ã«ããã¢ããã¥ã¡ã³ã風ã«ä½¿ã! XML.ignoreWhitespace = false;// ããã©ã«ãã ã¨ããâ¦
StringUtil#substituteã§ãã³ãã¬ã¼ãæååä¸ã®ã{æ°å}ããä»»æã®å¤ã§ç½®ãæããæååãçæã§ãã¾ãã // ãã³ãã¬ã¼ãã®ã{æ°å}ããç½®æããæååãçæãã stdout.text = StringUtil.substitute( "name : {0}, age : {1}", "mii", 1); // â name : â¦
ObjectUtil#toStringã§ãªãã¸ã§ã¯ãã®å±æ§ä¸è¦§ã示ãæååãçæã§ãã¾ãã // ãªãã¸ã§ã¯ãã®å±æ§ä¸è¦§ã表示 var obj:Object = { a:10, b:"bbb", c:true, d:[1,2,3,4,5], e:{foo:"foo",hoge:"hoge"}, f:function():void{} }; stdout.text = ObjectUtil.toSâ¦
ãRubyã¯ã©ã¹ãJSONã§ã¢ã¯ã»ã¹ã§ããWebãµã¼ãã¹åãããã§ä½ã£ãJSONBroker(ä»»æã®Rubyã¯ã©ã¹ã®APIãJSON-RPCã©ã¤ã¯ãªãããã³ã«ã§ã¢ã¯ã»ã¹ã§ããWebãµã¼ãã¹ã¨ãã¦å ¬éããããã®ç°¡æã¦ã¼ãã¤ãªãã£)ã®ActionScriptçã¯ã©ã¤ã¢ã³ããæ¸ãã¾ãããåã«ä½ã£ãâ¦
JavaScriptã¨ä¸ç·ãã¨æã£ããå¾®å¦ã«æ¡å¼µããã¦ã¾ãã! > ActionScriptã®é åãã¨ãããã¨ã§ã便å©ãããªAPIã使ããµã³ãã«ãæ¸ãã¦ã¿ã¾ããã使ã£ã¦ã¿ãAPIã¯ä»¥ä¸ã Array#forEach é åã®è¦ç´ ãé çªã«åãåºãã¾ããforã«ã¼ãã®ä»£ããã«ã Array#map é åã®â¦
é åãã½ã¼ãããAPIã¨ãã¦ãArray#sortã¨Array#sortOnãæä¾ããã¦ãã¾ãã Array#sort é åã®è¦ç´ ãã½ã¼ããã¾ãã å¼æ°ã§æ¯è¼é¢æ°(第ä¸å¼æ°)ã¨ãªãã·ã§ã³(第äºå¼æ°)ãæå®ã§ãã¾ãã æ¯è¼é¢æ°ãæå®ãããã¨ã§ãä»»æã®ãã¸ãã¯ã«åºã¥ãã½ã¼ããå¯è½ã§ããâ¦
mx.utils.NameUtil#createUniqueName()ã§ãªãã¸ã§ã¯ãã®ä¸æãªIDãä½æã§ãã¾ãã IDã¯ãç¡ä¿®é£¾ã®ã¯ã©ã¹å+çªå·ãã«ãªãã¾ãã ãç¡ä¿®é£¾ã®ã¯ã©ã¹åããªããããã±ã¼ã¸ãéãååã¯ã©ã¹ã ã¨åãIDã«ãªãã®ã§ã¯ãã¨æããããçªå·ããã¹ã¦ã®ãªãã¸ã§ã¯ãã§ä¸æâ¦
Flexã§ããã¼ã¨å¤ããã¢ã§ä¿æããæ§é (rubyã§ããHashã¦ããªãã®)ã使ãããå ´åãflash.utils.Dictionaryã使ãã¾ãã JavaScriptã ã¨Objectã§ä½ã¨ããã¾ãã(Flexã§ãåãããã«ä½ã¨ãã§ãã¾ãã)ã Objectã¨éã£ã¦ãDictionaryã§ã¯ãã¼ã«ãªãã¸ã§ã¯ããâ¦
ActionScriptã®åæå®ã§ã¯ãã*ãã¯åæå®ãªããæå³ãã¾ããä»»æã®åã¨ãè¥å¹²æå³ãéã£ã¦ãã¦ã ä»»æå¤ãä»£å ¥ã§ãã¦ã ãã¤ãä»»æã®å¤ã¨ãã¦åãåºããã¨ãã§ãã¾ãã // ä»»æã®å¤ãä»£å ¥ã§ã var a:* = "foo"; var b:Object = "foo"; // ä»»æã®å¤ã¨ãã¦åâ¦
Graphics#beginBitmapFillã使ã£ã¦ãæ å ãç»åã§å¡ãã¤ã¶ããµã³ãã«ã§ãã ç»åã¯swfå ã«ã¢ã»ããã¨ãã¦åãè¾¼ãã ã¢ãã使ç¨ãã¦ã¾ããã¢ã»ããã®ä½¿ãæ¹ã¯ãã¡ããåç §ã ãã¨ã¯ãbeginBitmapFillâdrawRectâendFillã§OKã package { import flash.display.â¦
æ¥æ(Date)ã®ãã©ã¼ãããã«ã¯mx.formatters.DateFormatterã使ãã¾ãã以ä¸ã¯ãç¾å¨æå»ããã©ã¼ããããã¦è¡¨ç¤ºãããµã³ãã«ã§ãã package { import flash.display.*; import flash.text.*; import mx.formatters.*; public class Sample extends Sprite {â¦
FireBugã®ã³ã³ã½ã¼ã«ã«è¡çªå·ä»ãã§swfã§çºçããä¾å¤ã®ã¹ã¿ãã¯ãã¬ã¼ã¹ã表示ããæé ã§ãããã¤ã³ãã¯ä»¥ä¸ã ãããã¯çFlash Playerã§swfãå®è¡ã âçºçããä¾å¤ããã¹ã¿ãã¯ãã¬ã¼ã¹ãåå¾ã§ããããã«ãªãã¾ãã ã³ã³ãã¤ã«ãªãã·ã§ã³ã§ãããã°ããªã³â¦
ãasãæ¼ç®åã§åãã£ã¹ãããisãæ¼ç®åã§äºææ§ãã§ãã¯ãã§ãã¾ãã package { import flash.display.*; import flash.text.*; public class AsIsSample extends Sprite { public function AsIsSample(){ var str:String = "" var a:Object = "a"; // isâ¦
Flex(ã¨ãããActionScript3)ã§ã¯ãã¡ã½ããããã£ã¼ã«ãã«åå空éãè¨å®ã§ãã¾ãã åå空éãè¨å®ãããã¡ã½ããã¯ãåå空éãæ示(ã¾ãã¯use)ãã¦å¼ã³åºãå¿ è¦ãããã¾ãã publicãprivateã¨ãã£ãã¢ã¯ã»ã¹å¶å¾¡æå®åãç¹æ®ãªåå空éã¨ãã¦å®è£ ããã¦â¦
Flexã§privateãªã¯ã©ã¹ãå®ç¾©ããå ´åãããã±ã¼ã¸å®ç¾©ã®å¤é¨ã§å®ç¾©ãã¾ãã Flexã§ã¯ã1ã¤ã®ã½ã¼ã¹ãã¡ã¤ã«ã«è¤æ°ã®ã¯ã©ã¹ãå«ãããã¨ãå¯è½ã§ããã ãã¡ã¤ã«ã®å¤é¨ã«ããã³ã¼ãã§ä½¿ç¨ã§ããã®ã¯åãã¡ã¤ã«ã®ã¯ã©ã¹ 1 ã¤ã ããåãã¡ã¤ã«ã®ã¯ã©ã¹ã®ãã¡1â¦
Proxyã使ãã¨ããªãã¸ã§ã¯ãã®ã¡ã½ããå¼ã³åºããããããã£ã¸ã®ã¢ã¯ã»ã¹ãã¤ã³ã¿ã¼ã»ããããä»çµã¿ãä½ãã¾ãã æ©è½çã«ã¯Javaã®Proxyã«è¿ãæãã§ãã ã¡ã½ãã以å¤ã«ããå±æ§ã¸ã®ã¢ã¯ã»ã¹ããfor...inããfor...each in ãã§å±æ§ãåæãããå ´åã®åâ¦
ã¯ãªãããã¼ãã®å¤ãæ´æ°ãããµã³ãã«ã§ããSystem#setClipboard()ã§ããã£ã¨è¨å®ã§ãã¾ãã package { import flash.display.*; import flash.system.System; public class SetClipBoard extends Sprite { public function SetClipBoard(){ // ã¯ãªãããâ¦
æ±ããã¼ã¿æ°ãå¤ãã¨è¥å¹²æ§è½ãæ°ã«ãªãæãã®Generatorã§ãããcallccãããªãã¦Threadã使ãã°ã¡ãã£ã¨ã¯æ©ããªã£ãããããããã?ã¨æã£ã¦ä½ã£ã¦ã¿ã¾ãããnext?ã¨nextã ããQueueã使ã£ã¦ããã£ã¨å®è£ ã require 'thread' # ã¹ã¬ããã使ã£ãGeneratorâ¦
Generatorã使ãã¨ãå é¨ã¤ãã¬ã¼ã¿(Array#eachã¿ãããªã渡ããããããã¯ã«å¯¾ãã¦è¦ç´ ã1ã¤ã¥ã¤ã³ã¼ã«ããã¯ããã¿ã¤ãã®ã¤ãã¬ã¼ã¿)ãå¤é¨ã¤ãã¬ã¼ã¿(Javaè¦ãããªãhasNext,nextã§è¦ç´ ãåãåºãã¤ãã¬ã¼ã¿)ã«å¤æã§ãã¾ãã array = ["1", "2", "3"] # â¦
ã°ã©ãã¼ã·ã§ã³ããåè§ãæãã«ã¯ãGraphics#beginGradientFill()ãè¨å®ãããã¨ãGraphics#drawRect()ã§åè§ãæç»ãã¾ãã ã°ã©ãã¼ã·ã§ã³ã®ç¨®å¥(ç·oræ¾å°)ã¨ãè²ãªã©ããããããã©ã¡ã¼ã¿ãæå®ã§ãã¾ãããã¾ããããã¥ã¡ã³ããåç §ã¨ãããã¨ã§ã(âGraâ¦
ââââ ãæ®æ¥ã¼ããã®ä»äºåä½è : åè¶æµ©ä¸éåºç社/ã¡ã¼ã«ã¼: æ¥æ¬è½çåä¼ããã¸ã¡ã³ãã»ã³ã¿ã¼çºå£²æ¥: 2007/12/22ã¡ãã£ã¢: åè¡æ¬è³¼å ¥: 11人 ã¯ãªãã¯: 271åãã®ååãå«ãããã° (205件) ãè¦ã æ®æ¥ãããªã!ã«ã¯è³åãããã©ãæ®æ¥ããªãã¨çæ´»ãã¾ã¾â¦
Flexã¨ãããActionScriptã§ãHTTPã§ãµã¤ãã«æ¥ç¶ããã¼ã¿ãåå¾ãããµã³ãã«ã§ããã¯ãã¹ãã¡ã¤ã³ã¾ããã®ãã¨ãã¾ã è¯ãããã£ã¦ãªãã®ã§ãã¨ããããåããµã¤ãã®ãã¼ã¿ãåå¾ãã¦ã¾ãã package { import flash.display.Sprite; import flash.text.*; imâ¦
Dateã使ãã¨ç°¡åã«ã§ãã¾ãã require 'date' d = Date.new( 2008, 9, 1 ) # 200å次ã®æ¥ãæ±ããã 200.times { d += 1 puts d } å®è¡çµæã§ãã 2008-09-02 2008-09-03 2008-09-04 2008-09-05 2008-09-06 2008-09-07 ...çç¥ æåãTimeã使ã£ã¦ãããã¨â¦
ActionScript3ã¨ããã¯ãè¨æ¶ã«ããã¯ãããªãããã¾ããJavaScriptã¨ä¼¼ããããªããã ãã¼ããã¨ãããã¨ã§æ°åã§æ¸ãé²ãã¦ããããã§ãããããã§ä¸ã¤å¤§ããªéããçºè¦ãActionScript3ã§ã¯thisãçç¥ã§ããã®ã§ãã package sample { public class Kittenâ¦
ä»æ´ãªããlog.asãªããã®ãçºè¦ããã®ã§ä½¿ã£ã¦ã¿ã¾ããããã使ãã¨ããlog()ãé¢æ°1çºã§ãFlexããFireBugã®ã³ã³ã½ã¼ã«ã«ãã¼ã¿ãåºåãããã¨ãã§ãã¾ãã1ã¤ã®ã½ã¼ã¹ãã¡ã¤ã«ã ãã§ã§ãã¦ãã¦ãããã¸ã§ã¯ãã¸ã®å°å ¥ãç°¡åã log.asã®ã½ã¼ã¹ãã³ãã¼ãã¦â¦