altere5's blog

I thought what I'd do was, I'd pretend I was one of those deaf-mutes. ( or shou'd i ? )

MonacaでiOSアプリの開発を行うための基本的な準備作業(まとめ)

ハイブリッドアプリの開発環境である『Monaca』を使ってiOSアプリを開発する際、必要となる基本的な準備作業についてのまとめ。

(1)デベロッパー証明書の発行と登録
(2)動作確認用端末の登録
(3)AppIDの登録
(4)プロビジョニングファイルの作成
(5)実機での動作確認
(6)プッシュ通知の利用
 
なお、本ページは個々の記事と並行して作業を行うため、順次リンクの更新及び補足を行う予定。  
また、Monacaのヘルプで本件に関するものは以下の通り。  

MonacaによるiOSアプリの開発をする際に現在参考にしている書籍については以下の通り。

[iOS/Android対応] HTML5 ハイブリッドアプリ開発[実践]入門 (Software Design plus)

[iOS/Android対応] HTML5 ハイブリッドアプリ開発[実践]入門 (Software Design plus)

VPSベンチマーク(GMPクラウド Public マイクロ)

------------------------------------------------------------------------
Benchmark Run: Thu Feb 27 2014 16:31:44 - 17:03:02
3 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       23665253.2 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     3166.0 MWIPS (14.8 s, 7 samples)
Execl Throughput                               1642.3 lps   (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        518912.1 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          152991.3 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1032136.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1304783.7 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 223994.4 lps   (10.0 s, 7 samples)
Process Creation                               3459.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2969.9 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1168.3 lpm   (60.0 s, 2 samples)
System Call Overhead                        1569573.3 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   23665253.2   2027.9
Double-Precision Whetstone                       55.0       3166.0    575.6
Execl Throughput                                 43.0       1642.3    381.9
File Copy 1024 bufsize 2000 maxblocks          3960.0     518912.1   1310.4
File Copy 256 bufsize 500 maxblocks            1655.0     152991.3    924.4
File Copy 4096 bufsize 8000 maxblocks          5800.0    1032136.0   1779.5
Pipe Throughput                               12440.0    1304783.7   1048.9
Pipe-based Context Switching                   4000.0     223994.4    560.0
Process Creation                                126.0       3459.2    274.5
Shell Scripts (1 concurrent)                     42.4       2969.9    700.4
Shell Scripts (8 concurrent)                      6.0       1168.3   1947.2
System Call Overhead                          15000.0    1569573.3   1046.4
                                                                   ========
System Benchmarks Index Score                                         881.8

------------------------------------------------------------------------
Benchmark Run: Thu Feb 27 2014 17:03:02 - 17:34:18
3 CPUs in system; running 3 parallel copies of tests

Dhrystone 2 using register variables       70238346.8 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     9849.5 MWIPS (12.8 s, 7 samples)
Execl Throughput                               7639.3 lps   (29.6 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        388549.6 KBps  (30.4 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          116060.0 KBps  (30.1 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       1052261.3 KBps  (30.5 s, 2 samples)
Pipe Throughput                             3894890.1 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 623198.1 lps   (10.0 s, 7 samples)
Process Creation                              20672.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   9346.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   1279.1 lpm   (60.1 s, 2 samples)
System Call Overhead                        3264037.7 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   70238346.8   6018.7
Double-Precision Whetstone                       55.0       9849.5   1790.8
Execl Throughput                                 43.0       7639.3   1776.6
File Copy 1024 bufsize 2000 maxblocks          3960.0     388549.6    981.2
File Copy 256 bufsize 500 maxblocks            1655.0     116060.0    701.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    1052261.3   1814.2
Pipe Throughput                               12440.0    3894890.1   3130.9
Pipe-based Context Switching                   4000.0     623198.1   1558.0
Process Creation                                126.0      20672.2   1640.7
Shell Scripts (1 concurrent)                     42.4       9346.6   2204.4
Shell Scripts (8 concurrent)                      6.0       1279.1   2131.8
System Call Overhead                          15000.0    3264037.7   2176.0
                                                                   ========
System Benchmarks Index Score                                        1880.6

CakePHPのお勉強 10回目 お問い合わせ一覧のページ処理(2)

前回に引き続きページ処理(Pagination)関連のお勉強。

なお、だんだん同時に表示する必要のないものもあるが、お勉強なのでそこはスルーで。

(4) 次へ、前への表示

次のページや前のページのリンクを表示。

<table>
    <tr>
        <th>お名前</th>
        <th>メールアドレス</th>
        <th>お問い合わせ日時</th>
    </tr>

    <?php foreach ($contacts as $contact): ?>
    <tr>
        <td><a href="/contacts/detail/?id=<?php echo $contact['Contact']['id']; ?>"><?php echo $contact['Contact']['username']; ?></a></td>
        <td><?php echo $contact['Contact']['email']; ?></td>
        <td><?php echo $contact['Contact']['created']; ?></td>
    </tr>
    <?php endforeach; ?>

</table>

<?php echo $this->Paginator->first($first = '最初', $options = array()); ?>

<?php echo $this->Paginator->prev('前へ', array(), null, array('class' => 'prev disabled')); ?>

<?php echo $this->Paginator->numbers(); ?>

<?php echo $this->Paginator->next('次へ', array(), null, array('class' => 'next disabled')); ?>

<?php echo $this->Paginator->last($last = '最後', $options = array()); ?>
 

20行目で前のページへのリンクの表示設定と出力を実施。
22行目で次のページへのリンクの表示設定と出力を実施。

続きを読む

CakePHPのお勉強 9回目 お問い合わせ一覧のページ処理(1)

お問い合わせ一覧を表示すると問い合わせ件数が増えると大変なことになる。
今のままだと全てを表示しているので30件とか問い合わせが入ると30行表示される。

そこで今回はページ処理(Pagination)を使い大量表示時もきれいに表示されるようにする。

(1) Controllerの修正

最初にコントローラー側の修正を行う。
具体的には「ContactsController.php」を以下のように修正する。

    // listアクション
    public function contactlist() {

        $this->paginate = array(
            'Contact' => array('limit' => 10, 'order' => 'Contact.created desc'),
        );

        $this->set('contacts', $this->paginate('Contact'));

    }

47行目から49行目でPaginationプロパティに取得条件を設定。
今回は登録日(created)の新しいものから10件単位で取得するよう設定。

51行目で設定内容に従って「Contact」モデルからデータを取得し、それを「contacts」変数に設定。

これでこれまで利用してViewには最新の10件が表示されるはず。

実際の動作。

f:id:altere5:20131128001213p:plain

ちゃんと最新の10件が取得されている。

(2) 各ページへのリンクの表示

続きを読む

CakePHPのお勉強 8回目 Smartyの利用

お問い合わせサンプルを作りながら簡単にCakePHPの利用についてお勉強したので、少し別なお勉強。
今回はCakePHPSmartyを連携させて利用する。

日本語公式を見たりしたがあまりいい情報がなかったので、一番参考になった「CakePHP2.xとSmartyを連携する方法。- CakePHP2.xで入門!簡単Webアプリ作成。番外編-」を参考に進める。

(1) Smartyライブラリの取得

Smarty公式サイトから最新版のライブラリを取得。

2013年11月27日現在 3.1.15 が最新版のもよう

(2) Smartライブラリの設置

取得したライブラリを展開しその中の「libs」フォルダを「smarty」にリネーム。
リネームした「smarty」フォルダを「app」フォルダ内の「Vendor」フォルダにアップロード。

続きを読む