Macでアプリケーションのショートカットキーを⌘(コマンド)長押しで表示する「CheatSheet」

2012年5月29日火曜日 投稿者 Unknown 0 コメント

http://www.cheatsheetapp.com/CheatSheet/

CheatSheet をダウンロードして実行する。

ショートカットを調べたいアプリケーションにフォーカスして、⌘を長押しすると…。Fullscreen

この様な感じでショートカット一覧が表示できる。画面はTextMateのもの。

Cocoaアプリケーションでしか反応しないみたい。

ラベル: ,

Mac OS X 10.7で原因不明のフリーズが発生

2012年5月23日水曜日 投稿者 Unknown 0 コメント

ここのところMac OS X 10.7がちょこちょこフリーズする。
前からたまにはあったがここまで頻発はしてなかったが、最近ひどいので気合を入れて解決してみることにした。 

Console.appで確認すると、IOSurface: buffer allocation size is zero というメッセージが出てフリーズしているみたい。

検索してみると、http://nanofunk.net/mac-osx-lion-10-7-system-freezes-kernel-iosurface-buffer-allocation-size-is-zero-console-message/ この人も同じ症状みたい。

どうやらFlash Playerが悪さをしているようだ。

Flash Playerは標準でアンインストーラが入っていない(!!)ので、http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html ここから uninstall_flash_player_osx.dmg というパッケージを入手する。

アンインストールを実行したら念のため再起動しておく。

これでしばらく使ってみているけど、今のところ同症状は発生していない。

Flash PlayerがOSをフリーズさせることなんてあるんだね、そりゃAppleもiPhoneやiPadにFlash Player入れたくないわけだ…。

こんな話とか、「アドビ、「Flash Player 11.2」リリース--開発者向けに新課金制度も導入へ http://cuaoar.jp/2012/03/flash-player-8.html」

「Flash Player プレミアム機能の発表 http://cuaoar.jp/2012/03/flash-player-8.html」こんなのとかあるし。

ますますHTML5への移行をしたくなる内容をなぜAdobe自らやるのだろう、もしかしてFlashの開発を続けたくないのか?なんてことはないだろうけどね。

どうなってしまうことやら。

Mac OS X, version 10.6 and later: uninstall_flash_player_osx.dmg (238 KB) 

ラベル:

PhpStormで画面が狭い人向けのTips

2012年5月22日火曜日 投稿者 Unknown 0 コメント

こんな感じで色々表示したいけど狭い場合は ⌘1とかを多用するとすっきり。

⌘1はプロジェクトのトグルなど⌘nに割り当てられているので、View > Tool Windows > の一覧から確認。

狭い

 

ほらすっきり

ひろい

ラベル:

SabelでBDDする

投稿者 Unknown 0 コメント

Sabel PHP FrameworkでBehatを使ってBDD開発できるようにします。

開発環境はLinuxかMacを対象にしているのでWindowsの人はごめんなさい。

まずはBehatのインストール

pear channel-discover pear.symfony.com
pear channel-discover pear.behat.org
pear install behat/behat

ドキュメントはこちら http://pear.behat.org/

正常にインストールできている場合は behat コマンドが使えます。

% behat

[InvalidArgumentException]                  Context class "FeatureContext" not found                                              

