Dynabook T551/59DBS (2011年秋冬)を分解する

Dynabookの電源が入らないとのことで、ばらしてみる。

で、裏面にはネジがびっしり。

CDドライブは、図のネジ1本で大丈夫。

HDDとメモリは1本ずつ。

メモリはこんなの。

キーボードは2本。

キーボード上部からこじ開ける。裏返してねじ穴確認。

キーボードを外すには裏のケーブルシートを引き抜く。左右の白いプラスチック部分を引いて緩めてからね。

上面カバーを外すには図のねじ2本と、コネクターをいろいろ外す。

マザーボードを外すには、先にファンを取らねばならん。

やはりファンは埃まみれ。

ねじ一本とケーブルあちこち抜いてマザーボードも攻略成功。

ちなみに、本題は、「電源が入らない」故障の対策だったが、専門家じゃないので原因は分かりませんでした。
まだまだ青いな。

サイト改装への道(13) 「Windowsでgulp」

Windowsでgulpを使ってBrowsersyncしたい。

まずは、次のページからGitのWindows用セットアップファイルをダウンロードする。
http://git-scm.com/downloads/
EXEを実行して、インストール。標準設定でOK?

続いて、次のページからnode.jsのWindows用セットアップファイルをダウンロードする。
https://nodejs.org/download/
msi、またはEXEを実行して、インストール。標準設定でOK?

まず、GitBashのショートカットのプロパティを開いて、詳細設定で管理者で実行するようにチェックしておく。

そして、GitBashを起動。
次のコマンドでgulpをインストール

$ npm install -g gulp

で、インストールは終わった。
あとは、Browsersyncを目指す!

サイト改装への道(12) 「Yii2のインストール上級編」

昨日はBasicなテンプレートをインストールしたが、今日はAdvancedなテンプレートをインストールしてみる。
こちらを参考に、昨日と違うコマンドを実行。

$ composer create-project –prefer-dist yiisoft/yii2-app-advanced yii-advanced
Installing yiisoft/yii2-app-advanced (2.0.4)
– Installing yiisoft/yii2-app-advanced (2.0.4)
Downloading: 100%
Created project in yii
Loading composer repositories with package information
Installing dependencies (including require-dev)
– Installing yiisoft/yii2-composer (2.0.3)
Loading from cache
– Installing ezyang/htmlpurifier (v4.6.0)
Loading from cache
– Installing cebe/markdown (1.1.0)
Loading from cache
– Installing bower-asset/jquery (2.1.4)
Loading from cache
– Installing bower-asset/jquery.inputmask (3.1.63)
Loading from cache
– Installing bower-asset/punycode (v1.3.2)
Loading from cache
– Installing bower-asset/yii2-pjax (v2.0.4)
Loading from cache
– Installing yiisoft/yii2 (2.0.4)
Loading from cache
– Installing swiftmailer/swiftmailer (v5.4.1)
Downloading: 100%
– Installing yiisoft/yii2-swiftmailer (2.0.4)
Loading from cache
– Installing yiisoft/yii2-codeception (2.0.4)
Loading from cache
– Installing bower-asset/bootstrap (v3.3.4)
Loading from cache
– Installing yiisoft/yii2-bootstrap (2.0.4)
Loading from cache
– Installing yiisoft/yii2-debug (2.0.4)
Loading from cache
– Installing bower-asset/typeahead.js (v0.10.5)
Loading from cache
– Installing phpspec/php-diff (v1.0.2)
Loading from cache
– Installing yiisoft/yii2-gii (2.0.4)
Loading from cache
– Installing fzaninotto/faker (v1.5.0)
Loading from cache
– Installing yiisoft/yii2-faker (2.0.3)
Loading from cache
fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files

次にアプリケーションの初期化。因みに開発環境での初期化。

