Hatena::ブログ(Diary)

紫陽花観察日記 このページをアンテナに追加 RSSフィード

2010-03-19 Amazonの注文履歴デザイン変更 このエントリーを含むブックマーク このエントリーのブックマークコメント

f:id:hydrangeas:20100319175704j:image:right

Amazonの注文履歴デザインが変わったようですね.

昨日注文した商品の配送状況を見ようとしたら,変わっていてびっくりしました.

写真は変更後のデザイン.

運良く(?)いろいろなパターンがありましたのであげ.

Amazon以外が扱う発送前商品,発送後商品,Amazonが扱う発送前商品,発送準備中っと.

写真が表示されると,買ったものがすぐにわかるのでいいですね.

前のときは,「一応」確認のためにリンクを辿ったりしてましたから.

変わったばかりで評価もないでしょうけど,とりあえずは使いやすそうでgoodな感じです.

2009-11-11

Installing Go

| 17:52 |  Installing Goを含むブックマーク  Installing Goのブックマークコメント

Getting Started - The Go Programming Languageの無責任訳

Introduction

Go is an open source project, distributed under a BSD-style license. This document explains how to check out the sources, build them on your own machine, and run them.

GoはBSDライセンスオープンソースプロジェクトです.このドキュメントではソースコードをチェックアウト*1し,ビルドし,実行するまでを説明しています.

There are two distinct ways to experiment with Go. This document focuses on the gc Go compiler and tools (6g, 8g etc.). For information on how to use gccgo, a more traditional compiler using the GCC back end, see Setting up and using gccgo - The Go Programming Language.

このドキュメントはgc Goコンパイラとツール(6g, 8gなど)に焦点をあてています.

gccgo(GCCバックエンドを用いた従来のコンパイラ)を使用するための情報は

Environment variables

The Go compilation environment depends on three environment variables that you should set in your .bashrc or equivalent, plus one optional variable:

Goのコンパイラ環境は.bashrcかそれに相当するものに設定された3つの環境変数と1つのオプション変数に依存します.

  • $GOROOT

The root of the Go tree. Typically this is $HOME/go but it can be any directory.

Goのインストールディレクトリです.通常は$HOME/goに設定しますが,他のディレクトリに設定してもかまいません.

  • $GOOS and $GOARCH

The name of the target operating system and compilation architecture. Choices for $GOOS are linux, darwin (Mac OS X 10.5 or 10.6), and nacl (Native Client, an incomplete port). Choices for $GOARCH are amd64 (64-bit x86, the most mature port), 386 (32-bit x86), and arm (32-bit ARM, an incomplete port). The valid combinations are linux/amd64, linux/arm, linux/386, darwin/amd64, darwin/386, and nacl/386.

ターゲットOS*2とコンパイルアーキテクチャ*3を指定します.

$GOOSには,linuxdarwin(Mac OS X 10.5 or 10.6),nacl(ネイティブクライアント)を指定できます.

$GOARCHにはamd64(64bit版x86で十分に移植が完了したもの),i386(32bit版x86),arm(32bit版arm,十分に移植が完了していないもの)を指定できます.

これらの正しい組み合わせとしては,linux/amd64, linux/arm, linux/386, darwin/amd64, darwin/386, and nacl/386となります.

  • $GOBIN (optional)

The location where binaries will be installed. If you set $GOBIN, you need to ensure that it is in your $PATH so that newly built Go-specific command such as the compiler can be found during the build. The default, $HOME/bin, may already be in your $PATH.

バイナリのインストール場所です.もしも$GOBINをセットした場合は,$PATHに明示的に追加し,Goのコンパイラのような新しくビルドされたコマンド群を見つけることができる必要があります.デフォルトでは$HOME/binになっており,すでに$PATHに追加されています.

Note that $GOARCH and $GOOS identify the target environment, not the environment you are running on. In effect, you are always cross-compiling.

ここで留意すべきは$GOARCHと$GOOSがターゲット環境であろうとなかろうと実行には影響しないということです.

事実上,常にクロスコンパイルが可能であることを示しています.

