2012年06月20日

OSとしてのwindowsは、MS-Office専用機のようになりつつある。
surfaceがOfficeを使うためのマシンとして有効であれば、会社で買ってほしい。

タッチデバイスにキーボードをつけると、画面に手を伸ばすのが面倒なので、マウスやタッチパッドのようなポインティングデバイスが必要になることは、iPad+Apple keyboardで体験済み。
 surfaceの薄型キーボードはタッチパッドがあるようなので、そこは期待。

あとは、書類作成で10インチは狭いので、せめて13インチほしいかな。


sylphide_ffr31mr at 15:54コメント(0)トラックバック(0)技術 

2012年05月21日

日食の撮影には減光フィルタを付けるのが安全である。

小学校が配ってくれた観測フィルタがちょうどいい大きさだったのでレンズに付けてみたのだが、肉眼用のフィルタでは暗すぎた。

危険であるが、だめもとで、直接撮ってみたのがこちら。


なかなか雰囲気でている。

シャッター速度1/8000、絞り22、ISO100というカメラ性能の限界値である。

望遠レンズではなく、28mmの広角で、中心部をトリミングしている。

金環日食で暗くなっていればこその、偶然の産物である。

375674



sylphide_ffr31mr at 09:33コメント(0)トラックバック(0) 

2012年03月10日

Macbook Airを会社で買ってもらった。私物化している。
はじめてのMacOSである。MacOS X 10.7のLionさんである。

アプリケーションの起動やwindow操作から、ディレクトリ構成、キーボードショートカットなど、わからないことだらけ。
手になじむまではしばらくかかるだろうが、とても刺激的である。

特に、マルチタッチパッド。
マルチタッチでの画面スクロールや、デスクトップの移動は、iPadの手に吸い付く感じがそのままで、とてもいい。

二本指で上下に滑らせると、スクロールする。はじめ、スクロール方向が従来のマウスと逆向きになるので(上に指を滑らせると、下にスクロールする)、何度も間違えたが、それもすぐに慣れた。
スクロールは、マウスのホイール回転イベントを発生させるらしく、リモートデスクトップでwindowsを使っていても機能する。これは嬉しい。

そして、三本指で左右にスワイプすると、デスクトップの切り替え。ubuntuではALT+←→でやっていたが、それでもできる。

問題はキーボードとタッチパッドの位置関係である。
キーボードの手前にタッチパッドがあるので、キーボードのホームポジションに手を置いたままでは、親指でマウスカーソルを操作することが精一杯。
二本や三本指でタッチパッドを操作するためには、ホームポジションから手を動かさなければならない。
この手の導線の切断は、iPadにキーボードを付けた時の違和感と同じ感じがする。

そこで、Appleさんに提案なのだが。
キートップを全部タッチパッド化してしまい、キーボードの上で指を滑らせると、タッチパッドの動作をするようにしてはいかがだろうか。
キーを押した場合の文字入力と、キーの上に指を滑らせた場合での二次元的な操作を、手の位置を変えないで行えるようにするのである。
ついでに、キートップをすべて透明アクリルにしてしまい、その下に液晶を埋め込み、キーボードに捉われない操作コンソールも同時に提供する。
こんなハードウェアもAppleのデザイン工学の技があれば、実現できそうな気がするのである。



sylphide_ffr31mr at 20:23コメント(0)トラックバック(0)技術 

2012年01月21日

前回は、ただdotcloud上にファイルを置いただけなので、もう一歩進んで、dotcloudでrubyの実行環境を作る。
自分ひとりが使う動作環境なので、フレームワークは小規模向けのsinatraを使う。
sinatraでhello worldをするまでの手順をまとめておく。
けっこうはまった。ポイントは以下3点。

  • requireするRubyファイルをディレクトリ指定しないと、みつけてくれない。
  • アプリケーションをpushしているときに、CTRL+Cして止めると、その後のrsyncに失敗し、pushができなくなる。対処策がわからないので、アプリケーションを一度destroyして、再createする。
  • Gemfileで指定したライブラリが、ちゃんとインスタンスにインストールされたか確認する。手動でgem installを実行することもできる。

手順は以下。

1. 作業用ディレクトリ(プロジェクト)を作り、アプリケーション定義ファイルを作る。

$ mkdir maarui
$ cd maarui
$ cat dotcloud.yml
# dotcloud.yml
www:
  type: ruby
  approot: s1

2. アプリケーションrootディレクトリを作る。

$ mkdir s1
$ cd s1

3. アプリケーションを作る。最低限作るファイルは、以下の3つ。

$ cat Gemfile
# Gemfile
source :rubygems
gem 'rack'
gem 'sinatra'

$ cat config.ru
# config.ru
require File.expand_path(File.dirname(__FILE__)) + '/'+ 'app.rb'
run Sinatra::Application


$ cat app.rb
# app.rb (sample)
require 'rubygems'
require 'rack'
require 'sinatra'

