2008年10月2日木曜日

information.schema.columns MySQLのデータをGAEへ

拡張機能のライブラリ Joomla! Extensions Directory の
Administration - Database Management の中の
を使うと、 Joomla! というCMSの Administration 画面で phpMyAdmin ライクの操作を行なうことができる。
テーブル構造から class の定義の変換についてはオリジナルの components を作成してみたが、以降はこの Extention Components をベースにすることにした。

PHP 側から MySQL のデータを Google App Engine の Cloud に POST して、それを Python側で受けて datastore に put()  するフローとなる。

事前に各model の定義は作成しておいたとしても、datastore に put する際に column ごとにデータの型が intger なのか text なのか、わかっている必要がある。

Cloud 側のデータの型は数字もすべてテキストとし保存してしまってもよいのかもしれないが、いずれにしろまず、列情報を持つ MySQL のテーブルを Cloud に転送する第1ターゲットとすることにした。


SELECT * FROM information_schema.columns where table_schema ='joomlaj' order by table_name, ordinal_position limit 0,10

MySQLのデータをGAEへ

テンプレートの良し悪しで画面の感じがまったくかわってしまう。
PHP で書かれている Joomla とういうCMSのテンプレートの質が高い。また拡張ライブラリが充実している。

GAE にこれらのテンプレートを応用しようとした場合、 やはり Joomla 側のキーとなるいくつかのテーブルと同様のものを Cloud に作成する必要がある。

Joomla! の components の作成手順を参考にまずテーブルに対応する class の定義を作成するようにした。 以下がまず作成した対応一覧。

if ($data_type == "bigint" ) { $datastore_type = " = db.IntegerProperty()" ;}
if ($data_type == "tinyint") { $datastore_type = " = db.IntegerProperty()" ;}
if ($data_type == "int" ) { $datastore_type = " = db.IntegerProperty()" ;}
if ($data_type == "varchar") { $datastore_type = " = db.StringProperty()" ; }
if ($data_type == "text") { $datastore_type = " = db.TextProperty()" ; }
if ($data_type == "longtext"){ $datastore_type = " = db.TextProperty()" ; }
if ($data_type == "datetime"){ $datastore_type = " = db.DateTimeProperty()" ; }
views/auto/tmpl/defaul.php



2008年10月1日水曜日

fsock でcloud にPOSTしても値が届かない

php の fsockopen にて データを POST する、
local の Google App Engine の SDK 環境では動作しても、本番環境の Cloud では
501 エラーなども発生。

チェックが厳しいためか。
http://code.google.com/p/gears/wiki/ContentRangePostProposal


結局 PEAR を利用したところ、無事 cloud に対してでも POST できるようになった。
http://pear.php.net/manual/ja/package.http.http-request.headers.php

2008年9月22日月曜日

Joomla

・ 管理メニューで Top Menu が表示されない
->   モジュール管理 にて Top Menu を有効にする

- インストール時に サンプル を選択しないと、 jos_menu_types  に seed data が登録されないことが原因
joomlaj\installation_\sql\mysql\sample_data_sql
INSERT INTO `#__menu_types` VALUES
(2, 'usermenu', 'User Menu', 'A Menu for logged in Users'),
(3, 'topmenu', 'Top Menu', 'Top level navigation'),
(4, 'othermenu', 'Resources', 'Additional links'),
(5, 'ExamplePages', 'Example Pages', 'Example Pages'),
(6, 'keyconcepts', 'Key Concepts', 'This describes some critical information for new Users.');


・ 最終更新 の日付の日の部分が %d のまま表示される。
/language/ja-JP/ja-JP.ini の以下を変更(結局スペースを追加)
DATE_FORMAT_LC2=%Y年  %B %d日(%A) %H:%M
#DATE_FORMAT_LC2=%Y年%B%d日(%A) %H:%M


無料Joomla!テンプレー          http://www.joomlashack.jp/content/view/4/9/
Joomla ジャパン                    http://www.joomla.jp/
Joomla Template Tutorial    http://dev.joomla.org/content/view/1136/79/


Joomla! 1.5 変更部分
・ メニューの構築手順
  外部ファイルの取り込みがエクステンションに一元化
・ テンプレートではtemplateDetails.xml の役割
  モジュールポディションの設定、テンプレートパラメータの設定が可能
  テンプレート側にポディション