After setting these variables in your .bashrc, double-check them by listing your environment.

.bashrc*4にこれらの変数をセットし,システム環境に表示されるかを念を入れて確認してください.確認のためのコマンドは次の通りです.

$ env | grep '^GO'

Ports

Go compilers support two operating systems (Linux, Mac OS X) and three instruction sets. The versions for Linux and Mac are equally capable except that the ARM port does not run on OS X (yet).

GoコンパイラLinuxMac OS Xの2つのオペレーティングシステムと3つの命令群*5をサポートします.

LinuxとMac向けバージョンはほぼ同一ですが,ARM移植版は(まだ)OS Xでは動きません.

There are important differences in the quality of the compilers for the different architectures.

異なるアーキテクチャコンパイラの品質の違いは重要です.

The most mature implementation. The compiler has an effective optimizer (registerizer) and generates good code (although gccgo can do noticeably better sometimes).

十分に実装されています.このコンパイラは効果的に最適化し,最適なコードに変換します(gccgoはときどき顕著に良い結果を示すこともあります).

Comparable to the amd64 port. Not as well soaked but should be nearly as solid.

amd64版とほぼ同じレベルの品質です.酔っぱらいなどではなくほぼ信頼に足るでしょう.

  • arm (a.k.a. ARM); 5g,5l,5c,5a

It's got a couple of outstanding bugs but is improving. Tested against QEMU and an android phone.

未解決のバグがあるかもしれませんが,いずれ改善されます.QEMUAndroidでテストされています.

Except for things like low-level operating system interface code, the runtime support is the same in all ports and includes a mark-and-sweep garbage collector (a fancier one is in the works), efficient array and string slicing, support for segmented stacks, and a strong goroutine implementation.

低級オペレーティングシステムインタフェースコードに求められるランタイムサポートはすべての移植版に等しく含まれています.内容はmark-and-sweepガーベジコレクタ,効率的な配列,文字スライス,セグメントスタック,そして強力なゴールーチンの実装です.*6

See the separate gccgo document for details about that compiler and environment.

コンパイラや環境についての詳細はgccgoのドキュメントに分けて書かれています.

Fetch the repository

If you do not have Mercurial installed (you do not have an hg command), this command:

もしもMercurial*7がインストールされていない(hgコマンドがない)場合は次のコマンドを実行してください.

$ sudo easy_install mercurial

works on most systems. If that fails, visit the Mercurial Download page.

ほとんどのシステムで動作するはずです.もしも失敗する場合はDownload - Mercurialで,インストールの方法などを確認してください.

Make sure the $GOROOT directory does not exist or is empty. Then check out the repository:

空の$GOROOTディレクトリが存在することを確認し,リポジトリをチェックアウトします.

$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
Mercurialのインストール

結局のところ,Mercurialがインストールできればいいです.

ソースインストールでもなんでも.

easy_installが使用できない場合はpython-setuptoolsをインストールしてください.

ubuntuだとこんな感じです.

$ sudo apt-get install python-setuptools

Install Go

The Go tool chain is written in C. To build it, you need to have GCC, the standard C libraries, the parser generator Bison, and the text editor ed installed. On OS X, they can be installed as part of Xcode. On Linux,

GoツールチェインはCで書かれています.ビルドするにはGCC,標準Cライブラリ,Bison構文解析,そしてテキストエディタのedをインストールします.OS XではXcodeの一部としてインストールされています.Linux*8では次のコマンドを実行します.

$ sudo apt-get install bison gcc libc6-dev ed

(or the equivalent on your Linux distribution).

(もしくはLinuxディストリビューションごとの環境に合わせてください)

To build the Go distribution, make sure $GOBIN (or $HOME/bin if $GOBIN is not set) is in your $PATH and then run

Goをビルドします.$GOBIN($GOBINをセットしていない場合は$HOME/bin)に$PATHが通っていることを確認して次を実行します.

$ cd $GOROOT/src
$ ./all.bash

If all.bash goes well, it will finish by printing

all.bashの実行後,次が出力されたら完了です

 --- cd ../test