$ php yii-advanced/init
Yii Application Initialization Tool v1.0
Which environment do you want the application to be initialized in?
  [0] Development
  [1] Production
  Your choice [0-1, or “q” to quit] 0
  Initialize the application under ‘Development’ environment? [yes|no] yes
  Start initialization …
   generate backend/config/main-local.php
   generate backend/config/params-local.php
   generate backend/web/index-test.php
   generate backend/web/index.php
   generate common/config/main-local.php
   generate common/config/params-local.php
   generate console/config/main-local.php
   generate console/config/params-local.php
   generate frontend/config/main-local.php
   generate frontend/config/params-local.php
   generate frontend/web/index-test.php
   generate frontend/web/index.php
   generate yii
   generate cookie validation key in backend/config/main-local.php
   generate cookie validation key in frontend/config/main-local.php
      chmod 0777 backend/runtime
      chmod 0777 backend/web/assets
      chmod 0777 frontend/runtime
      chmod 0777 frontend/web/assets
      chmod 0755 yii
      chmod 0755 tests/codeception/bin/yii
  … initialization completed.

あとは、MySQLのデータベースを作成し、その内容でPHPファイルを更新。

$ vi yii-advanced/common/config/main-local.php

return [
    ‘components’ => [
        ‘db’ => [
            ‘class’ => ‘yiidbConnection’,
            ‘dsn’ => ‘mysql:host=127.0.0.1;port=8889;dbname=yii’,
            ‘username’ => ‘yii’,
            ‘password’ => ‘yii’,
            ‘charset’ => ‘utf8’,
        ],
        ‘mailer’ => [
            ‘class’ => ‘yiiswiftmailerMailer’,
            ‘viewPath’ => ‘@common/mail’,
            // send all mails to a file by default. You have to set
            // ‘useFileTransport’ to false and configure a transport
            // for the mailer to send real emails.
            ‘useFileTransport’ => true,
        ],
    ],

];

今回は、MAMPを利用しているので、ポートが8889となっている。
データベース名は、yii。
ユーザもyii。

あと、hostはlocalhostだと、migration時に次の様なエラーになるため、127.0.0.1に変更しておく。

Exception ‘yiidbException’ with message ‘SQLSTATE[HY000] [2002] No such file or directory’

in yii/vendor/yiisoft/yii2/db/Connection.php:534

情報を元に、データベースの初期構成を行ってもらう。

$ php yii-advanced/yii migrate
Yii Migration Tool (based on Yii v2.0.4)
Creating migration history table “migration”…Done.
Total 1 new migration to be applied:
m130524_201442_init
Apply the above migration? (yes|no) [no]:yes
*** applying m130524_201442_init
    > create table {{%user}} … done (time: 0.019s)
*** applied m130524_201442_init (time: 0.025s)

Migrated up successfully.

これで次のURLでフロントエンド、バックエンドのページが表示される。

http://localhost:8888/yii-advanced/frontend/web/index.php
http://localhost:8888/yii-advanced/backend/web/index.php

落とし穴いっぱい。疲れるよ。

サイト改装への道(11) 「Yii2のインストール」

まずは、「はじめに:インストール」を参考に、次のページからダウンロード。
http://www.yiiframework.com/
と思ったら、Composerでインストールする手も。
最近、使う機会が多いが、Mac OS Xでのインストール方法は、

$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading…
Composer successfully installed to: /Users/username/composer.phar
Use it: php composer.phar

以上!

あれ?インストール先が/Users/username/になってる。

移動しとこう。

$ mv composer.phar /usr/local/bin/composer

これによって、

$ php composer.phar 〜

と、コマンドを実行するところ、

$ composer 〜

で、実行できるようになる。

本題に戻って、Yiiをインストール、と思ったら、先にプラグインのインストールが必要。

$ composer global require “fxp/composer-asset-plugin:1.0.0”
Changed current directory to /Users/username/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
– Installing fxp/composer-asset-plugin (v1.0.0)
Downloading: 100%
Writing lock file
Generating autoload files
で、やっとYiiをインストール。今度こそ。

基本的なテンプレートか、アドバンスドなテンプレートか選びますが、今回は基本的な方を選んで、

