• 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
 
 

This article was migrated from http://rails.office.drecom.jp/hibi/archive/42

http://www.abdulqabiz.com/docs/ActionScript_CodeHinting_In_Flash.htm

変数名の最後を"_xxx"にすると、補完してくれます。
他の人も読みやすくなるよね。
ex. cancelt_btn

Suffix

Object class

_mc

MovieClip

_array

Array

_str

String

_btn

Button

_txt

TextField

_fmt

TextFormat

_date

Date

_sound

Sound

_xml

XML

_xmlsocket

XMLSocket

_color

Color

_camera

Camera

_mic

Microphone

_stream

NetStream

_connection

NetConnection

_so

SharedObject

_video

Video

http://rails.office.drecom.jp/hibi/archive/42

This article was migrated from http://rails.office.drecom.jp/hibi/archive/42

posted by Png satoko on Sat 10 Feb 2007 at 06:38

This article was migrated from http://rails.office.drecom.jp/hibi/archive/41

http://www.adobe.com/jp/support/flash/ts/documents/fl0306.html

上のページの内容をそのままです。
Flashを挿入するHTML内で下記の2つを記述。


<param name="wmode" value="transparent">

次のパラメータを EMBED タグに追加します。
wmode="transparent" http://rails.office.drecom.jp/hibi/archive/41

This article was migrated from http://rails.office.drecom.jp/hibi/archive/41

posted by Png satoko on Fri 9 Feb 2007 at 11:23

This article was migrated from http://rails.office.drecom.jp/hibi/archive/40

Flashを始めて、さぁActionScriptを書こうと思ったのだけど、
どこに書けばいいのかわからない。

(昔やった)MSOfficeのVBScriptのように各コンポーネントに書くようになっていたりする。
うーん、ばらばらになるのはやだなぁと思っていたら、
どうやらレイヤーを挿入して、そこをScriptと名前を変えてやるのが慣例みたい。

複雑になってきたら、複数レイヤーにするとか、
*.as(ActionScriptファイル)にするのがいいんだろうけどね。

http://rails.office.drecom.jp/hibi/archive/40

This article was migrated from http://rails.office.drecom.jp/hibi/archive/40

posted by Png satoko on Thu 8 Feb 2007 at 16:47

This article was migrated from http://rails.office.drecom.jp/hibi/archive/39

ActionScript始めました。
まず一発目は本から。

これはかなりおすすめです。
amazonのレビューで日本語の訳がひどいというので、英語版を思い切って買ってみました。
かなり細かいところまで書いてあって、とても重宝しています。
そうそうMovieClipLoaderとかの新しいクラスがないのが難。

Actionscript for Flash Mx: The Definitive Guide


これはまだ未発売。予約しなくちゃ。

ActionScript 3.0 Pocket Reference (Pocket Reference)


一番初めに買った本。Flashはデザイナー向けのが多くて困りました。
これも初歩デザイナーメインだけど、まぁFlashが何かわからん人にはいいかな。

Flash逆引きクイックリファレンス 8&MX2004対応for Windows & Macintosh


http://rails.office.drecom.jp/hibi/archive/39

This article was migrated from http://rails.office.drecom.jp/hibi/archive/39

posted by Png satoko on Wed 7 Feb 2007 at 12:07

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/162

RailsのIntegrationTestの仕組みを使って、Code To Test Ratio(コード量に対するテストコードの割合)が一定以上に保たれているかどうかを検証するテストを書いてみました。

require "#{File.dirname(__FILE__) }/../test_helper"

class TestingRuleTest < ActionController::IntegrationTest
  def setup
    @stats = `rake stats`
  end

  def test_code_to_test_ratio
    cttr = @stats.match(%r{Code to Test Ratio: 1:([\d\.]+)})[1].to_f
    assert cttr >= 0.8, "Need more tests."
  end
end
多人数で開発をしてるとなかなか面白いですよ。一人の場合でも自分への戒めに使えるかな。

[English]

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/162

posted by Png genki on Sat 3 Feb 2007 at 05:47

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/161

Railsを使っていると、formにActiveRcordオブジェクトのアトリビュートが勝手に入ってくれたり、フォームの内容が勝手に解析されて、Controllerからparamsで参照できたりと、とても便利です。

Railsのフォームヘルパーが生成したフォーム要素のnameやidを見てみると、"user[name]"のように、ARオブジェクトの属性名がマーシャリングされた状態で織り込まれています。 このようなフォームから送信されたリクエストの結果を解析して、paramsでアクセスできるように変換してくれるのがFormEncodedPairParserです。

今回は、FormEncodedPairParserが解析可能な形式で、ネストしたHashやArrayをQueryStringに変換するFormEncoderモジュールを作ってみました。

module FormEncoder
  def self.encode(parameters, prefix = "")
    case parameters
    when Hash; encode_hash(parameters, prefix)
    when Array; encode_array(parameters, prefix)
    else "#{prefix }=#{CGI.escape(parameters.to_s) }"
    end
  end

private
  def self.encode_hash(hash, prefix)
    hash.inject([]) do |result, (key, value)|
      key = CGI.escape(key.to_s)
      result << encode(value, prefix.empty? ? key : "#{ prefix }[#{ key }]")
    end.join('&')
  end

  def self.encode_array(array, prefix)
    array.inject([]) do |result, value|
      result << encode(value, "#{prefix }[]")
    end.join('&')
  end