N known bugs; 0 unexpected bugs

Nはリリースによって異なる番号です

Writing programs

Given a file file.go, compile it using

file.goを使用してコンパイルしてみます

$ 6g file.go

6g is the Go compiler for amd64; it will write the output in file.6. The ‘6’ identifies files for the amd64 architecture. The identifier letters for 386 and arm are ‘8’ and ‘5’. That is, if you were compiling for 386, you would use 8g and the output would be named file.8.

6gはamd64のGoコンパイラ,出力されるファイルはfile.6になります.'6'はamd64アーキテクチャ用のファイルであると識別されます.識別用のコードは386向けで'8',arm向けで'5'となります.もしも386向けのコンパイラを使用している場合は8gのコマンドを用いると,file.8のファイルが出力されることになります.

To link the file, use

リンカをするには*9

$ 6l file.6

and to run it

実行するには

$ ./6.out

A complete example:

完全なサンプルは次のようになります

$ cat >hello.go <<EOF
package main

import "fmt"

func main() {
 fmt.Printf("hello, world\n")
}
EOF
$ 6g hello.go
$ 6l hello.6
$ ./6.out

これによりhello, worldと表示されれば成功です

There is no need to list hello.6's package dependencies (in this case, package fmt) on the 6l command line. The linker learns about them by reading hello.6.

6lコマンドではhello.6のサンプルにパッケージは依存しません(このケースではpackage fmt).リンカはhello.6を読み込むこと理解します.

To build more complicated programs, you will probably want to use a Makefile. There are examples in places like $GOROOT/src/cmd/godoc/Makefile and $GOROOT/src/pkg/*/Makefile. The document about contributing to the Go project gives more detail about the process of building and testing Go programs.

とても複雑なブログラムのビルドにはおそらくMakefileを使いたいはずです.

これらの説明は$GOROOT/src/cmd/godoc/Makefileか$GOROOT/src/pkg/*/Makefileにあります.

Goプロジェクトによって寄稿されたこのドキュメントはGoプログラムのビルドとテストのプロセスについての詳細を提供します.

Community resources

For real-time help, there may be users or developers on #go-nuts on the Freenode IRC server.

The official mailing list for discussion of the Go language is Go Nuts.

Bugs can be reported using the Go issue tracker.

For those who wish to keep up with development, there is another mailing list, golang-checkins, that receives a message summarizing each checkin to the Go repository.

TBD

Goインストール on 9.04

| 19:58 |  Goインストール on 9.04を含むブックマーク  Goインストール on 9.04のブックマークコメント

インストール日記

mercurial

まずはmercurialのインストール

sudo easy_install mercurial

こけた

Searching for mercurial
Reading http://pypi.python.org/simple/mercurial/
Reading http://www.selenic.com/mercurial
Best match: mercurial 1.3.1
Downloading http://mercurial.selenic.com/release/mercurial-1.3.1.tar.gz
Processing mercurial-1.3.1.tar.gz
Running mercurial-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-wmh_wb/mercurial-1.3.1/egg-dist-tmp-HS_kEV
mercurial/base85.c:12:20: error: Python.h: No such file or directory
mercurial/base85.c: In function ‘b85prep’:
mercurial/base85.c:23: 警告: implicit declaration of function ‘memset’
mercurial/base85.c:23: 警告: incompatible implicit declaration of built-in function ‘memset’
mercurial/base85.c: トップレベル:
mercurial/base85.c:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
mercurial/base85.c:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
mercurial/base85.c:141: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
mercurial/base85.c:150: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initbase85’
error: Setup script exited with error: command 'gcc' failed with exit status 1

だれか理由を知っていたら教えてください.

Python.hがないって言ってますね.どういうことかなぁ.....orz

って書いててわかった気がするけどもういいや

さっさと諦めてaptで入れます

$ sudo apt-get install mercurial{,-common}

Goのインストール

環境変数の設定から.

もちろんbashの場合は.bashrc

$ vi .zshrc

以下を追記(ubuntuには$HOME/binなんてなかったんだ!)