$ composer create-project yiisoft/yii2-app-basic basic 2.0.4
Installing yiisoft/yii2-app-basic (2.0.4)  – Installing yiisoft/yii2-app-basic (2.0.4)    Downloading: 100%         
Created project in basicLoading composer repositories with package informationInstalling dependencies (including require-dev)Reading bower.json of bower-asset/jquery.inputmask (3.1.56)Could not fetch https://api.github.com/repos/RobinHerbots/jquery.inputmask/contents/bower.json?ref=xxxxxxxxxxxxxxxxx, please create a GitHub OAuth token to go over the API rate limitHead to https://github.com/settings/tokens/new?scopes=repo&description=yyyyyyyyyyyyto retrieve a token. It will be stored in “/Users/username/.composer/auth.json” for future use by Composer.Token (hidden): 

と、なんだか途中で止まってしまいました。

調べてみると、Githubへのアクセスは、認証なしの場合、同じIPアドレスから1時間で60回までとなっているようで、それを超えたようです。
因みに、次のコマンドで、あと何回アクセスできるかが分かります。

$ curl -i https://api.github.com/users/whatever
HTTP/1.1 403 Forbidden
Server: GitHub.com
Date: Sat, 06 Jun 2015 11:58:23 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 257
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1433594536

60回中、残り0。はい。もうダメです。

因みに、リセットされるのは、1433594536っていう時間。
Macだと、次のコマンドで何時何分かが分かります。

$ date -r 1433594536
2015年 6月 6日 土曜日 21時42分16秒 JST

では、Githubのアカウントを持っているであろう事を祈りつつ、次のページに行って、
https://github.com/settings/tokens

[Generate new token]ボタンをクリックして、トークンを入手してください。

因みに、次のコマンドで、残りが確認できます。

$ curl -i -H “Authorization: token 12345678901234567890123456789012” https://api.github.com/users/whatever
HTTP/1.1 200 OK
Server: GitHub.com
Date: Sat, 06 Jun 2015 12:35:33 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1096
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4843
X-RateLimit-Reset: 1433596872

5000回だって。


ま、取得したトークンを入力して続ければ、インストールされる。

$ composer create-project yiisoft/yii2-app-basic basic 2.0.4
Installing yiisoft/yii2-app-basic (2.0.4)
  – Installing yiisoft/yii2-app-basic (2.0.4)
    Loading from cache
Created project in basic
Loading composer repositories with package information
Installing dependencies (including require-dev)
  – Installing yiisoft/yii2-composer (2.0.3)            
    Loading from cache
  – Installing ezyang/htmlpurifier (v4.6.0)
    Downloading: 100%      
  – Installing cebe/markdown (1.1.0)
    Downloading: 100%      
  – Installing bower-asset/jquery (2.1.4)
    Downloading: 100%      
  – Installing bower-asset/jquery.inputmask (3.1.63)
    Downloading: 100%      
  – Installing bower-asset/punycode (v1.3.2)
    Downloading: 100%      
  – Installing bower-asset/yii2-pjax (v2.0.4)
    Downloading: 100%      
  – Installing yiisoft/yii2 (2.0.4)
    Downloading: 100%      
  – Installing swiftmailer/swiftmailer (v5.4.0)
    Downloading: 100%      
  – Installing yiisoft/yii2-swiftmailer (2.0.4)
    Downloading: 100%      
  – Installing yiisoft/yii2-codeception (2.0.4)
    Downloading: 100%      
  – Installing bower-asset/bootstrap (v3.3.4)
    Downloading: 100%      
  – Installing yiisoft/yii2-bootstrap (2.0.4)
    Downloading: 100%      
  – Installing yiisoft/yii2-debug (2.0.4)
    Downloading: 100%      
  – Installing bower-asset/typeahead.js (v0.10.5)
    Downloading: 100%      
  – Installing phpspec/php-diff (v1.0.2)
    Downloading: 100%      
  – Installing yiisoft/yii2-gii (2.0.4)
    Downloading: 100%      
  – Installing fzaninotto/faker (v1.5.0)
    Downloading: 100%      
  – Installing yiisoft/yii2-faker (2.0.3)
    Downloading: 100%      
fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files
chmod(‘runtime’, 0777)…done.
chmod(‘web/assets’, 0777)…done.
chmod(‘yii’, 0755)…done.
で?