2011年1月30日日曜日

iPhone Drift Bottle がおもしろい

iPhone 3Gを使っています。

アプリで「Drift Bottle」というのを見つけた。
浜辺から手紙をいれたビンを投げて、誰かに届くといいなぁーとやるやつのアプリ版ね。

誰か知らない人からのビンを受け取り、それを返事するのがいい。
やり方が新しい!

2011年1月10日月曜日

Google Chrome Extensions 開発を試してみる

Extensionsを試してみる。
環境:
VMware(R) Player 3.1.3 build-324285
ubuntu 9.10
Google Chrome 8.0.552.224

参考(というよりそのまま):http://code.google.com/chrome/extensions/getstarted.html
まぁそのまましたにあるようにやってみよう。

In this section, you'll write an extension that adds a browser action to the toolbar of Google Chrome.
(このセクションであなたは拡張機能を記述し、Google Chromeのツールバーに追加するでしょう)



1.Create a folder somewhere on your computer to contain your extension's code.
(適当に拡張機能開発用のディレクトリを作成しよう。)
$ mkdir -p ~/chrome/helloworld

2.Inside your extension's folder, create a text file called manifest.json, and put this in it:
(1.で作成したディレクトリ内で、manifest.jsonという名のファイルを作成しよう。)
$ cd ~/chrome/helloworld
$ touch manifest.json
$ vim manifest.json

{
  "name": "My First Extension",
  "version": "1.0",
  "description": "The first extension that I made.",
  "browser_action": {
    "default_icon": "icon.png"
  },
  "permissions": [
    "http://api.flickr.com/"
  ]
}

3.Copy this icon to the same folder:
(アイコンを1.で作成したディレクトリに保存しよう。右クリックとかで保存できるぞ。)
4.Load the extension.
(さあ、拡張機能をロードしてみよう)
a)Bring up the extensions management page by clicking the wrench icon  and choosing Tools > Extensions. (On Mac, use Window > Extensions.)
(拡張機能マネージメントページへ移動しよう。右上にあるアイコンをクリックし、ツール(L)>拡張機能(E)を選択しよう。)

b)If Developer mode has a + by it, click the + to add developer information to the page. The + changes to a -, and more buttons and information appear.
(開発者モードになる必要がある。拡張機能タブの右上に「+ディベロッパーモード」とあるから、「+」をクリックしよう。3つほどボタンが現れるはずだ。表示させよう。このとき、「+ディベロッパーモード」は「ーディベロッパーモード」になっているぞ。)

c)Click the Load unpacked extension button. A file dialog appears.
(「拡張化されていないパッケージを読み込みます」ボタンをクリックし、ファイルダイアログを表示させよう。)

d)In the file dialog, navigate to your extension's folder and click OK.
(ダイアログ内で、1.で作成したディレクトリへ移動し、「開く」ボタンをクリックしよう。)

5.If your extension is valid, its icon appears next to the address bar, and information about the extension appears in the extensions page, as the following screenshot shows.
(もし成功すれば、アドレスバーにダウンロードしたアイコンが追加され、拡張機能タブ内にアイコンや拡張機能の情報が現れるはずだ。ただ、スクリーンショットはないぞ。)

Add Code to the Extension.
(拡張機能にコードを記述してみよう)

In this step, you'll make your extension do something besides just look good.
(このステップでは、なにか動作する機能を作ろう。)

1.Edit manifest.json to add the following line:
(manifest.jsonに下記のコードを追加しよう。)
$ vim manifest.json

...
  "browser_action": {
    "default_icon": "icon.png",
    "popup": "popup.html"
  },
  ...
Inside your extension's folder, create a text file called popup.html, and add the following code to it:
(いつものディレクトリでpopup.htmlファイルを作成し、下記のURI内のコードをコピペしよう)
$ touch popup.html
$ vim popup.html


2.Return to the extensions management page, and click the Reload button to load the new version of the extension.
(拡張機能タブへ戻って、「再読み込み」ボタンを押下しよう。)

3.Click the extension's icon. A popup should appear that displays the contents of popup.html.
(「HELLO」の拡張機能アイコンをクリックしよう。popup.htmlのコンテンツがディスプレイに現れるはずだ。)