export GOROOT=$HOME/go
export GOOS=linux
export GOARCH=amd64
export GOBIN=$HOME/bin
export PATH=PATH:$GOBIN

で,ディレクトリ作って,読み込み直し.

$ cd;mkdir bin
$ source .zshrc

さあ!Goをダウンロードだ

$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT

プレスリリース初日だからか?

お,おもい・・

とりあえずマニュアル通り打ってみる

$ sudo apt-get install bison gcc libc6-dev ed

やっぱり入ってる.というか開発したことあるマシンならたいがいあるだろう

さあ,ようやく本番.

$ cd $GOROOT/src
$ ./all.bash

エラー

/home/test/bin/gotest: line 141: ./6.out: cannot execute binary file
make[1]: *** [test] エラー 126
make[1]: ディレクトリ `/home/test/go/src/pkg/archive/tar' から出ます
make: *** [archive/tar.test] エラー 2

ubuntuの64bit版を入れたのだと思ったのだけど,32bitだったか?

$GOARCH=386にしてリビルド

特にファイルとかは消してない

/home/test/bin/gotest: line 141:  9814 Trace/breakpoint trap   $E ./$O.out "$@"
make[1]: *** [test] エラー 133
make[1]: ディレクトリ `/home/test/go/src/pkg/net' から出ます
make: *** [net.test] エラー 2

だめ!

とりあえず$HOME/goを削除してhgでmercurialからソースを再ダウンロード