end
使用法:
FormEncoder.encode :foo => {:bar => [1, 2], :baz => "Rails"}
#=> "foo[baz]=Rails&foo[bar][]=1&foo[bar][]=2"

CGIMethods.parse_query_parameters(
  "foo[baz]=Rails&foo[bar][]=1&foo[bar][]=2")
#=> {"foo"=>{"baz"=>"Rails", "bar"=>["1", "2"]}}
これを使用することで、formから送信するのと同様な形式でさまざまな情報をQUERY_STRINGに変換できるので、paramsで受け取ることが出来ます。

[English]

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/161

posted by Png genki on Fri 2 Feb 2007 at 07:02

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/160

簡単にカレンダーを表示できるcalendar_helperプラグインは大変便利ですが、これをインストールすると'CalendarHelper'という名前がRuby on Railsに予約されてしまうのをご存知でしょうか。

これはつまり、CalendarControllerを作るのが難しくなるということです。もしCalendarControllerの雛形をscript/generateコマンドで作成しようとしても、以下のようなメッセージが出力されて拒まれます。

The name 'CalendarHelper' is reserved by Ruby on Rails

この問題を回避してCalendarControllerを作成する方法を紹介します。そのためには、次のような手順を踏みます。

  1. calendar_helper plugin. をインストール
  2. mv vendor/plugins/calendar_helper other_place
  3. ./script/generate controller calendar
  4. mv other_place/calendar_helper vendor/plugins
  5. vendor/plugins/calendar_helper/init.rbを編集

こんな感じに

require File.join(File.dirname(__FILE__), 'lib/calendar_helper')

[English]

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/160

posted by Png genki on Fri 26 Jan 2007 at 07:12

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/159

今年最初のRails勉強会に参加してきました。 今回は、井上さん、もろはしさんが体調不良ということでお休みだったのをはじめ、 急遽参加できなくなった方が多かった模様です。

参加したセッションは、前半が「ARとテーブル設計」、後半が「TDDB」でした。

■前半「ARとテーブル設計」

ARといえばmaihaさん、maihaさんといえばAR。最近ブログでなんだか面白そうなことを書いているなあと思ってたのですが、それでした。

内容はかなりマニアック。ウィトゲンシュタインの論理哲学論考からT字型の話、存在論の話へと展開。いやあ、面白かった。

■後半「TDDB」

僕がオーナーをやりました。もともとTDDの実演という感じだったんですが、 すぐに終わってしまいそうだったので、前半セッションの続きでDBの話もやろうということで、 TDD + DBなセッションでした。

TDDについては、railsコマンドでサンプルアプリを作り、zsh/screen/vimで開発。 お馴染みのredgreen+autotestでライブコーディングしました。

続いて前半セッションの続きでARとDB設計の話。 カラム不要論、CRUDのUD不要論、DBの負荷分散、YamazさんによるPostgressの2層コミットの話、などなど、非常に面白い内容でした。

最後は、script/renameの設計を10分ぐらいでやろうといろいろ知恵を出し合ってみたのですが、 実際なかなか難しいことが判明。evalできる言語は難しい。

■懇親会

今回は会場の予約が無かったので、ロデオでおなじみのZESTに行きました。 ogijunさんが恒例のあとで来るメソッドで合流し、高橋さん、大森さんたちとRubyの将来について話したりしていました。非常に濃い話ができて楽しかったです。

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/159

posted by Png genki on Mon 22 Jan 2007 at 09:26

This article was migrated from http://rails.office.drecom.jp/hibi/archive/38

じゃなくて、acts_as_searchableですよ!
なんか検索しても出てこないなぁと思ったら。
はぁ。


http://www.google.co.jp/search?q=acts_as_searchable&start=0&hl=ja&lr=lang_ja



やっぱり舞波さんの解説が一番デス。
http://wota.jp/ac/?date=20060408 http://rails.office.drecom.jp/hibi/archive/38

This article was migrated from http://rails.office.drecom.jp/hibi/archive/38

posted by Png satoko on Sat 20 Jan 2007 at 23:32

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/158

馬場さんが書いてるやつをちょっと修正したもの。

   1  desc 'Commit to the repository safely.'
   2  task :commit =&gt; [
   3    :up,
   4    :'db:migrate',
   5    :test,
   6    :'test:plugins',
   7  ] do
   8    if msg = ENV['M']
   9      msg.gsub!(/\"/, '\"')
  10      system %Q{svn ci #{RAILS_ROOT} -m "#{msg}"}
  11    else
  12      system "svn ci #{RAILS_ROOT}"
  13    end
  14  end
  15  
  16  desc 'Update working copy.'
  17  task :up do
  18    system "svn up #{RAILS_ROOT}"
  19  end
テストが成功したときだけコミットします。結構便利ですよ。

[English Version]

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/158

posted by Png genki on Sat 20 Jan 2007 at 22:04
Contents
Flashでコード補完 
背景が透明な Flashを作成する 
ScriptはScriptレイヤーに書く 
ActionScript始め 
テストをテストするメタテスト
FormEncodedPairParser互換のQueryStringを生成する
CalendarControllerをcalendar_helperと一緒に使う方法
Rails勉強会@東京#14レポート
act_as_searchable 
rake svn:commit
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