This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USING MODAL DIALOGSというページがあるのですが…この通りやっても動きません。何で動かなかったのかはこれから調べるんですが…とにかく、下の方にあるサンプルコード表示窓から正しくコピペしても動きません。ああもう、何時間ツブしたんだよorz
■ここがバッチリ■
で、どうにかならないかと探して出てきたのがここ。 MASTER YOUR MODALS IN EMBER.JS
ember modal dialogで探すと2番目に出てくるんですけどね。ともかく、テキスト読みながら、必要なhandlebarsを補っていけば、ちゃんと動きます。bootstrapのfade dialogも効いて、ズルっとダイアログが出てきた瞬間「やったー!」と大声を上げてフロアの人の注目を浴びてしまいました。
結論から申しますと、コンポーネントの名前は、ダッシュで切らないといけません。公式のGUIDEにも書いてあります。しかし、そこに気付かなかったために3時間ツブしました。フレームワークを再ダウンロードしたり、ページ上で読み込む順番を変えたり、もう思いつく限りの試行錯誤をしたけど動かない。あげく、チュートリアルの関連コードを貼ってみたら動いてしまう。で、何度目かにようやく「コンポーネント名は、ダッシュを含まないとあかんよ(Components must have a dash in their name.)」の記述に気づいた次第。動いたさ。ああ動いたさ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printStatusでは100m秒ごとにサンプリングして入力がHIGHならcountDetectedをインクリメントし、「1分間のうち何秒間、PIRセンサがHIGHを返してくるか(なおPIRセンサは負論理で動きを検出するとLOWになるのですが、トランジスタでレベル変換した時に正論理に変わってます)」を求めています。結果はCSVとしてファイルに書き出し(line no 56 - 62)、JsonとしてWeb APIに送っています(line no 64 - 94)。
その処理自体は簡単なのですが、起動直後の中途半端な「分」を無視したり(prevMinute==99)、「睡眠記録」として作ったので昼の12時でファイル名が切り替わるようにしたりで(line no 44 - 54)、ちょっと面倒になっています。
いずれも特別なことはしていませんが、SensorData.javaでMany to Oneリレーションシップを定義する際に通常はpublicでインスタンス定義すればそれでOKなはずですが何故かうまく動いてくれず、ググったところ「play!のバグじゃね? アクセサにしたら動いたよ」とのことで、回避できました。
ソース:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int p01 = 13; const int p02 = 12; const int p03 = 11; const int p04 = 10; const int p05 = 9; const int p06 = 8; const int p07 = 6; const int p08 = 5; const int p09 = 4; const int p10 = 3; const int p11 = 2; const int p12 = 1;
const int pGnd = 7;
const int pins[] = {p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12}; const int nPins = sizeof(pins) / sizeof(int); const int nSin = 32;
ビルドその他のメッセージがおとなしくなったところでブラウザで localhost:9000 を開けばいつものページ、緑色の「Your new application is ready」のメッセージがお出迎えしてくれます。
■ヘンなエラー■
ひと通り実装をしたところで試すとこんなエラーが:
[error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: Error getting BeanDescriptor for path User from models.User
ググってもどうもピンと来ない。何となくEbean系の間違いのようなので、
とりあえず@OneToMany / @ManyToOneなどを消して見る
とりあえずactivator clean / activator updateなどを試す
などやってみたのですが、ダメ。その後、トレースしてみると、
User user = find.fetch("user").where() .eq("email", inEmail) .findUnique();
ここで落ちてました。そりゃそうだ。ここを
User user = User.fetch().where() .eq("email", inEmail) .findUnique();