If you don't see the popup, try the instructions again, following them exactly. Don't try loading an HTML file that isn't in the extension's folder — it won't work!
(もし、popupが現れなかったら・・・もう一度試してみよう。正確にね。1.で作ったディレクトリ以外のHTMLファイルをロードしようとしてはダメだ。動かないぜ!)


どうでしょうか?できましたか?
ブログ著者はできました。
頑張って開発していきましょう。

2011年1月6日木曜日

Google Chrome オプション 個人設定 同期

Google Chrome の拡張機能が同期できると知ってやってみた。

対象:
ホストOS上のChrome
(VMware Player上の)ゲストOS上のChrome

同期できなかった。

明日、別の端末のChromeと同期してみる。

■1/7 追記

別の端末で試みた。
できた!

Chromeを立ち上げたら、右上の拡張機能が増えていくのが、快感だったね。

2011年1月2日日曜日

firefox vista sqlite manager インストール

vmware 内で ubuntu で railsの勉強中にsqlite managerが必要になった。
そのためgoogle chromeでエクステンションを入れたかったが、よくわからず。

試しにホストOSのvista + fire foxアドオンで試みる。
しかしvistaなので、参考としたサイトでは若干ちがうところがあった。
(参考:http://www.padmacolors.org/entry/20090318/685/

違うのは、Firefoxのデータベースファイルのある場所。
vistaでは以下にある。

C:\Users\(username)\AppData\Local\Mozilla\Firefox\Profiles


Document and Settingには入れない。。。

2011年1月1日土曜日

google 日本語入力システム on ubuntu

googleの日本語入力システムをubuntu上にいれたとき、インストールはうまくいった(※参考)が、その後どうすればいいのかわからなかった。
(参考:https://forums.ubuntulinux.jp/viewtopic.php?id=8514

結局うまくいった。

つまずいたインストール後について少し書く。

1.システム>設定>iBusの設定 を押下する。
2.[インプットメソッド]タブを開く。
3.プルダウンから 日本語>Mozcを選ぶ。
4.[追加]ボタンを押下し、Mozcを追加する。
5.[上へ]ボタンを押下し、最上位にMozcを移動させる。
5.[閉じる]ボタンを押下する。

これで、Mozcが使用できるようになる。


rails tickets DBが表示されない

Head Firstでrailsを勉強中、うまくいかないことが。。。
以下がエラー表示されたもの。(ブラウザでhttp://localhost:3000/ticketsとした)


LoadError in TicketsController#index

no such file to load -- openssl
Rails.root: /home/andre/railswork/tickets

Application Trace | Framework Trace | Full Trace

opensslがインストールされていないようだ。
インストールしよう。

$ sudo apt-get install libssl-dev
$ sudo apt-get install libopenssl-dev

お!解決できた。

rails ruby script/rails で やる

railsの本(Head First)を買って勉強しているんだが、コマンドが変わったのか?
本のとおりにはできなかったので、その部分(といってもまださわりしかやってないのでそこの部分)をペースト。。。


andre@oem-desktop:~/railswork/tickets$ rails -v
Rails 3.0.3
andre@oem-desktop:~/railswork/tickets$ ruby script/rails -h
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate"
 benchmarker  See how fast a piece of code runs
 profiler     Get profile information from a piece of code
 plugin       Install a plugin
 runner       Run a piece of code in the application environment

All commands can be run with -h for more information.

[ruby script/server ...]や[ruby script/generate ...]ではなくなったよ。

rails で ruby script/server ができない件

Head Firstでrailsを勉強しようとしていたら、その通りにできなかったので。。。


andre@oem-desktop:~$ rails -v
Rails 3.0.3

andre@oem-desktop:~/railswork/tickets$ ruby script/rails server
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-01-01 09:51:27] INFO  WEBrick 1.3.1
[2011-01-01 09:51:27] INFO  ruby 1.8.7 (2009-06-12) [i486-linux]
[2011-01-01 09:51:32] INFO  WEBrick::HTTPServer#start: pid=4454 port=3000

[ruby script/rails server]としなければならなかった。
変わったんだね。