get '/' do
  'Hello world!'
end

4. rackの実行に必要な2つのディレクトリを作る。

$ mkdir public
$ mkdir tmp

5. 以下のようなファイル配置になる。

~/maarui/
    +----dotcloud.yml
    |
    +----s1/
          +----Gemfile
          |
          +----config.ru
          |
          +----app.rb
          |
          +----public/
          |
          +----tmp/

6. dotcloud内にアプリケーションを作る。

$ dotcloud create maarui
Created application "maarui"

7. アプリケーションを配信(push)する。

$ dotcloud push maarui .
# upload /home/maarui ssh://dotcloud@uploader.dotcloud.com:4\
43/maarui
# rsync
building file list ... done
s1/

sent 378 bytes  received 15 bytes  71.45 bytes/sec
total size is 841  speedup is 2.14
12:58:10 ---> Deploy of "maarui" scheduled for revision rsync-123123123123 at 2012-01\
-20 12:58:10 12:58:10 ---> Building the application... 12:58:10 [www] Build started for revision rsync-123123123123 (clean build) 12:58:29 [www] Fetching source index for http://rubygems.org/ 12:59:02 [www] Installing rack (1.4.0) 12:59:02 [www] Installing rack-protection (1.2.0) 12:59:02 [www] Installing tilt (1.3.3) 12:59:03 [www] Installing sinatra (1.3.2) 12:59:03 [www] Using bundler (1.0.10) 12:59:03 [www] Your bundle is complete! Use `bundle show [gemname]` to see where a bun\ dled gem is installed. 12:59:04 [www] Build completed successfully. Compiled image size is 1MB 12:59:04 ---> Initializing new services... (This may take a few minutes) 12:59:04 [www.0] Initializing... 12:59:10 [www.0] Service initialized 12:59:12 ---> All services have been initialized. Deploying code... 12:59:12 [www.0] Deploying build revision rsync-123123123123... 12:59:15 [www.0] Running postinstall script... 12:59:19 [www.0] Launching... 12:59:21 [www.0] Waiting for the service to become responsive... 12:59:22 [www.0] Re-routing traffic to the new build... 12:59:22 [www.0] Successfully deployed build revision rsync-123123123123
12:59:22 ---> Deploy finished Deployment finished. Your application is available at the following URLs www: http://maarui-ID.dotcloud.com/

8. gemのインストール状況を確認する。

$ dotcloud ssh maarui.www
# $SHELL
dotcloud@maarui-default-www-0:~$ gem list

*** LOCAL GEMS ***

bundler (1.0.10)
daemon_controller (0.2.5)
fastthread (1.0.7)
file-tail (1.0.5)
passenger (3.0.2)
rack (1.4.0, 1.2.1)
rack-protection (1.2.0)
rake (0.8.7)
rubygems-update (1.6.2)
sinatra (1.3.2)
spruz (0.2.2)
tilt (1.3.3)

dotcloud@maarui-default-www-0:~$ exit

9. ブラウザで表示を確認する。

"hello world"が出力されれば成功。



sylphide_ffr31mr at 00:03コメント(0)トラックバック(0)技術 

2012年01月19日

dotCloudは、さまざまな言語の実行環境を提供するPaaSである。

Google AppEngineと比べると、遥かに多様な言語、データベース、フレームワークが提供されている。 その多様性が最大の優位点であるが、さらに以下の特徴がある。

  • IaaSとPaaSの中間的な機能
  • 操作がシンプル

1つ目の特徴は、このサービス自体がAmazonEC2のIaaS上で動作していることからきている。
GAEでもherokuでも、実行マシンはサービスに隠蔽されており、自分で作ったプログラムが動作しているOSのについて意識する必要がなかった。
それが、PaaS本来の目的でもあるからだ。
dotCloudでは、アプリケーションをdeployすると、EC2でインスタンスが作られ、その上でアプリが実行される。そして、そのインスタンスへのsshが許可されている。
そのため、ログの確認や、実行環境が自分の想定通りであるかなどを確認することができる。

もう一つの特徴が、dotCloudサービスの操作の簡単さである。 dotCloudを扱うコマンドは、基本的にただひとつ。dotcloudコマンドである。

インストールから、静的コンテンツのhello worldは、以下のとおり。

dotcloudコマンドのインストール

$ sudo apt-get install python-setuptools
$ sudo easy_install pip && sudo pip install dotcloud
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Reading http://www.pip-installer.org
Best match: pip 1.0.2
Downloading http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49
Processing pip-1.0.2.tar.gz
Running pip-1.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-XTv7r8/pip-1.0.2/egg-dist-tmp-aqFwSr
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.0.2 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip-2.7 script to /usr/local/bin
Installed /usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
Downloading/unpacking dotcloud
  Downloading dotcloud-0.4.3.tar.gz
  Running setup.py egg_info for package dotcloud
    
