{"id":2720,"date":"2015-05-30T13:13:47","date_gmt":"2015-05-30T04:13:47","guid":{"rendered":"http:\/\/oohito.com\/nqthm\/?p=2720"},"modified":"2015-05-30T13:13:47","modified_gmt":"2015-05-30T04:13:47","slug":"%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aemorphic%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab%ef%bc%88%e7%95%aa%e5%a4%96%e7%b7%a8%ef%bc%89%e3%80%8cscratchcat%e3%82%92%e3%83%80","status":"publish","type":"post","link":"https:\/\/oohito.com\/nqthm\/archives\/2720","title":{"rendered":"\u306f\u3058\u3081\u3066\u306eMorphic\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\uff08\u756a\u5916\u7de8\uff09\u300cScratchCat\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u300d"},"content":{"rendered":"<p><a href=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2015\/05\/Cat_1_Bitmap-1-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2015\/05\/Cat_1_Bitmap-1-1.png\" alt=\"Cat_1_Bitmap\" width=\"184\" height=\"200\" class=\"alignnone size-full wp-image-2728\" \/><\/a><br \/>\nScratch\u306e\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306e\u732b\u3092\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3002<br \/>\n<a href=\"http:\/\/wiki.scratch.mit.edu\/wiki\/Scratch_Media\">Scratch Media\u306e\u30a6\u30a7\u30d6\u30da\u30fc\u30b8<\/a>\u3092\u958b\u3044\u3066\u3001\u305d\u3053\u304b\u3089\u300c<a href=\"http:\/\/wiki.scratch.mit.edu\/w\/images\/ScratchCat.zip\">SVG+PNG (2 Costumes)<\/a>\u300d\u3068\u3044\u3046\u5727\u7e2e\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u3068OS\u4e0a\u306e\u64cd\u4f5c\u304c\u3042\u308c\u3070\u89e3\u6c7a\u3059\u308b\u7c21\u5358\u306a\u4ed5\u4e8b\u306a\u306e\u3060\u304c\u3001\u3053\u308c\u3092Pharo\u3067\u3084\u308b\u3068\u3069\u3046\u306a\u308b\u304b\u3068\u3044\u3046\u3053\u3068\u3067\u3042\u308b\u3002<br \/>\n\u307e\u305a\u3001http:\/\/wiki.scratch.mit.edu\/w\/images\/ScratchCat.zip \u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bZnEasy\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u306e\u304c\u7c21\u5358\u3067\u3042\u308b\u3002<\/p>\n<pre>res := ZnEasy get: 'http:\/\/wiki.scratch.mit.edu\/w\/images\/ScratchCat.zip'.<\/pre>\n<p>\u3053\u3046\u3059\u308b\u3068\u3001res\u306b\u306fZnResponse\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u8fd4\u3063\u3066\u304f\u308b\u3002\u554f\u984c\u306a\u3051\u308c\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5185\u5bb9\u3068\u306a\u308b\u3002<\/p>\n<pre>\"a ZnResponse(200 OK application\/zip 12017B)\"<\/pre>\n<p>12017\u30d0\u30a4\u30c8\u306eZIP\u30d5\u30a1\u30a4\u30eb\u304c\u5f97\u3089\u308c\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<br \/>\nZIP\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u5f97\u308b\u306b\u306f\u3001contents\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u308c\u3070\u826f\u3044\u3002<\/p>\n<pre>res contents.<\/pre>\n<p>ZIP\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30fc\u30ab\u30a4\u30d6\u3068\u3057\u3066\u8aad\u307f\u8fbc\u3080\u306b\u306f\u3001ZipArchive\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u5bfe\u3057\u3066readFrom:\u3067\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u4e0e\u3048\u308b\u3002<\/p>\n<pre>arc := ZipArchive new readFrom: res contents readStream.<\/pre>\n<p>\u30a2\u30fc\u30ab\u30a4\u30d6\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u7fa4\uff08\u30e1\u30f3\u30d0\u30fc\uff09\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<pre>arc members.\n\"an OrderedCollection(a ZipFileMember(Cat_1.svg) a ZipFileMember(Cat_2.svg)\n a ZipFileMember(Cat_1_Bitmap.png) a ZipFileMember(Cat_2_Bitmap.png))\"<\/pre>\n<p>4\u3064\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u5165\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3002<br \/>\n\u30a2\u30fc\u30ab\u30a4\u30d6\u304b\u3089\u7279\u5b9a\u306e\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u3088\u3044\u3002<\/p>\n<pre>arc extractMember: 'Cat_1_Bitmap.png'.<\/pre>\n<p>\u7c21\u5358\uff01\u3068\u601d\u3063\u305f\u306e\u3060\u304c\u843d\u3068\u3057\u7a74\u304c\u3042\u3063\u305f\u3002\u4e0a\u3092Do it\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3002<br \/>\n<a href=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2015\/05\/Screen-Shot-2015-05-30-at-12.08.06-1-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2015\/05\/Screen-Shot-2015-05-30-at-12.08.06-1-300x81.png\" alt=\"error\" width=\"300\" height=\"81\" class=\"alignnone size-medium wp-image-2723\" \/><\/a><br \/>\n\u3069\u3046\u3084\u3089ZipFileMember\u30af\u30e9\u30b9\u306e extractToFileNamed:inDirectory: \u30e1\u30bd\u30c3\u30c9\u306b\u554f\u984c\u304c\u3042\u308b\u3089\u3057\u3044\u3002<br \/>\n<a href=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2015\/05\/Screen-Shot-2015-05-30-at-12.08.56-1-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2015\/05\/Screen-Shot-2015-05-30-at-12.08.56-1-300x152.png\" alt=\"\u30a8\u30e9\u30fc\u5185\u5bb9\" width=\"300\" height=\"152\" class=\"alignnone size-medium wp-image-2724\" \/><\/a><br \/>\n\u30a8\u30e9\u30fc\u3092\u8d77\u3053\u3057\u3066\u3044\u308b\u7b87\u6240\u306f\u3053\u3053\u3067\u3042\u308b\u3002<\/p>\n<pre>    fullDir\n        forceNewFileNamed: file basename\n        do: [:stream |  self extractTo: stream]]<\/pre>\n<p>\u3088\u304f\u898b\u308b\u3068\u30e1\u30bd\u30c3\u30c9\u5185\u3067fullDir\u306e\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u7b87\u6240\u304c\u306a\u3044\u3002\u5b9f\u969b\u3001fullDir\u306e\u5185\u5bb9\u306fnil\u3060\u3057\u3001\u30a8\u30e9\u30fc\u306fUndefinedObject\uff08\u3064\u307e\u308anil\uff09\u306b\u5bfe\u3059\u308b\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3053\u308c\u306f\u60f3\u50cf\u3060\u304c\u3001\u4ee5\u524d\u306bFileDirectory\u3092FileSystem\u306b\u7f6e\u304d\u63db\u3048\u305f\u969b\u3001\u3053\u306e\u90e8\u5206\u306e\u4fee\u6b63\u304c\u53d6\u308a\u6b8b\u3055\u308c\u305f\u306e\u3067\u306f\u306a\u3044\u3060\u308d\u3046\u304b\u3002\u30b3\u30e1\u30f3\u30c8\u3050\u3089\u3044\u6b8b\u3057\u3068\u3051\u3088\u3063\u3066\u611f\u3058\u3067\u3042\u308b\u3002Pharo1.4\u307e\u3067\u3055\u304b\u306e\u307c\u3063\u3066\u307f\u308b\u3068\u3001\u60f3\u50cf\u3069\u304a\u308aFileDirectory\u3092\u7528\u3044\u3066fullDir\u304c\u4f5c\u3089\u308c\u3066\u3044\u305f\u3002<\/p>\n<pre>extractToFileNamed: aLocalFileName inDirectory: dir\n    | fullName fullDir |\n    self isEncrypted ifTrue: [ ^self error: 'encryption unsupported' ].\n    fullName := dir fullNameFor: aLocalFileName.\n    fullDir := FileDirectory forFileName: fullName.\n    fullDir assureExistence.\n    self isDirectory\n        ifFalse: [ fullDir\n            forceNewFileNamed: (FileDirectory localNameFor: fullName)\n            do: [:stream |  self extractTo: stream]]\n    ifTrue: [ fullDir assureExistence ]<\/pre>\n<p>\u3053\u3046\u3044\u3046\u3053\u3068\u3067\u30e1\u30b2\u3066\u3044\u3066\u306f\u3044\u3051\u306a\u3044\u3002\u305b\u3063\u304b\u304f\u5168\u3066\u306e\u30bd\u30fc\u30b9\u304c\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306a\u306e\u3060\u304b\u3089\u81ea\u5206\u3067\u4f55\u3068\u304b\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u308b\u3079\u304d\u3067\u3042\u308b\u3002<br \/>\nfullDir\u306b\u306fforceNewFileNamed:do:\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u3068assureExistence\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u9001\u3089\u308c\u3066\u3044\u308b\u3002\u524d\u8005\u306f\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u3092\u6d41\u3057\u8fbc\u3093\u3067\u304a\u308a\u3001\u5f8c\u8005\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u3063\u3066\u3044\u308b\u306b\u3059\u304e\u306a\u3044\u3002\u3053\u308c\u3092\u73fe\u5728\u306eFileSystem\u3067\u5b9f\u73fe\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u308b\u3002<\/p>\n<pre>    self isDirectory\n        ifFalse: [\n            file isFile\n                ifTrue: [ file delete ].\n            self extractTo: file writeStream ]\n        ifTrue: [ file ensureCreateDirectory ]<\/pre>\n<p>\u4e0a\u8a18\u304c\u5909\u66f4\u90e8\u5206\u3067\u3042\u308b\u3002self isDirectory\u4ee5\u964d\u3092\u66f8\u304d\u63db\u3048\u308b\u3002<br \/>\n\u3053\u308c\u3067\u6674\u308c\u3066ZIP\u30a2\u30fc\u30ab\u30a4\u30d6\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u5c55\u958b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<pre>arc extractMember: 'Cat_1_Bitmap.png'.\narc extractMember: 'Cat_2_Bitmap.png'.<\/pre>\n<p>\u4ee5\u4e0b\u3092Do it\u3059\u308c\u3070\u3001\u5c55\u958b\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u30e2\u30fc\u30d5\u3068\u3057\u3066\u53d6\u308a\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<pre>(PNGReadWriter formFromFileNamed: 'Cat_1_Bitmap.png') asMorph openInWorld.\n(PNGReadWriter formFromFileNamed: 'Cat_2_Bitmap.png') asMorph openInWorld.<\/pre>\n<p>\uff08\u756a\u5916\u7de8\u304a\u308f\u308a\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scratch\u306e\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306e\u732b\u3092\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3002 Scratch Media\u306e\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u3092\u958b\u3044\u3066\u3001\u305d\u3053\u304b\u3089\u300cSVG+PNG (2 Costumes)\u300d\u3068\u3044\u3046\u5727\u7e2e\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5c55\u958b\u3059&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,19],"tags":[],"class_list":["post-2720","post","type-post","status-publish","format-standard","hentry","category-pharo","category-tutorials"],"_links":{"self":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/2720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/comments?post=2720"}],"version-history":[{"count":0,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/2720\/revisions"}],"wp:attachment":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/media?parent=2720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/categories?post=2720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/tags?post=2720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}