・ 特定のメニューから呼び出されたページに対し、テンプレートを指定することができる
  セクションと、その配下にカテゴリーの2層構造でしかコンテンツを管理することができない
  --->  メニューと組み合わせが必要
  Assign 対応していない template もある。



・ Joomla! 1.5.3 でタイトルタグにサイト名を表示させるための変更

・  機能拡張     http://extensions.joomla.org/
    Joomla! 1.5 Template Tutorials Project


・ Zend Framework の動作


・phpフレームワーク・オブジェクト指向入門 http://phpc2.seesaa.net/
PHP5の新機能(クラス関係) http://www.atmarkit.co.jp/fcoding/articles/php5/02/php502a.html
・引数の値渡しと参照渡し http://ww7.tiki.ne.jp/~inabah/php/004_002.htm

Home Developer Manual 11. API Reference [REVIEW] database->loadAssocList

Tutorial:Developing a Model-View-Controller Component - Part 1

2008年9月19日金曜日

Uploading index definitions Error


何日かぶりに appcfg.py update xxxx/ で更新しようとしたところ以下のエラーで先に進まなくなってしまった。
タイミングとして新しいイメージファイルをいくも追加したので、それが原因かと思ったが、そうではないらしい。

Uploading index definitions.
Error 400: --- begin server output ---
Building a composite index failed: ApplicationError: 3
--- end server output ---

Issue 287:Explosion with >100 indexes


To vacuum your indexes: 
1. Create a backup of your index.yaml specification
2. Remove the definitions of the indexes in Error from your index.yaml file
3. Run appcfg.py vacuum_indexes your_app_dir/
4. Replace the modified version of your index.yaml file with the original
5. Run appcfg.py update your_app_dir/


を参考に まず index.yaml をクリアしてから vacuum すると、

This index is no longer defined in your index.yaml file.

ancestor: true
kind: Timeline
properties: []

Are you sure you want to delete this index? (N/y/a): y

ときかれるので、N として、いかにも不要そうな複合インデックスをいくつか削除して
appcfg.py vacuum_indexes your_app_dir/

にて今度は Y にて削除した。
いくつも削除したため、ダッシュボードでみると index の delete のタスクが走りだした。このタスク中に appcfg.py update xxxx/ すると
Server Error (500) A server error has occured.
となる。しばらく、時間をおいたところ無事 update できたが、その直後から今度はindex 作成のタスクがいくつも走りだした。




http://code.google.com/appengine/docs/datastore/queriesandindexes.html#Big_Entities_and_Exploding_Indexes

To handle "Error" indexes, first remove them from your index.yaml file and run appcfg.py vacuum_indexes. Then, either reformulate the index definition and corresponding queries or remove the entities that are causing the index to "explode." Finally, add the index back to index.yaml and run appcfg.py update_indexes.

2008年9月13日土曜日

Google Visualization API その2


Visualization APIを用いたプログラミング 
を参考に SpreadSheet からの Timeline の描画を行なってみた


Chart API だとすぐにぶつかるデータ数の壁をあっさりクリアしてしまった。
おそるべき JavaScript 。


・メモ
- spreadsheet は Share Anyone can this document WITHOUT LOGGING IN
 にしておくこと
- packages:["annotatedtimeline"]
 にSpreadSheet から 123.4 のように少数点付きの値を
 データとして与える場合 123.*100/100 のように一度 乗算して除算しないとなぜかうまくいか
 なかった。 ( javascript を理解していない? ためか  これには苦労した)
-  query.setQuery("select C, J from `Sheet 1` order by C");
 Sheet 1 を Sheet 2 に変えても、先頭のシートしか参照できない。 要調査

2008年9月12日金曜日

Google Visualization API


Google Visualization API
Gallery

Google Finance で使用されているものが登録されていた
さっそく Google App Engine と組み合わせ、使用したところ動作した
けれども、どうもデータの表示範囲のスクロールがなぜかうまくいかなかった。
原因はデータのラインの本数で、折れ線グラフが1本だけだと、下部分の
スクロール機能が動作しない仕様らしい。




Unityでドアの開閉はAnimatorそれともiTween?

Mac Mini M2 の Unity で Sketchup のデータを復元したつづき。 以前、苦労して作成したドアの開閉が動作しないので修復する。 どうやって動かしていたのか、また忘れそうなので記録しておく。             Animator 左右のドア PlaneL,...