behat [-c|--config="..."] [-p|--profile="..."] [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [features]

 もしくは、Features path "/var/www/html/fotofoo/features" does not exist

この様な表示になる。

// コンソールに色が無いよ!という人はbehat --ansi とやってみて。

FeatureContextが無いよといっているのでFeatureContextを作る。

 

作るといってもinitオプションでコマンドを実行するだけ。

% behat --init

そうするとカレントディレクトリの下にfeatures/が作られる。

もう一度 behat

% behat

No scenarios
No steps
0m0.001s

これで準備完了。

実際にフィーチャを実装してみる

とりあえず、適当にモデルを対象にしたfeatureファイルをfeatures/に作成する。

# language: en
#
# features/sabel_test.feature

Feature: test model
  Scenario: test model
    Given model "Test" must be exists
    When I run "selectOne"
    Then I should get name "sabel"

これでbehatコマンドを実行するとステップの雛形を作成してくれる。

% behat

Feature: test model
Scenario: test model # features/sabel_test.feature:6
Given model "Test" must be exists
When I run "selectOne"
Then I should get name "sabel"
2 scenarios (1 passed, 1 undefined)
5 steps (2 passed, 3 undefined)
0m0.052s
You can implement step definitions for undefined steps with these snippets:
/**
* @Given /^model "([^"]*)" must be exists$/
*/
public function modelMustBeExists($argument1)
{
throw new PendingException();
}
/**
* @When /^I run "([^"]*)"$/
*/
public function iRun($argument1)
{
throw new PendingException();
}
/**
* @Then /^I should get name "([^"]*)"$/
*/
public function iShouldGetName($argument1)
{
throw new PendingException();
}
 

で、この結果を features/bootstrap/SabelModelFeatureContext.php に貼り付ける。

そしてSabelModelFeatureContext.phpを認識させるために、FeatureContext.phpのコンストラクタに追加する。

$this->useContext('sabel_test', new SabelModelFeatureContext($parameters));

 

SabelModelFeatureContextの実装はこんなかんじ。

require_once "init.php";
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
/**
* Created by JetBrains PhpStorm.
* User: morireo
* Date: 12/5/22
* Time: 12:24 PM
* To change this template use File | Settings | File Templates.
*/
class SabelModelFeatureContext extends BehatContext
{
private $model;
private $result;
 
 /**
* @Given /^model "([^"]*)" must be exists$/
*/
public function modelMustBeExists($argument1)
{
$this->model = MODEL($argument1);
}
 
 /**
* @When /^I run "([^"]*)"$/
*/
public function iRun($argument1)
{
$this->result = $this->model->$argument1("id", 1);
}
 
 /**
* @Then /^I should get name "([^"]*)"$/
*/
public function iShouldGetName($argument1)
{
if ($this->result !== $argument1) {
return false;
}
}
}

ここでinit.phpをrequireしているが、init.phpは下記のようになる。これをしておかないとSabelの機能が使えないので注意。

# features/bootstrap/init.php
<?php
define("SBL_BATCH", true);
define("RUN_BASE", dirname(__FILE__) . "/../../");
require (RUN_BASE . DIRECTORY_SEPARATOR . "Sabel" . DIRECTORY_SEPARATOR . "Sabel.php");
require (RUN_BASE . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "INIT.php");
require (RUN_BASE . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "environment.php");
if (!defined("ENVIRONMENT")) {
echo "SABEL FATAL ERROR: must define ENVIRONMENT in config/environment.php";
exit;
}
$_SERVER["HTTP_HOST"] = "localhost";
$_SERVER["SERVER_NAME"] = "localhost";
$_SERVER["REQUEST_URI"] = "/";
if (isset($_SERVER["argv"][2])) {
$_SERVER["REQUEST_METHOD"] = strtoupper($_SERVER["argv"][2]);
} else {
$_SERVER["REQUEST_METHOD"] = "GET";
}
if (isset($_SERVER["argv"][1])) {
$parsed = parse_url("http://localhost/" . $_SERVER["argv"][1]);
$_SERVER["REQUEST_URI"] = $parsed["path"];
if (isset($parsed["query"])) {
if ($_SERVER["REQUEST_METHOD"] === "POST") {
parse_str($parsed["query"], $_POST);
} else {
parse_str($parsed["query"], $_GET);
}
}
}
if ((ENVIRONMENT & PRODUCTION) > 0) {
Sabel::init();
Sabel_Bus::create()->run(new Config_Bus());
Sabel::shutdown();
} else {
Sabel_Bus::create()->run(new Config_Bus());
}

 

ひとまずこれでSabelでBDDができるようになる。

日本語でfeatureファイルを記述したい場合は.featureファイルの先頭のlanguageをjaにする。

そうすると、フィーチャ シナリオ 背景 前提 かつ ならば そしてのようなキーワードが日本語で記述できる。ステップも日本語で記述する。

キーワードは  behat --story-syntax --lang ja このコマンドで一覧を教えてもらえる。

# language: ja
[フィーチャ|機能]: Internal operations
In order to stay secret
As a secret organization
We need to be able to erase past agents' memory
背景:
前提 there is agent A
かつ there is agent B
シナリオ: Erasing agent memory
前提 there is agent J
かつ there is agent K
もし I erase agent K's memory
ならば there should be agent J
[しかし|但し|ただし] there should not be agent K
[シナリオアウトライン|シナリオテンプレート|テンプレ|シナリオテンプレ]: Erasing other agents' memory
前提 there is agent <agent1>
かつ there is agent <agent2>
もし I erase agent <agent2>'s memory
ならば there should be agent <agent1>
[しかし|但し|ただし] there should not be agent <agent2>
[例|サンプル]:
| agent1 | agent2 |
| D | M |

フィーチャを全て日本語で記述し顧客でも理解できる内容で記述すれば受け入れテストの自動化ができる。

ラベル: ,

CentOS 5.8はtg3ドライバに問題がある

2012年4月8日日曜日 投稿者 Unknown 0 コメント

CentOS 5.8のタグVLAN(8021q)がtg3ドライバのバグで正常に動作しない。

yum install kmod-tg3-rhel5u7

として再起動すれば解消する。

かなり致命的だ…。SLにも同様の問題があるかは未調査。

ラベル:

OpenSocialをやってみる

2012年4月6日金曜日 投稿者 Unknown 0 コメント

調査を依頼されたので、少しずつ始める。

Shindigの概要

まずは、shindig(シンディグ)というOpenSocialコンテナの理解からすすめる。

shindigはASFがオープンソースで開発している。

ライセンスはApache License 2.0

公式サイト http://shindig.apache.org/

shindigはPHPとJava向けの実装がある。

 

OpenSocialはAPIの定義であって実装ではないのでリファレンス実装としてShindigがある。聞いた話によると実装も完全ではないようだ。

 

Shindigは下記の機能がある。

  • Gadget Container JavaScript: core JavaScript foundation for general gadget functionality (read more about gadget functionality). This JavaScript manages security, communication, UI layout, and feature extensions, such as the OpenSocial API.
  • Gadget Rendering Server: used to render the gadget XML into JavaScript and HTML for the container to expose via the container JavaScript.
  • OpenSocial Container JavaScript: JavaScript environment that sits on top of the Gadget Container JavaScript and provides OpenSocial specific functionality (profiles, friends, activities, datastore).
  • OpenSocial Data Server: an implementation of the server interface to container-specific information, including the OpenSocial REST APIs, with clear extension points so others can connect it to their own backends.

 

OpenSocialコンテナの役割

..書きかけ..

 

shindigのセットアップ

参考 http://shindig.apache.org/developers/php/build.html

セットアップしたら下記URLにアクセスしてみる。

http://shindig.local/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml

 

ToDo

この様な画面が表示されれば成功

 

OpenPNEのセットアップ

参考 http://www.openpne.jp/pne-downloads/openpne3/#openpne-3.5-3.6

セットアップ手順 https://raw.github.com/openpne/OpenPNE3/OpenPNE-3.6.2/doc/ja/OpenPNE3_Setup_Guide.txt

 

git clone git://github.com/openpne/OpenPNE3.git
cd OpenPNE3
git checkout OpenPNE-3.6.2
cd OpenPNE3
cp config/ProjectConfiguration.class.php.sample config/ProjectConfiguration.class.php
cp config/OpenPNE.yml.sample config/OpenPNE.yml
./symfony openpne:install
chmod -R 777 log cache

VirtualHostなどの設定をしてアクセスする。

Symfonyはwebディレクトリがドキュメントルートなので忘れないように

sudo apchectl restart


ブラウザからアクセス(PC)

http://example.com/ ログインフォームに sns@example.com / password と入力し、ログインできるかどうか確認 ※メールアドレスとパスワードはログイン後に必ず変更してください

MySNS

問題なければこの様な画面がh

ブラウザからアクセス(管理画面)

(1) http://example.com/pc_backend.php にアクセス

(2) ログインフォームに admin / password と入力し、ログインできるかどうか確認 ※メールアドレスとパスワードはログイン後に必ず変更してください

MySNS管理画面 2

問題なければこの様な画面が表示される。

参考

OpenSocialを始めよう! 第一回 http://labs.unoh.net/2009/04/opensocial1.html

OpenSocialを始めよう(1) - OpenSocialとは?

ラベル:
2012年2月29日水曜日 投稿者 Unknown 0 コメント
iPhone4SやiPad2などのJailbreakができるAbsinthe0.4で、iOS側の画面にAbsintheアイコンが表示されて、「URLを表示できません」などのエラーが表示されてCydiaがインストールされな場合は、設定>一般>リセット>すべての設定をリセットとしてから、再起動後にAbsintheでJailbreakをやり直すと正常にCydiaがインストールされる。
ラベル: