画面は青かった。

・ワ・)うえてしぬのだ

Visual StudioでPyramidフレームワークを使ってみる

環境
Visual Studioで空のPython Webプロジェクトを作る。

[テンプレート]-[他の言語]-[Python]-[Web Project]今回はTestProjectとした。
作成されたプロジェクトのPython Enviromentsを右クリックするとvirtualenv作れる。インポートもできる。結構便利。
Add Virtual Enviroment...クリックしてPyramid用にenvという名前で作成。
できたらActivate Enviroment。(自動でActivateされたかも)

Pyramidのインストール

Activateした環境を右クリックして、Install Python Package...
GUIでpipとかeasy_install叩けるけど、コマンドプロンプトで作業した方が楽かもしれない。
Open Command Prompt Here...からプロンプトプロンプトを開いて

Scripts\activate.bat
pip install pyramid
最小限のテンプレートを作成。

作成後Visual Studioで作成したプロジェクトにマージする。

pcreate -t starter TestProject

マージ後がこちら
f:id:erudot:20150923040924p:plain

コマンドプロンプトから実行してみる。
python setup.py develop
pip install -e .
pserve development.ini
プロジェクトのプロパティを開いてRun ServerとDebug Serverそれぞれ設定

Run Server

Command: (virtualenvまでのパス)\scripts\pserve-script.py (script)
Arguments:production.ini

Debug Server

Command: (virtualenvまでのパス)\scripts\pserve-script.py (script)
Arguments:development.ini

設定後、右クリックで実行できるようになる。
f:id:erudot:20150923042559p:plain

ちょっとはまったところ
Fatal error in launcher: Unable to create process using""(省略)""

pcreateでテンプレート作成しようとしたときに出た。
Documents\Visual Studio 2015\Projectsのようにパスにスペースが含まれるとダメらしい。

pkg_resources.DistributionNotFound: waitress

setup.pyでrequiresに指定されているものは入れないといけないっぽい。

apt.confの設定項目APT::Install-RecommendsとAPT::Install-Suggestsについて

github.com

RUN echo "APT::Install-Recommends 0;" >> /etc/apt/apt.conf.d/01norecommends \
&& echo "APT::Install-Suggests 0;" >> /etc/apt/apt.conf.d/01norecommends \
&& apt-get update \
&& apt-get install -y vim.tiny wget sudo net-tools ca-certificates \
&& rm -rf /var/lib/apt/lists/* # 20150504

Dockerfileを眺めていてこの設定何を意味するんだっけ?となったのでメモ。

$man apt.conf
$man apt-get

それぞれ--no-install-recommendsと--install-suggestsに対応しているらしい。

--no-install-recommends
Do not consider recommended packages as a dependency for installing.
Configuration Item: APT::Install-Recommends.

--install-suggests
Consider suggested packages as a dependency for installing.
Configuration Item: APT::Install-Suggests.

参考
Debian Policy Manual - Declaring relationships between packages
Debian JP Project - Debian ポリシーマニュアル - パッケージ間の関連性の宣言

Debian(Jessie)でDockerを動かしてみる

環境
Debian GNU/Linux 8.1
VMware Player 7.1.2

参考
Installation on Debian - Docker Docs
Backports - Debian Wiki

jessie-backportsリポジトリを参照する必要があるらしい。

/etc/apt/sources.listにバックポートリポジトリの定義追加

# Backports repository
deb http://httpredir.debian.org/debian jessie-backports main contrib non-free

ここからはDockerのインストール

$ sudo apt-get update
$ sudo apt-get install docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
aufs-tools cgroupfs-mount git git-man libapparmor1 libdrm2 liberror-perl
libnih-dbus1 libnih1 makedev mountall plymouth rsync
Suggested packages:
btrfs-tools debootstrap lxc rinse git-daemon-run git-daemon-sysvinit git-doc
git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn
desktop-base plymouth-themes
The following NEW packages will be installed:
aufs-tools cgroupfs-mount docker.io git git-man libapparmor1 libdrm2
liberror-perl libnih-dbus1 libnih1 makedev mountall plymouth rsync
0 upgraded, 14 newly installed, 0 to remove and 13 not upgraded.
Need to get 10.4 MB of archives.
After this operation, 48.1 MB of additional disk space will be used.
Do you want to continue? [Y/n]

確認

$ sudo docker run --rm hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from hello-world
a8219747be10: Pull complete
91c95931e552: Already exists
hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd18681cf5daeb82aab55838d
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(Assuming it was not already locally available.)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

For more examples and ideas, visit:
http://docs.docker.com/userguide/

Android Studioでもプロ生ちゃんに会いたい!

この記事はプロ生ちゃん Advent Calendar 2014の12日目の記事です。
プロ生ちゃんかわいいです。マジ天使ですね。

つい先日、Android Studioの安定版リリース1.0が公開されました。
早速私もアップデートして起動したのですが、重大な問題点を発見してしまったんです。

プロ生ちゃんIDE

Visual Studioを開くと、必ず天使に会えます。


エディタが寂しい

Android Studioを開くと…そうです。プロ生ちゃんに会えないんです。これはゆゆしき問題です。
f:id:erudot:20141212041946p:plain

Sexy Editorプラグインの導入

  1. [File]メニューから、[Settings...]を選びます。
  2. [Plugins]を選び、[Browse repositories...]ボタンをクリックします。
  3. Sexy Editorプラグインをインストールします。※Android Studioの再起動が必要です。

プロ生ちゃんマジ天使!!

  1. [File]メニューから、[Settings...]を選びます。
  2. [SexyEditor]を選びます。お好みで設定します。

f:id:erudot:20141212042657p:plain

以上で、Android Studioを起動するたびに天使に会えます。
これでAndroidアプリの開発が捗りますね。

MSCC参加します。


こちらに参加します。

チーム名

すぱいしーふらいどちきん

メンバー

勇者 @erudot
私です。スライムに倒される日々を送っています。
今回勇者一人での参加となりました。

tcpdumpの出力データを分割する

Wiresharkで読める形でダンプするメモ。


毎回巨大なファイルを開くことになって大変お辛いので–Cオプション。
–C numで指定したサイズを越えるとき、連番を振って新しいファイルに書き出してくれます。
なお、manの解説にThe units of file_size are millions of bytes (1,000,000 bytes, not 1,048,576 bytes).とある通り、分割サイズは1000^2bytes単位になる模様。