Downloading/unpacking dotcloud.cli==0.4.3 (from dotcloud)
  Downloading dotcloud.cli-0.4.3.tar.gz
  Running setup.py egg_info for package dotcloud.cli
    
Installing collected packages: dotcloud, dotcloud.cli
  Running setup.py install for dotcloud
  Running setup.py install for dotcloud.cli
    changing mode of build/scripts-2.7/dotcloud from 644 to 755
    changing mode of build/scripts-2.7/__dotcloud_git_ssh from 644 to 755
    
    changing mode of /usr/local/bin/dotcloud to 755
    changing mode of /usr/local/bin/__dotcloud_git_ssh to 755
Successfully installed dotcloud dotcloud.cli
Cleaning up...

APIキーを設定する

dotcloudコマンドを実行すると、APIキーが設定されていない場合に尋ねられる。
dotcloudのAPIキーは、wwwページにログインし、settingのページで表示される。
dotcloudコマンドでsetupサブコマンドを指定すると、再設定もできる。

$ dotcloud
Warning: /home/USERID/.dotcloud/dotcloud.conf does not exist.
Enter your api key (You can find it at http://www.dotcloud.com/accounts/settings): XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

アプリケーション定義ファイルdotcloud.ymlを作る

$ cat dotcloud.yml 
www:
  type: static

同じディレクトリにHTMLファイルを作る

$ cat index.html 
<html>
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    Hello World!
  </body>
</html> 

dotCloud内にアプリケーションを作る

$ dotcloud create helloworldapp
Warning: /HOME/.dotcloud/dotcloud.conf does not exist.
Enter your api key (You can find it at http://www.dotcloud.com/accounts/settings): ABC123.......................789XYZ <--API keyは、wwwでログインし、dashboardのsettingで表示される

Created application "helloworldapp"

HTMLをインスタンスへpushする

$ dotcloud push helloworldapp
# upload /DIRECTORY/dotcloud/maarui ssh://dotcloud@uploader.dotcloud.com:443/helloworldapp
# rsync
building file list ... done
./
dotcloud.yml
hw.html

sent 262 bytes  received 53 bytes  48.46 bytes/sec
total size is 122  speedup is 0.39
09:21:11 ---> Deploy of "helloworldapp" scheduled for revision rsync-1326532870687 at 2012-01-14 09:21:11
09:21:11 ---> Initializing new services... (This may take a few minutes)
09:21:11 [www.0] Initializing...
09:21:15 [www.0] Service initialized
09:21:17 ---> All services have been initialized. Deploying code...
09:21:17 [www.0] The build started
09:21:18 [www.0] Fetched code revision rsync-1326532870687
09:21:22 [www.0] Reloading nginx configuration: nginx.
09:21:22 [www.0] The build finished successfully
09:21:22 ---> Deploy finished

Deployment finished. Your application is available at the following URLs
www: http://helloworldapp-ID.dotcloud.com/

これで、表示されるURLにアクセスすると、ちゃんとHTMLが表示される。

その他の操作

アプリケーションの詳細情報は、以下のように取れる。
例は、wwwサービスだが、DBサービスをcreateすると、そのDBへの接続情報などもここで出るそうだ。

$ dotcloud info helloworldapp.www
aliases:
- helloworldapp-ID.dotcloud.com
build_revision: rsync-123456
config:
    path: /
created_at: 1326532871.811918
datacenter: Amazon-us-east-1b
image_version: exxxxxxxxxx8 (latest)
ports:
-   name: ssh
    url: ssh://dotcloud@helloworldapp-ID.dotcloud.com:6908
-   name: http
    url: http://helloworldapp-ID.dotcloud.com/
state: running
type: static

アプリケーションの動作状況

$ dotcloud status helloworldapp.www
#  sudo /etc/init.d/nginx status 
 * nginx is running

sshすると、こんなふうになる

$ dotcloud ssh helloworldapp.www
# $SHELL
dotcloud@helloworldapp-default-www-0:~$ 
dotcloud@helloworldapp-default-www-0:~$ ls
code  current  environment.json  environment.yml  rsync-1326533061883  static
dotcloud@helloworldapp-default-www-0:~$ cd current
dotcloud@helloworldapp-default-www-0:~/current$ ls
dotcloud.yml  index.html
dotcloud@helloworldapp-default-www-0:~/current$ exit

アプリケーションの削除

$ dotcloud destroy helloworldapp
Please confirm destruction [yn]: y
Destroy for "helloworldapp" triggered.

消えたことを確認

$ dotcloud status helloworldapp.www
error: "helloworldapp" not found.

この操作のシンプルさは気に入った。 herokuがいまいちだったので、しばらく、これで遊んでみようと思う。



sylphide_ffr31mr at 00:18コメント(0)トラックバック(0)技術 
記事検索
最新コメント
プロフィール

やすき

月別アーカイブ
  • ライブドアブログ