$HOME/bin/*も消した

で,リビルド

/home/test/bin/gotest: line 141:  7146 Trace/breakpoint trap   $E ./$O.out "$@"
make[1]: *** [test] エラー 133
make[1]: ディレクトリ `/home/test/go/src/pkg/net' から出ます
make: *** [net.test] エラー 2

コピーしたかのように同じエラー!

だめ!!

なんなんだまったくもう!

Issue Tracking System

問題を報告しようとしたら,すでに報告されてた

ウチだけの問題じゃなくてよかった!(よくない

スマートな人は$GOROOT/src/pkg/MakefileのNOTESTディレクティブにnetを追加してるみたいよ*10

該当部分のMakefileは次のような感じ(先頭は全部tabですよー)

NOTEST=\
        debug/proc\
        go/ast\
        go/doc\
        go/token\
        hash\
        image\
        malloc\
        rand\
        runtime\
        syscall\
        testing/iotest\
        net\

上手くいったよー

 --- cd ../test
0 known bugs; 0 unexpected bugs

real    3m44.937s
user    2m38.838s
sys     0m22.333s

お試しかっ

さあ試してみよう!

386で作ったので,6lとか6gとかではなく8lとか8gです

$ cd
$ cat >hello.go <<EOF
package main

import "fmt"

func main() {
	fmt.Printf("hello, world\n")
}
EOF
$ 8g hello.go
$ 8l hello.8
$ ./8.out

苦節6時間...ようやくだね...

もう疲れたので今日はここまで!

*1バージョン管理システムからダウンロードすること

*2:Goを使用するOS

*3:GoをコンパイルするOS

*4:使用しているshellに依存しているので,echo $SHELLして確認

*5:CPUアーキテクチャ

*6:ごめんなさい.訳が適当かもしれません

*7バージョン管理システムの一つ

*8:主にDebian/Ubuntu系でしょうね

*9:6lはロクエル

*10:netの前はtab,後ろはバックスラッシュを忘れずに

2009-11-09

Syntax Highlighting Add-on in Concrete5 on Dreamhost

| 12:42 |  Syntax Highlighting Add-on in Concrete5 on Dreamhostを含むブックマーク  Syntax Highlighting Add-on in Concrete5 on Dreamhostのブックマークコメント

Dreamhostのスペースを借りてConcrete5を運用しています.

Add-onのインストール後,Syntax Highlightingだけが動作しませんでした.

ええ.いつものあいつです.

Fatal error: require_once() [function.require]: Failed opening required
'/home/example/example.jp/www/concrete/config/../packages/syntax_highlighter/libraries/geshi.php'
(include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php
:/home/example/example.jp/www/libraries/3rdparty
:/home/example/example.jp/www/concrete/config/../libraries/3rdparty')
in /home/example/example.jp/www/concrete/libraries/loader.php on line 31

ドメインはexample.jpに置換してあります.

というわけで,GeSHi - Generic Syntax Highlighter :: Homeの1.0.8.4をダウンロードして解凍

geshi/とgeshi.phpを次のディレクトリに入れる

~/example/example.jp/www/concrete/packages/syntax_highlighter/libraries

と,上手く焼けました〜表示されるようになりました.

2009-07-13

command not found: ulimit on Ubuntu 8.04.3 LTS

| 11:52 |  command not found: ulimit on Ubuntu 8.04.3 LTSを含むブックマーク  command not found: ulimit on Ubuntu 8.04.3 LTSのブックマークコメント

昨日はupdateおよびupgradeでエライ目にあったので,今日はその修復と動作確認を.

sudo apt-get check

というか,何のエラーもないのが一番怖い.

一度,サービス関係も全て再起動しておくか.

sudo /etc/init.d/apache2 restart

それが間違いだったw

あらぁ

command not found: ulimit

なんで?w

which ulimit

としても

ulimit: shell built-in command

ってでるし,どうしてなのか完全に不明.

で,数時間後の結論.

using zsh as /bin/sh is not supported, it's not a POSIX compatible shell.

Bug#329288: marked as done (apache2-common: apache2ctl uses non-posix ulimit command)

おー.

POSIXとコンパチじゃないからだめなのか.

ls -lha /bin/sh

とすると,

sh -> /bin/zsh4*

となっている.

あらあ

なら,bashに直せばいいんでしょ.

sudo rm -fr /bin/sh
sudo ln -s /bin/bash /bin/sh

で,apache再起動しても問題はありませんでした.


なんでshがzshを指すようになってたんだろう.

upgradeしたから?

それとも誰かいじったかなぁ.

2009-07-12

Sub-process /usr/bin/dpkg returned an error code on Ubuntu 8.04.3 LTS

| 11:43 |  Sub-process /usr/bin/dpkg returned an error code on Ubuntu 8.04.3 LTSを含むブックマーク  Sub-process /usr/bin/dpkg returned an error code on Ubuntu 8.04.3 LTSのブックマークコメント

Ubuntu8.04を入れているサーバでいつも通りupdateとupgradeをかけたらエラーになった.

というか,通常はかけていないのだが,ちょこっと試したいことがあったので.

sudo apt-get update
sudo apt-get upgrade

そしたら,tzdataとmsttcorefontsがエラーになった.というか,msttcorefontsを入れようとしただけなのに.

エラーはタイトル通り.

Sub-process /usr/bin/dpkg returned an error code (1)

さてどうしようかと.

でも通常なら次のコマンドで回復できるはず.

sudo dpkg --configure -a
sudo apt-get -f install

あれ?上手くいきません.

色々調べていたら,同じ問題に行き当たっている人を発見.

*.postinst ファイルは /var/lib/dpkg/info ディレクトリにあるはずです

それと、*.postinst 以外に *.preinst、*.prerm、*.postrm が (もしあれば) 一緒に削除してしまう方が確実です

Ubuntu 9.04 「dpkg: サブプロセス post-installation script はエラー終了ステータス 1 を返しました」からの復帰 - Winux/Lindows

Ubuntuの日本語フォーラムで教えてもらったみたい.

で,さっそく.

mkdir ~/bkups/
sudo mv /var/lib/dpkg/info/tzdata.{postinst,postrm,preinst,prerm} ~/bkups/
sudo mv /var/lib/dpkg/info/msttcorefonts.{postinst,postrm,preinst,prerm} ~/bkups/
sudo dpkg --configure -a
sudo apt-get update
sudo apt-get upgrade

おおw

うまくいった.

途中,update->upgradeの過程でphpmyadminにも同様のエラーが生じたが,同様のエラーのようで,なんとかなった.




はーよかった.

実は再インストールしかないと思い込んで,5GBのバックアップデータを作成して既に他の場所に移していたことは内緒.