<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ひろぽっぽれす</title>
	<atom:link href="http://hiropo.co.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://hiropo.co.uk</link>
	<description>Web系エンジニアの適当なブログです。どうでも酔いものばかり作ってます。</description>
	<lastBuildDate>Mon, 12 Mar 2012 06:10:01 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>【Linux】findとxargsとmvで検索したファイルを任意のフォルダに移動する</title>
		<link>http://hiropo.co.uk/archives/903</link>
		<comments>http://hiropo.co.uk/archives/903#comments</comments>
		<pubDate>Mon, 12 Mar 2012 02:28:52 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[find]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=903</guid>
		<description><![CDATA[findで検索した結果をそのままmv使って任意のディレクトリに移動したかったのでやってみた。 例えば、とあるフォルダを検索して、&#8221;/old/images/&#8221;内に移動する場合。 $ find ./  &#8230; <a href="http://hiropo.co.uk/archives/903">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>findで検索した結果をそのままmv使って任意のディレクトリに移動したかったのでやってみた。</p>
<p>例えば、とあるフォルダを検索して、&#8221;/old/images/&#8221;内に移動する場合。</p>
<pre>
$ find ./ -name "*.gif" | xargs -i mv {} ./old/images/
</pre>
<p>これでらくらく入っちゃう！</p>
<p>【追記】<br />
とある神様よりこれでは同じファイル名の画像があったら上書きされちゃうとのご指摘があったため、神様よりスクリプトをいただきました。</p>
<p>神様手抜き版(rsyncを使っちゃう。)</p>
<pre>
find ./ -path ./old/images -prune -o -type f -name '*.gif' | rsync --files-from=- -av . ./old/images/ &#038;&#038; find ./ -path ./old/images -prune -o -type f -name '*.gif' -exec rm -v {} \;
</pre>
<p>神様手抜かない版。</p>
<pre>
find ./ -path ./old/images -prune -o -type f -name '*.gif' | egrep '\.gif$' | xargs -i ksh -c 'a=`dirname {}`;mkdir -pv ./old/images/$a;mv -v {} ./old/images/{}'
</pre>
<p>さすが神様、脱帽です！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/903/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webサイトをクロールするためのメモ。wgetとpavuk。</title>
		<link>http://hiropo.co.uk/archives/894</link>
		<comments>http://hiropo.co.uk/archives/894#comments</comments>
		<pubDate>Wed, 29 Feb 2012 09:45:02 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[pavuk]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=894</guid>
		<description><![CDATA[久しぶりの更新です。 Web制作の現場でWebサイトをまるまるクロールすることがあると思います。例えばサイトマップをつくらなくてはならないときなど。そこでWebサイトをすべて把握するために全ページを手動で見ていっては膨大 &#8230; <a href="http://hiropo.co.uk/archives/894">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>久しぶりの更新です。</p>
<p>Web制作の現場でWebサイトをまるまるクロールすることがあると思います。例えばサイトマップをつくらなくてはならないときなど。そこでWebサイトをすべて把握するために全ページを手動で見ていっては膨大な工数がかかりますしかなり大変です。（最終的には全ページ把握しなくてはいけないので見るんですけど。）</p>
<p>それを少しでもラクにするためにWebサイト全体をクロールするのに<a href="http://www.gnu.org/software/wget/" target="_blank">wget</a>や<a href="http://www.pavuk.org/" target="_blank">pavuk</a>といったツールがとても便利です！</p>
<p>例えばwgetのxオプションが便利です。<br />
xをつけるとドメインのディレクトリをつくり強制的にディレクトリ構造を保ったままファイルを取得してくれます。<br />
さらにベーシック認証(もしくはダイジェスト認証)がかかっている場合は下記オプションをつけることで取得できます。</p>
<pre>
wget -x --http-user=[ベーシック認証ID] --http-password=[ベーシック認証パスワード] http://yahoo.com/index.html
</pre>
<p>&#8220;http://yahoo.com/index.html&#8221; からつながる下層リンク含めてすべて取得したい場合は、pavuk使ったほうが便利です。<br />
オプションが豊富なのでwgetより便利かもしれません。</p>
<pre>
pavuk -base_level 1 \
 -auth_scheme Digest \
 -auth_name [id] \
 -auth_passwd [パスワード] \
 -lmax 5 \
 -progress \
 -force_reget \
 -adomain yahoo.com \
 -noRelocate \
 -all_to_local \
 -enable_js \
 -dont_leave_dir \
 -logfile log \
 -index_name index.html \

http://yahoo.com/index.html
</pre>
<p>実際&#8221;yahoo.com&#8221;にはベーシック認証(もしくはダイジェスト認証)ないですけど、上記のように指定すればベーシック認証(もしくはダイジェスト認証)を突破しつつすべてのページをクロールしてくれます。</p>
<p>▽wgetオプション</p>
<pre>
GNU Wget 1.11.4 Red Hat modified, 非対話的ネットワーク転送ソフト
使い方: wget [オプション]... [URL]...

長いオプションで不可欠な引数は短いオプションでも不可欠です。

スタートアップ:
  -V,  --version           バージョン情報を表示して終了する
  -h,  --help              このヘルプを表示する
  -b,  --background        スタート後にバックグラウンドに移行する
  -e,  --execute=COMMAND   `.wgetrc&#039;形式のコマンドを実行する

ログと入力ファイル:
  -o,  --output-file=FILE    ログを FILE に出力する
  -a,  --append-output=FILE  メッセージを FILE に追記する
  -d,  --debug               デバッグ情報を表示する
  -q,  --quiet               何も出力しない
  -v,  --verbose             冗長な出力をする (デフォルト)
  -nv, --no-verbose          冗長ではなくする
  -i,  --input-file=FILE     FILE の中に指定された URL をダウンロードする
  -F,  --force-html          入力ファイルを HTML として扱う
  -B,  --base=URL            相対 URL(-F -i 使用時) のベース URL を指定する

ダウンロード:
  -t,  --tries=NUMBER            リトライ回数の上限を指定 (0 は無制限).
       --retry-connrefused       接続を拒否されてもリトライする
  -O,  --output-document=FILE    FILE に文書を書きこむ
  -nc, --no-clobber              存在しているファイルをダウンロードで上書きしない
  -c,  --continue                部分的にダウンロードしたファイルの続きから始める
       --progress=TYPE           進行表示ゲージの種類を TYPE に指定する
  -N,  --timestamping            ローカルにあるファイルよりも新しいファイルだけ取得する
  -S,  --server-response         サーバの応答を表示する
       --spider                  何もダウンロードしない
  -T,  --timeout=SECONDS         全てのタイムアウトを SECONDS 秒に設定する
       --dns-timeout=SECS        DNS 問い合わせのタイムアウトを SECS 秒に設定する
       --connect-timeout=SECS    接続タイムアウトを SECS 秒に設定する
       --read-timeout=SECS       読み込みタイムアウトを SECS 秒に設定する
  -w,  --wait=SECONDS            ダウンロード毎に SECONDS 秒待つ
       --waitretry=SECONDS       リトライ毎に 1〜SECONDS 秒待つ
       --random-wait             ダウンロード毎に 0〜2*WAIT 秒待つ
       --no-proxy                プロクシを使わない
  -Q,  --quota=NUMBER            ダウンロードするバイト数の上限を指定する
       --bind-address=ADDRESS    ローカルアドレスとして ADDRESS (ホスト名か IP) を使う
       --limit-rate=RATE         ダウンロード速度を RATE に制限する
       --no-dns-cache            DNS の問い合わせ結果をキャッシュしない
       --restrict-file-names=OS  OS が許しているファイル名に制限する
       --ignore-case             ファイル名/ディレクトリ名の比較で大文字小文字を無視する
  -4,  --inet4-only              IPv4 だけを使う
  -6,  --inet6-only              IPv6 だけを使う
       --prefer-family=FAMILY    指定したファミリ(IPv6, IPv4, none)で最初に接続する
       --user=USER               ftp, http のユーザ名を指定する
       --password=PASS           ftp, http のパスワードを指定する

ディレクトリ:
  -nd, --no-directories           ディレクトリを作らない
  -x,  --force-directories        ディレクトリを強制的に作る
  -nH, --no-host-directories      ホスト名のディレクトリを作らない
       --protocol-directories     プロトコル名のディレクトリを作る
  -P,  --directory-prefix=PREFIX  ファイルを PREFIX/ 以下に保存する
       --cut-dirs=NUMBER          リモートディレクトリ名の NUMBER 階層分を無視する

HTTP オプション:
       --http-user=USER        http ユーザ名として USER を使う
       --http-password=PASS    http パスワードとして PASS を使う
       --no-cache              サーバがキャッシュしたデータを許可しない
  -E,  --html-extension        HTML 文書は `.html&#039; 拡張子で保存する
       --ignore-length         `Content-Length&#039; ヘッダを無視する
       --header=STRING         送信するヘッダに STRING を追加する
       --max-redirect          ページで許可する最大転送回数
       --proxy-user=USER       プロクシユーザ名として USER を使う
       --proxy-password=PASS   プロクシパスワードとして PASS を使う
       --referer=URL           Referer を URL に設定する
       --save-headers          HTTP のヘッダをファイルに保存する
  -U,  --user-agent=AGENT      User-Agent として Wget/VERSION ではなく AGENT を使う
       --no-http-keep-alive    HTTP の keep-alive (持続的接続) 機能を使わない
       --no-cookies            クッキーを使わない
       --load-cookies FILE     load cookies from FILE before session.
       --save-cookies FILE     save cookies to FILE after session.
       --keep-session-cookies  セッションだけで用いるクッキーを保持する
       --post-data=STRING      POST メソッドを用いて STRING を送信する
       --post-file=FILE        POST メソッドを用いて FILE の中味を送信する
       --content-disposition   Content-Disposition ヘッダがあれば
                               ローカルのファイル名として用いる (実験的)
       --auth-no-challenge     サーバからのチャレンジを待たずに、
                               Basic認証の情報を送信します。

HTTPS (SSL/TLS) オプション:
       --secure-protocol=PR     セキュアプロトコルを選択する (auto, SSLv2, SSLv3, TLSv1)
       --no-check-certificate   サーバ証明書を検証しない
       --certificate=FILE       クライアント証明書として FILE を使う
       --certificate-type=TYPE  クライアント証明書の種類を TYPE (PEM, DER) に設定する
       --private-key=FILE       秘密鍵として FILE を使う
       --private-key-type=TYPE  秘密鍵の種類を TYPE (PEM, DER) に設定する
       --ca-certificate=FILE    CA 証明書として FILE を使う
       --ca-directory=DIR       CA のハッシュリストが保持されているディレクトリを指定する
       --random-file=FILE       SSL PRNG の初期化データに使うファイルを指定する
       --egd-file=FILE          EGD ソケットとして FILE を使う

FTP オプション:
       --ftp-user=USER         ftp ユーザとして USER を使う
       --ftp-password=PASS     ftp パスワードとして PASS を使う
       --no-remove-listing     `.listing&#039; ファイルを削除しない
       --no-glob               FTP ファイル名のグロブを無効にする
       --no-passive-ftp        &quot;passive&quot; 転送モードを使わない
       --retr-symlinks         再帰取得中に、シンボリックリンクでリンクされた先のファイルを取得する
       --preserve-permissions  リモートファイルのパーミッションを保存する

再帰ダウンロード:
  -r,  --recursive          再帰ダウンロードを行う
  -l,  --level=NUMBER       再帰時の階層の最大の深さを NUMBER に設定する (0 で無制限)
       --delete-after       ダウンロード終了後、ダウンロードしたファイルを削除する
  -k,  --convert-links      HTML 中のリンクをローカルを指すように変更する
  -K,  --backup-converted   リンク変換前のファイルを .orig として保存する
  -m,  --mirror             -N -r -l 0 --no-remove-listing の省略形
  -p,  --page-requisites    HTML を表示するのに必要な全ての画像等も取得する
       --strict-comments    HTML 中のコメントの処理を厳密にする

再帰ダウンロード時のフィルタ:
  -A,  --accept=LIST               ダウンロードする拡張子をコンマ区切りで指定する
  -R,  --reject=LIST               ダウンロードしない拡張子をコンマ区切りで指定する
  -D,  --domains=LIST              ダウンロードするドメインをコンマ区切りで指定する
       --exclude-domains=LIST      ダウンロードしないドメインをコンマ区切りで指定する
       --follow-ftp                HTML 文書中の FTP リンクも取得対象にする
       --follow-tags=LIST          取得対象にするタグ名をコンマ区切りで指定する
       --ignore-tags=LIST          取得対象にしないタグ名をコンマ区切りで指定する
  -H,  --span-hosts                再帰中に別のホストもダウンロード対象にする
  -L,  --relative                  相対リンクだけ取得対象にする
  -I,  --include-directories=LIST  取得対象にするディレクトリを指定する
  -X,  --exclude-directories=LIST  取得対象にしないディレクトリを指定する
  -np, --no-parent                 親ディレクトリを取得対象にしない

バグ報告や提案は&lt;bug-wget@gnu.org&gt;へ
</pre>
<p>pavukはオプションが豊富すぎてついwktkしちゃいます。</p>
<p>▽pavukオプション</p>
<pre>

Usage:  pavuk  [options]  [any number of URLS]
pavuk-0.9.35 linux-gnu
-v                 - print version number
-h                 - help
-progress/-noprogress
                   - show retrieving progress while running on terminal
-lmax $nr          - allowed depth of tree
-dmax $nr          - maximal number of downloaded documents
-sleep $nr         - sleep for $nr seconds between transfers,
                     default 0 seconds
-rsleep/-norsleep  - randomize sleeping time between transfers
                     from 0 to -sleep time
-retry $nr         - number of retries if anything failed
-nregets $nr       - max number of regets on single file, default 2
-nredirs $nr       - max number of followed HTTP redirections, default 5
-timeout $nr       - timeout for network communications (min).
                     0 == no timeout, default = 0
-rollback $nr      - number of bytes to discard (counted from end
                     of file) if regetting, default 0
-ddays $nr         - number of days since last access when document is
                     checked in sync mode
-nocache/-cache    - disallow caching of HTTP documents (on proxy cache)
-noRobots/-Robots  - care about "robots.txt" file ?
-noFTP/-FTP        - don't download FTP files
-noHTTP/-HTTP      - don't download HTTP files
-noSSL/-SSL        - don't download (HTTPS) SSL files
-noverify/-verify        - don't verify SSL certificates
-noverify/-verify        - don't verify SSL certificates
-noFTPS/-FTPS      - don't download FTPS files
-noGopher/-Gopher  - download Gopher files ?
-noCGI/-CGI        - download parametric CGI pages ?
-noEnc/-Enc        - allow transfer of encoded files ?
-noRelocate/-Relocate
                   - don't rewrite links
-FTPhtml/-noFTPhtml
                   - process HTML files downloaded over FTP
-FTPlist/-noFTPlist
                   - use wide FTP directory listing
-FTPdir/-noFTPdir  - recurse FTP directory
-store_index/-nostore_index
                   - store directory URLs as index files
-force_reget/-noforce_reget
                   - force reget of whole file when server doesn't
                     support reget
-debug             - turn on debug mode
-debug_level $l    - debug level number, see manual for $l description
-asite $list       - comma-separated list of allowed sites
-dsite $list       - comma-separated list of disallowed sites
-adomain $list     - list of allowed domains
-ddomain $list     - list of disallowed domains
-aprefix $list     - list of allowed directory/file prefixes
-dprefix $list     - list of disallowed directory/file prefixes
-asfx $list        - list of allowed suffixes
-dsfx $list        - list of disallowed suffixes
-amimet $list      - list of alloved MIME types
-dmimet $list      - list of disallowed MIME types
-alang $list       - list of preferred languages (only via HTTP)
-acharset $list    - list of preferred character sets (only via HTTP)
-scndir $dir       - directory ,where are stored your scenarios
                     (config files)
-cdir $dir         - directory for storing documents
-subdir $dir       - subdirectory of cdir to operate on
-scenario $str     - name of scenario from scenario directory to load
                     and or run
-auth_scheme 1/2/3 - HTTP authorization scheme 1-user 2-Basic 3-Digest,
                     default 2
-auth_name $str    - name for Authorization (only via HTTP)
-auth_passwd $str  - password for Authorization (only via HTTP)
-auth_reuse_nonce/-noauth_reuse_nonce
                   - reuse one HTTP digest access authorization
                     nonce for more requests
-auth_reuse_proxy_nonce/-noauth_reuse_proxy_nonce
                   - reuse one HTTP proxy digest access
                     authorization nonce for more requests
-ssl_cert_passwd $str
                   - password for SSL certification file
-ssl_cert_file $str
                   - SSL certification file
-ssl_key_file $str - SSL certification key file
-ssl_cipher_list $str
                   - list of prefered SSL ciphers in SSL communication
-egd_socket $file  - path to EGD listening socket
-from $str         - e-mail address used for user identification
-send_from/-nosend_from
                   - send From: header in HTTP request with your
                     e-mail address
-identity $str     - contents of User-agent: field in HTTP request
-pattern $list     - list of wildcard patterns for files
-rpattern $re      - RE matching pattern for files
-skip_pattern $list
                   - list of skip wildcard patterns for files
-skip_rpattern $re
                   - skip RE matching pattern for files
-url_pattern $list - list of wildcard patterns for urls
-url_rpattern $re  - RE matching pattern for urls
-skip_url_pattern $list
                   - list of wildcard patterns for urls
-skip_url_rpattern $re
                   - RE matching patterns for urls
-mode $mode        - set operation mode
                         normal - recurse throught WWW (default)
                         linkupdate - update remote links in local tree
                         sync - synchronize local tree with remote WWW
                                servers
                         singlepage - single page with inline objects
                         singlereget - reget file until not whole
                         resumeregets - reget all files which are broken
                         dontstore - transfer documents, but don't store
                         reminder - checks URLs if they are changed
                         ftpdir - list content of FTP directory
                         mirror - make exact copy of remote site
-ftp_proxy $site[:$port]
                   - ftp proxy/cache server
-http_proxy $site[:$port]
                   - http proxy/cache server
-gopher_proxy $site[:$port]
                   - gopher proxy/cache server
-ssl_proxy $site[:$port]
                   - ssl proxy server
-gopher_httpgw/-nogopher_httpgw
                   - specified gopher proxy is HTTP gateway for Gopher
-ftp_httpgw/-noftp_httpgw
                   - specified ftp proxy is HTTP gateway for FTP
-ftp_dirtyproxy/-noftp_dirtyproxy
                   - use CONNECT request to HTTP proxy for FTP
                     connections
-dumpscn $str      - save scenario in scndir with name $str
-maxsize $nr       - maximal allowed size of document in bytes
-minsize $nr       - minimal allowed size of document in bytes
-http_proxy_pass $str
                   - password for HTTP proxy authorization
-http_proxy_user $str
                   - user name for HTTP proxy authorization
-http_proxy_auth 1/2/3
                   - authorization scheme for HTTP proxy authorization
-logfile $file     - name of file where mesages are stored
-slogfile $file    - name of file where short log will be stored
-tlogfile $file    - name of file where time log will be stored
-trelative $str (object/program)
                   - what timings are relative to
-transparent_proxy $site[:$port]
                   - transparent proxy
-transparent_ssl_proxy $site[:$port]
                   - transparent SSL proxy
-sdemo_mode/-notsdemo_mode
                   - sdemo compatible output
-noencode          - do not perform rfc 2396 character encoding
-stime/-nostime    - write starting and ending time of transfer
-remove_old/-noremove_old
                   - remove improper files or directories while running
                     in sync mode
-remove_before_store/-noremove_before_store
                   - remove file before storing new content
-always_mdtm/-noalways_mdtm
                   - always use MDTM to determine modifictaion time
                     of remote file; never use values from file listing
-auth_file $file   - file where you have stored your auth infos
                     see manual for format description
-base_level $nr    - number of levels of directory tree to omit from top
-ftp_active        - select active FTP data connection
-ftp_passive       - select passive FTP data connection
-active_ftp_port_range $min:$max
                   - range of FTP data connection ports used
                     for active ftp
-quiet             - don't show output messages
-verbose           - show output messages (default)
-newer_than $time  - download only documents newer than $time
                     format of $time: YYYY.MM.DD.hh:mm
-older_than $time  - download only documents older than $time
                     format of $time: YYYY.MM.DD.hh:mm
-schedule $time    - schedule pavuk start at $time
                     format of $time: YYYY.MM.DD.hh:mm
-reschedule $nr    - number of hours between two runs
                     for cyclic scheduling
-dont_leave_site/-leave_site
                   - don't/leave site of starting URL
-dont_leave_dir/-leave_dir
                   - don't/leave directory of starting URL
-preserve_time/-nopreserve_time
                   - preserve document modification time
-preserve_perm/-nopreserve_perm
                   - preserve document permissions
-preserve_slinks/-nopreserve_slinks
                   - preserve absolute symlinks
-leave_level $nr   - how many tree levels leave from starting
                     site , (0 == don't care) default 0
-cookie_file $file - file where are stored cookie infos
-cookie_send/-nocookie_send
                   - send cookie info in HTTP request
-cookie_recv/-nocookie_recv
                   - accept cookies from HTTP response
-cookie_update/-nocookie_update
                   - update cookies in cookies file
-cookie_check/-nocookie_check
                   - check if cookies are set for source domain
-cookies_max $nr   - maximal number of cookies in cookie cache
-disabled_cookie_domains $list
                   - comma-separated list of disabled cookie domains
-disable_html_tag $TAG,[$ATTRIB][;...]
                   - disable processing of URLs from
                     attribute $ATTRIB of HTML tag $TAG
-enable_html_tag $TAG,[$ATTRIB][;...]
                   - enable proccessing of URLs from
                     attribute $ATTRIB of HTML tag $TAG
-user_condition $str
                   - user exit script used to restrict some URLs
                     for more informations see manpage
-tr_del_chr $str   - characters that will be deleted from
                     local filename
-tr_str_str $str1 $str2
                   - translate $str1 to $str2 in local filename
-tr_chr_chr $chrset1 $chrset2
                   - translate $chrset1 to $chrset2 in local filename
-index_name $str   - name of directory index instead of _._.html
-store_name $str   - filename for first downloaded document
-check_size/-nocheck_size
                   - compare received size of file with
                     that provided by remote server
-urls_file $file   - URLs should be read from file, until
                     line with single "." occurs in input
-bg/-nobg          - detach pavuk proces from terminal and
                     don't output any messages on screen
-maxrate $nr       - limit to maximal speed of transfer (kB/s)
-minrate $nr       - limit to minimal speed of transfer (kB/s)
-bufsize $nr       - size of read buffer (kB)
-file_quota $nr    - maximal size of file to transfer (kB)
-trans_quota $nr   - maximal amount of transfer per session (kB)
-fs_quota $nr      - disk free space quota (kB)
-enable_js/-disable_js
                   - enable downloading of javascript source files
-fnrules $t $m $r  - local filename construction rules
                     (for better description see manual)
-store_info/-nostore_info
                   - store document info files with each document
-all_to_local/-noall_to_local
                   - change all links inside HTML document to
                     local immediately after download
-sel_to_local/-nosel_to_local
                   - change all links inside HTML document
                     which acomplish the limits, to
                     local immediately after download
-all_to_remote/-noall_to_remote
                   - change all links inside HTML document to
                     remote immediately after download and
                     don't do any further changes to it
-remind_cmd $str   - command which sends result from reminder mode
-auto_referer/-noauto_referer
                   - in HTTP request send for each starting URL
                     Referer: field which contains its own URL
-referer/-noreferer
                   - send Referer: field in HTTP request
-url_strategy $strategy
                   - scheduling strategy for URLs
                     (this means order how URLs will be downloaded)
                     $strategy is one of :
                        level  - level order in URL tree
                        leveli - level order in URL tree,
                                 but inline objects go first
                        pre    - pre-order in URL tree
                        prei   - pre-order in URL tree,
                                 but inline objects go first
-nscache_dir $dir  - path to Netcape browser cache directory
-remove_adv/-noremove_adv
                   - enable removing of advertisement banners
                     assumes you have setup regular expresions
                     for matching adv banners with -adv_re option
-adv_re $RE        - regular expressions for matching advertisement
                     banner URLs
-check_bg/-nocheck_bg
                   - if running at background, don't write any
                     messages to screen
-send_if_range/-nosend_if_range
                   - send If-Range header in HTTP request
                     turn this of when server support reget, but
                     generates different Etags for two requests
-sched_cmd $str    - command for scheduling
-unique_log/-nounique_log
                   - when original log file locked try to find other
                     with numbering extension which is not locked
-read_css/-noread_css
                   - fetch objects mentioned in style sheets
-post_cmd $str     - postprocessing command, which will be invoked
                     after document will be successfully downloaded
-ssl_version $v    - version of SSL protocol used for communication,
                     valid values: ssl23,ssl2,ssl3,tls1
-unique_sslid/-nounique_sslid
                   - use unique SSL ID with each SSL session
-httpad $hdr       - additional HTTP header
-statfile $str     - statistical report from downloading progress
-aip_pattern $re   - pattern for allowed IP addresses of servers
-dip_pattern $re   - pattern for disallowed IP addresses of servers
-site_level $nr    - maximum allowed number of sites to leave from
                     starting site
-use_http11/-nouse_http11
                   - enable or disable using of HTTP/1.1 protocol
                     features, default is off now
-max_time $nr      - set maximal amount of time for program run
                     in minutes, default 0 == no limit
                     you can use floating point numbers, to
                     specify subminute times
-local_ip $str     - use this local ip address of network interface.
                     This option is for multihomed machines.
-request $req      - extended request informations, used to specify
                     information for GET or POST requests.
                     format of $req :
                     "URL:$url METHOD:[GET|POST] ENCODING:[m|u]
                       FIELD:$variable=$value
                       FILE:$variable=$filename
                       LNAME:$local_filename"
                     (for more informations see manual page)
-hash_size $nr     - size of internal hash tables for performance tuning
-nthreads $nr      - set number of concurent downloading threads
-immesg/-noimmesg  - write messages immediately after produced, not
                     just when safe (from MT point of view)
-formdata $data    - used to specify HTML form fields, for HTML
                     forms found during traversing document tree.
                     Only forms mentiond in this option will be
                     processed automaticaly.
                     "URL:$url
                       FIELD:$variable=$value
                       FILE:$variable=$filename"
                     (for more informations see manual page)
-dumpfd $nr        - number of filedescriptor where to output
                     document contents instead to file
-dump_urlfd $nr    - number of filedescriptor where to output
                     all URLs found in documents
-del_after/-nodel_after
                   - delete FTP document after succesfull transfer
-unique_name/-nounique_name
                   - always generate unique name for each document
-leave_site_enter_dir/-dont_leave_site_enter_dir
                   - leave directory which we first entered on site
-singlepage/-nosinglepage
                   - donwload single HTML page with all inline objects
-dump_after/-nodump_after
                   - when used with option -dumpfd, dump document after
                     successful download and processing of HTML
                     documents
-dump_response/-nodump_response
                   - when used with option -dumpfd, also responses
                     from HTTP servers will be dumped
-auth_ntlm_domain $str
                   - SMB domain name for HTTP NTLM authorization
-auth_proxy_ntlm_domain $str
                   - SMB domain name for HTTP proxy NTLM authorization
-js_pattern $re    - additional RE patterns for matching URLs in DOM
                     event attributes of HTML tags
-follow_cmd $str   - user exit script used tell if you want to follow
                     any link from current HTML document
-retrieve_symlink/-noretrieve_symlink
                   - retrieve symliks like regular files or directories
-js_transform $p $t $h $a
                   - custom JS pattern with transformation
                     $p - pattern
                     $t - transfomation
                     $h - HTML tag or * or ""
                     $a - HTML attrib
-js_transform2 $p $t $h $a
                   - custom JS pattern with transformation and
                     rewriting of URLs in first subpattern
                     $p - pattern
                     $t - transfomation
                     $h - HTML tag or * or ""
                     $a - HTML attrib
-ftp_proxy_user $str
                   - username for access authorization to FTP proxy
-ftp_proxy_pass $str
                   - password for access authorization to FTP proxy
-limit_inlines/-dont_limit_inlines
                   - apply limiting options on page inline objects?
-ftp_list_options $str
                   - additional options or parameters to FTP LIST or
                     NLST commands
-fix_wuftpd_list/-nofix_wuftpd_list
                   - do extensive checking of FTP directory presence to
                     workaround WuFTPD broken responses when trying
                     to list nonexisting directory
-post_update/-nopost_update
                   - update in parent documents only links pointing
                     to current document
-info_dir $dir     - separate directory where will stored info files
                     instead of directly into document tree
-mozcache_dir $dir - path to Mozilla browser cache directory
-aport $list       - allow downloading of documents from servers
                     siting on listed ports
-dport $list       - deny downloading of documents from servers
                     siting on listed ports
-hack_add_index/-nohack_add_index
                   - this is hack to allow adding of also directories
                     of all queued files
-default_prefix $str
                   - default URL prefix for subdirectory of
                     mirrored files
-ftp_login_handshake $host $handshake
                   - customize login handshake for FTP server
-dont_touch_url_rpattern $re
                   - RE pattern of URL which should not be touched
                     by URL rewriting engine
-dont_touch_url_pattern $list
                   - wilcard patterns of URLs which should not
                     be touched by URL rewriting engine
-dont_touch_tag_rpattern $re
                   - RE pattern of HTML tag in which URLs should
                     not be touched by URL rewriting engine
-tag_pattern $tag $attrib $url
                   - wilcard patterns for precise matching of URLs
                     inside HTML tags
-tag_rpattern $tag $attrib $url
                   - RE patterns for precise matching of URLs
                     inside HTML tags
</pre>
<p>なんだか読みづらくなってしまった…。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/894/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTMLとCSSで二次元配列でドット絵 (Hex Color Codes)</title>
		<link>http://hiropo.co.uk/archives/886</link>
		<comments>http://hiropo.co.uk/archives/886#comments</comments>
		<pubDate>Mon, 06 Feb 2012 05:45:22 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[(X)HTML+CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=886</guid>
		<description><![CDATA[これからcanvas盛り上がっていくという中、あえてHTMLタグとCSSを使ったドット絵を描いてみました。 jsdoitに投稿したものなのでちょい古いですけど紹介します。 といっても仕組みは簡単で、描画するデータ情報を二 &#8230; <a href="http://hiropo.co.uk/archives/886">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>これからcanvas盛り上がっていくという中、あえてHTMLタグとCSSを使ったドット絵を描いてみました。<br />
jsdoitに投稿したものなのでちょい古いですけど紹介します。</p>
<p>といっても仕組みは簡単で、描画するデータ情報を二次元配列にもっておいて、それを&lt;li&gt;タグでfloatで並べて描画するというもの。描画のロジックはJavaScriptで実装しました。<br />
描画するターゲットがcanvasか、HTMLタグかの違いだけなので仕組みはとってもシンプルです。</p>
<p>こちらが完成図です。<br />
<script type="text/javascript" src="http://jsdo.it/blogparts/etba/js?view=design"></script>
<p class="ttlBpJsdoit" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://jsdo.it/funnythingz/etba" title="二次元配列でドット絵 (Hex Color Codes)">二次元配列でドット絵 (Hex Color Codes) &#8211; jsdo.it &#8211; share JavaScript, HTML5 and CSS</a></p>
<p>描画データとなる二次元配列マップにHexカラー値を直接書いて渡しているため、このように色は自由に指定できます。</p>
<p>さて、ソースコードの紹介になります。</p>
<h3>【1】描画するHTML側でステージ的なものを用意します。</h3>
<pre>
&lt;ul class=&quot;group tstList&quot;&gt;
    &lt;li id=&quot;stage&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h3>【2】CSSで見た目を制御します。</h3>
<pre>
* {
	margin: 0;
    	padding: 0;
}
.box {
        width: 10px;
	height: 10px;
	overflow: hidden;
	display: block;
	float: left;
}
.wrap:after,
.box:after {
	content: ".";
	display: block;
	clear: both;
	height: 0;
	visibility: hidden;
	font-size: 0.1em;
	line-height: 0;
}
.wrap,
.group {
	zoom: 1;
}
.tstList {
	width: 240px;
}
.tstList li {
	float: left;
    	list-style: none;
}
</pre>
<h3>【3】描画データを二次元配列で用意します。値にはHexカラー値を文字列でもちます。</h3>
<pre>
/*-------------------------------------------------
* map
*/
var map = [
	['ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','f5b199','f5b199','f5b199'],
	['ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','e10000','e10000','e10000','e10000','e10000','ffffff','ffffff','f5b199','f5b199','f5b199'],
	['ffffff','ffffff','ffffff','ffffff','ffffff','e10000','e10000','e10000','e10000','e10000','e10000','e10000','e10000','e10000','f5b199','f5b199'],
	['ffffff','ffffff','ffffff','ffffff','ffffff','FFFF00','FFFF00','FFFF00','f5b199','f5b199','000000','f5b199','ffffff','05299d','05299d','05299d'],
	['ffffff','ffffff','ffffff','ffffff','FFFF00','f5b199','FFFF00','f5b199','f5b199','f5b199','000000','f5b199','f5b199','05299d','05299d','05299d'],
	['ffffff','ffffff','ffffff','ffffff','FFFF00','f5b199','FFFF00','FFFF00','f5b199','f5b199','f5b199','000000','f5b199','f5b199','f5b199','05299d'],
	['ffffff','ffffff','ffffff','ffffff','FFFF00','FFFF00','f5b199','f5b199','f5b199','f5b199','000000','000000','000000','000000','05299d','ffffff'],
	['ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','f5b199','f5b199','f5b199','f5b199','f5b199','f5b199','f5b199','05299d','ffffff','ffffff'],
	['ffffff','ffffff','05299d','05299d','05299d','05299d','05299d','fb8a10','05299d','05299d','05299d','fb8a10','05299d','ffffff','ffffff','ffffff'],
	['ffffff','05299d','05299d','05299d','05299d','05299d','05299d','05299d','fb8a10','05299d','05299d','05299d','fb8a10','ffffff','ffffff','05299d'],
	['f5b199','f5b199','05299d','05299d','05299d','05299d','05299d','05299d','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','ffffff','ffffff','05299d'],
	['f5b199','f5b199','f5b199','ffffff','fb8a10','fb8a10','05299d','fb8a10','fb8a10','EEEEEE','fb8a10','fb8a10','EEEEEE','fb8a10','05299d','05299d'],
	['ffffff','f5b199','ffffff','05299d','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','05299d','05299d'],
	['ffffff','ffffff','05299d','05299d','05299d','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','05299d','05299d'],
	['ffffff','05299d','05299d','05299d','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','fb8a10','ffffff','ffffff','ffffff','ffffff','ffffff'],
	['ffffff','05299d','ffffff','ffffff','fb8a10','fb8a10','fb8a10','fb8a10','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff','ffffff']
]
</pre>
<h3>【4】描画ロジックをJavaScriptで実装します。</h3>
<pre>
/*-------------------------------------------------
* module
*/
var $ = function(id){
	return document.getElementById(id);
}
var $$ = function(id, tag){
	return document.getElementById(id).getElementsByTagName(tag);
}
var createElement = function(tag){
	return document.createElement(tag);
}

/*-------------------------------------------------
* Elements
*/

//Wrap
var Wrap = function(){
	return this.init();
}
Wrap.prototype = {
	init: function(){
		var div = createElement('div');
		div.setAttribute('class', 'wrap');
		div.innerHTML = '';
		return div;
	}
}

//Dot
var Dot = function(args){
	this.background = args.background;
	return this.init();
}
Dot.prototype = {
	init: function(){
		var span = createElement('span');
		span.style.background = "#" + this.background;
		span.setAttribute('class', 'box');
		span.innerHTML = '';
		return span;
	}
}

//Create
var Create = function(obj){
    var stage = obj;
    var wrap = [];
    for( var i = 0, L = map.length; i < L; i++ ){
	    wrap[i] = new Wrap();
	    for( var j = 0, M = map[i].length; j < M; j++ )
    {
	    wrap[i].appendChild( new Dot({ background: map[i][j] }) );
	    }
	    stage.appendChild(wrap[i]);
    }
}

/*-------------------------------------------------
* initilize
*/
var init = function(){
    new Create( $('stage') );
}
window.addEventListener('load', init, false);
</pre>
<p>JavaScriptはライブラリは使っていません、ネイティブ実装です。<br />
jQueryとか使えばもっと簡単に実装できると思います。</p>
<p>でもProcessing.js使う方が面白いのでcanvasに描画した方が良いんじゃないかなｗ</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/886/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing.js 8&#215;8 ドットマトリックスLEDっぽいのつくってみた canvas</title>
		<link>http://hiropo.co.uk/archives/882</link>
		<comments>http://hiropo.co.uk/archives/882#comments</comments>
		<pubDate>Mon, 06 Feb 2012 05:07:52 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[canvas]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=882</guid>
		<description><![CDATA[canvasで使うライブラリはすっかりProcessing.jsに馴染んでしまった僕です、こんにちは。 Arduinoを使った8&#215;8ドットマトリックスLEDの点滅をやりたいなと思い、そのシミュレーションとしてj &#8230; <a href="http://hiropo.co.uk/archives/882">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>canvasで使うライブラリはすっかりProcessing.jsに馴染んでしまった僕です、こんにちは。</p>
<p>Arduinoを使った8&#215;8ドットマトリックスLEDの点滅をやりたいなと思い、そのシミュレーションとしてjsdoitでまずはcanvasに描画してみようと思いたちProcessing.jsで書いてみました。</p>
<p><script type="application/processing">
int[][] p = {
  {0,0,1,0,0,0,0,0},
  {0,1,1,1,1,1,0,0},
  {0,0,1,0,0,0,0,0},
  {0,0,1,1,1,1,0,0},
  {0,1,1,0,1,0,1,0},
  {1,0,1,1,0,0,1,0},
  {0,1,1,0,0,1,0,0},
  {0,0,0,0,0,0,0,0}
};
void setup(){
  size(81, 81);
  frameRate(30);
}
void draw(){
  background(0);
  stroke(0);
  for(int y = 0; y < p.length; y++){
  for(int x = 0; x < p[y].length; x++){
    if(p[y][x] == 0){
      fill(96, 96, 96);
    }
    else if(p[y][x] == 1){
      fill(255, 0, 0);
    }
    ellipseMode(CORNER);
    ellipse(x*10, y*10, 10, 10);
  }}
}
</script></p>
<pre>
int[][] p = {
  {0,0,1,0,0,0,0,0},
  {0,1,1,1,1,1,0,0},
  {0,0,1,0,0,0,0,0},
  {0,0,1,1,1,1,0,0},
  {0,1,1,0,1,0,1,0},
  {1,0,1,1,0,0,1,0},
  {0,1,1,0,0,1,0,0},
  {0,0,0,0,0,0,0,0}
};
void setup(){
  size(81, 81);
  frameRate(30);
}
void draw(){
  background(0);
  stroke(0);
  for(int y = 0; y < p.length; y++){
  for(int x = 0; x < p[y].length; x++){
    if(p[y][x] == 0){
      fill(96, 96, 96);
    }
    else if(p[y][x] == 1){
      fill(255, 0, 0);
    }
    ellipseMode(CORNER);
    ellipse(x*10, y*10, 10, 10);
  }}
}
</pre>
<p>jsdoitにも投稿してあります。<br />
<a href="http://jsdo.it/funnythingz/uhNO" target="_blank">Processing.js 8x8 ドットマトリックスLEDっぽいのつくってみた</a><br />
<script type="text/javascript" src="http://jsdo.it/blogparts/uhNO/js?view=design"></script>
<p class="ttlBpJsdoit" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://jsdo.it/funnythingz/uhNO" title="Processing.js 8x8 ドットマトリックスLEDっぽいのつくってみた">Processing.js 8x8 ドットマトリックスLEDっぽいのつくってみた - jsdo.it - share JavaScript, HTML5 and CSS</a></p>
<p>描画するだけだったら簡単だけど、x軸に対して1ドットずつ横に流してアニメーションさせたいなーと。<br />
アニメーションできたらまたうｐしますん。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/882/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPressにProcessingJSプラグインを導入してみた。</title>
		<link>http://hiropo.co.uk/archives/876</link>
		<comments>http://hiropo.co.uk/archives/876#comments</comments>
		<pubDate>Thu, 05 Jan 2012 09:32:46 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=876</guid>
		<description><![CDATA[最近がっつりProcessingにはまってます。Processing、かわいいよ、Processing。 そこでProcessingで書いたソースをぺたぺたブログにもはってたのですが、実際に動いてるものをどうにか簡単には &#8230; <a href="http://hiropo.co.uk/archives/876">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>最近がっつりProcessingにはまってます。Processing、かわいいよ、Processing。</p>
<p>そこでProcessingで書いたソースをぺたぺたブログにもはってたのですが、実際に動いてるものをどうにか簡単にはれないかと思い探してみました。</p>
<p>Processing JS WordPress Plugin<br />
<a href="http://www.keyvan.net/code/processing-js/" target="_blank">http://www.keyvan.net/code/processing-js/</a></p>
<p>意図も簡単に見つけてしまったので早速導入してみました。</p>
<p><script type="application/processing">
//Info: http://processingjs.org/reference
void setup() {
	size(400, 160);
	frameRate(15);
}
void draw() {
        int s = random(100);
	background(#ffffff);
        stroke(random(255), random(255), random(255));
	ellipse(random(width), random(height), s, s);
}
</script></p>
<pre>
void setup() {
    size(400, 160);
    frameRate(15);
}
void draw() {
    int s = random(100);
    background(#ffffff);
    stroke(random(255), random(255), random(255));
    ellipse(random(width), random(height), s, s);
}
</pre>
<p>良い感じに動いたー！すてきー！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/876/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScriptで桃鉄っぽいもの作り始めてみた #jsdoit</title>
		<link>http://hiropo.co.uk/archives/871</link>
		<comments>http://hiropo.co.uk/archives/871#comments</comments>
		<pubDate>Thu, 29 Dec 2011 04:25:28 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=871</guid>
		<description><![CDATA[おひさしぶりこです。 最近はProcessingばかりやってました。久しぶりにJavaScriptで何かつくろうと思ったので以前からつくりたかった桃鉄っぽいものつくってみました。 仕組み 2次元配列でマップ作成。 とりあ &#8230; <a href="http://hiropo.co.uk/archives/871">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>おひさしぶりこです。<br />
最近はProcessingばかりやってました。久しぶりにJavaScriptで何かつくろうと思ったので以前からつくりたかった桃鉄っぽいものつくってみました。</p>
<h3>仕組み</h3>
<ul>
<li>2次元配列でマップ作成。</li>
<li>とりあえずコマをマップ上で動かしてみる。</li>
</ul>
<p>あたり判定用と見た目用で配列分けようかとも思いましたが、特に必要ないかなと思い配列マップは1つにまとめました。</p>
<p>ソースはこちらです。<br />
<script type="text/javascript" src="http://jsdo.it/blogparts/gawo/js"></script>
<p class="ttlBpJsdoit" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://jsdo.it/funnythingz/gawo" title="桃鉄っぽいもの。">桃鉄っぽいもの。 &#8211; jsdo.it &#8211; share JavaScript, HTML5 and CSS</a></p>
<p>まだマップは未完成ですが、できたものがこちら。<br />
<script type="text/javascript" src="http://jsdo.it/blogparts/gawo/js?view=design"></script>
<p class="ttlBpJsdoit" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://jsdo.it/funnythingz/gawo" title="桃鉄っぽいもの。">桃鉄っぽいもの。 &#8211; jsdo.it &#8211; share JavaScript, HTML5 and CSS</a></p>
<p>jsdo.it で全部完成できたらいいね！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/871/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScriptのクロージャーでFizzBuzzやってみた</title>
		<link>http://hiropo.co.uk/archives/868</link>
		<comments>http://hiropo.co.uk/archives/868#comments</comments>
		<pubDate>Sat, 03 Dec 2011 03:28:40 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=868</guid>
		<description><![CDATA[こんぬちは、私です。 日常でちょこちょこプログラムは書きますが、脳みそが全然追いついていないため、トレーニングとして基本的なFizzBuzzに挑戦してみました。 言語はいつものJavaScript。 あと最近（今さら）覚 &#8230; <a href="http://hiropo.co.uk/archives/868">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>こんぬちは、私です。</p>
<p>日常でちょこちょこプログラムは書きますが、脳みそが全然追いついていないため、トレーニングとして基本的なFizzBuzzに挑戦してみました。</p>
<p>言語はいつものJavaScript。<br />
あと最近（今さら）覚えたクロージャーを使って書いてみました。</p>
<pre>
var rtn = "";
var fizzBuzz = function(fizz, buzz, max){
    return function(){
        max++;
        if( (max % fizz === 0) &#038;&#038; (max % buzz === 0) ){
            return "FizzBuzz";
        }
        else{
            if( max % fizz === 0 ){
                return "Fizz"
            }
            else if( max % buzz === 0 ){
                return "Buzz";
            }
            else {
                return max;
            }
        }
    }
}

var FizzBuzz = fizzBuzz(3, 5, 0);
var n = 0;
while(n < 20){
    rtn += FizzBuzz() + "\n";
    n++;
}
console.log(rtn);
</pre>
<p>実際やってみたもの<br />
<iframe style="width: 100%; height: 300px" src="http://jsfiddle.net/funnythingz/682W3/15/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>10分くらいでできてしまった…。<br />
簡単だったけど面白かった。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/868/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>田代砲的なもの（DOSアタックで耐久テスト）</title>
		<link>http://hiropo.co.uk/archives/866</link>
		<comments>http://hiropo.co.uk/archives/866#comments</comments>
		<pubDate>Wed, 30 Nov 2011 03:07:19 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=866</guid>
		<description><![CDATA[たまにサイトの耐久テストをやったりするので、2ちゃんねるで有名な田代砲的な（ＤＯＳアタック）ものをブックマークレット用につくってみました。 javascript:(function(){ setInterval(func &#8230; <a href="http://hiropo.co.uk/archives/866">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>たまにサイトの耐久テストをやったりするので、2ちゃんねるで有名な田代砲的な（ＤＯＳアタック）ものをブックマークレット用につくってみました。</p>
<pre>
javascript:(function(){ setInterval(function(){var dd = new Date(); console.log( dd.getUTCHours() + ":" + dd.getUTCMinutes() + ":" + dd.getUTCSeconds() ); location.reload()}, 5000) })();
</pre>
<p>これをブックマークレットに登録して使うと、無限リロードしまくります。<br />
（※良い子は悪用しちゃダメだよ！）</p>
<p>ちなみにChromeなどではある程度実行すると悪意のあるスクリプト（？）とみなされて停止して動かなくなったり・・・。</p>
<p>そんなメモでした。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/866/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ProcessingのVideoライブラリを試してみた</title>
		<link>http://hiropo.co.uk/archives/850</link>
		<comments>http://hiropo.co.uk/archives/850#comments</comments>
		<pubDate>Tue, 29 Nov 2011 17:08:00 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=850</guid>
		<description><![CDATA[Processingネタを1年以上振りに書きます。 もうほとんど触ってもいませんでしたProcessing。 そんなProcessingちゃんを久しぶりにちょこっと書いてみました。 Processingの拡張ライブラリで &#8230; <a href="http://hiropo.co.uk/archives/850">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Processingネタを1年以上振りに書きます。<br />
もうほとんど触ってもいませんでしたProcessing。<br />
そんなProcessingちゃんを久しぶりにちょこっと書いてみました。</p>
<p>Processingの拡張ライブラリでVideoライブラリがあります。<br />
Macの場合、モニタの上部分についてるあのカメラを使ってProcessingにキャプチャ画像を取り込むことができるのです。</p>
<p>まずはカメラを使う準備から。<br />
下記のソースコードでカメラから取り込んだキャプチャをProcessingに渡します。</p>
<pre>
import processing.video.*;

Capture cam;

void setup(){
  size(420, 320);
  cam = new Capture(this, width, height, 15);
}

void captureEvent(Capture cam){
  cam.read();
}

void draw(){
  image(cam, 0, 0);
}
</pre>
<p>そしたらピクセル解析の準備をします。<br />
loadPixels()をセットすることで、pixels[]にピクセルデータを渡します。</p>
<pre>
void draw(){
  image(cam, 0, 0);
  loadPixels();  //ディスプレイウィンドウへピクセルデータをロードします。
}
</pre>
<p>ここからはキャプチャを加工するための関数を定義して読み出します。</p>
<h3>rect版モザイク</h3>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/ca49c20ec8023714493c1e9be7a17703.png"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/ca49c20ec8023714493c1e9be7a17703.png" alt="" title="スクリーンショット 2011-11-29 23.27.21" width="420" height="321" class="alignnone size-full wp-image-853" /></a></p>
<pre>
import processing.video.*;

Capture cam;

void setup(){
  size(420, 320);
  cam = new Capture(this, width, height, 15);
}

void captureEvent(Capture cam){
  cam.read();
}

void draw(){
  image(cam, 0, 0);
  loadPixels();
  mosaic(10, 10);
}

void mosaic(int w, int h){
  for( int y = 0; y < height; y += h ){
  for( int x = 0; x < width; x += w ){
    color c = pixels[ y * width + x ];
    fill(c);
    rect(x, y, w, h);
  }
  }
}
</pre>
<h3>ellipse版モザイク</h3>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/f68ac3e907b52df26b26a45fcb7db787.png"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/f68ac3e907b52df26b26a45fcb7db787.png" alt="" title="スクリーンショット 2011-11-30 0.58.54" width="419" height="322" class="alignnone size-full wp-image-855" /></a></p>
<pre>
import processing.video.*;

Capture cam;

void setup(){
  size(420, 320);
  cam = new Capture(this, width, height, 15);
}

void captureEvent(Capture cam){
  cam.read();
}

void draw(){
  image(cam, 0, 0);
  loadPixels();
  fillMosaic(cam, 10, 10);
}

void fillMosaic(PImage img, int w, int h){
  for( int y = 0; y < height; y += h ){
  for( int x = 0; x < width; x += w ){
    color c = pixels[ y * width + x ];
    fill(c);
    ellipse(x, y, brightness(c)/7.0, brightness(c)/7.0);
  }
  }
}
</pre>
<h3>斬新な何か</h3>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/6c3ad99e87ec9eb07ec8c82902354f8b.png"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/6c3ad99e87ec9eb07ec8c82902354f8b.png" alt="" title="スクリーンショット 2011-11-30 2.00.50" width="418" height="322" class="alignnone size-full wp-image-857" /></a></p>
<pre>
import processing.video.*;

Capture cam;

void setup(){
  size(420, 320);
  cam = new Capture(this, width, height, 15);
}

void captureEvent(Capture cam){
  cam.read();
}

void draw(){
  image(cam, 0, 0);
  loadPixels();
  fractalSolidMosaic(cam, 10, 10);
}

void fractalSolidMosaic(PImage img, int w, int h){
  for( int y = 0; y < height; y += h ){
  for( int x = 0; x < width; x += w ){
    color c = pixels[ y * width + x ];
    fill(c);
    pushMatrix();
    translate(x, y);
    rotate(brightness(c));
    rect(0, 0, brightness(c)/2.0, 2);
    popMatrix();
  }
  }
}
</pre>
<p>実際に動かしてもらった方が面白いと思います。<br />
次回はAR系に挑戦してみようと思います。</p>
<p>[参考記事】<a href="http://yoppa.org/proga10/1353.html" target="_blank">yoppa.org - Processingで画像データを扱う</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/850/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ルンバにルミカライトつけてバルブモードで軌跡を撮ってみた</title>
		<link>http://hiropo.co.uk/archives/804</link>
		<comments>http://hiropo.co.uk/archives/804#comments</comments>
		<pubDate>Thu, 03 Nov 2011 17:45:05 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[ルンバ]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=804</guid>
		<description><![CDATA[ウチです。自宅です。リビングです。 前々からやってみたかったのがルンバの軌跡の撮影。 一眼レフでバルブモードにして長い間露光させておけばシャッターを押してから離すまでの部分を撮影できるのです。これを利用してルンバちゃんの &#8230; <a href="http://hiropo.co.uk/archives/804">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2602.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2602.jpg" alt="" title="IMG_2602" width="600" height="400" class="alignnone size-full wp-image-807" /></a></p>
<p>ウチです。自宅です。リビングです。</p>
<p>前々からやってみたかったのがルンバの軌跡の撮影。<br />
一眼レフでバルブモードにして長い間露光させておけばシャッターを押してから離すまでの部分を撮影できるのです。これを利用してルンバちゃんの軌跡を撮影してみました。</p>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2593.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2593.jpg" alt="" title="IMG_2593" width="600" height="400" class="alignnone size-full wp-image-806" /></a><br />
まずはバルブモードで7分ほど撮影。ちょっと手ブレしちゃった…。</p>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2611.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2611.jpg" alt="" title="IMG_2611" width="600" height="400" class="alignnone size-full wp-image-809" /></a><br />
まっすぐからのスポット掃除。</p>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2589.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2589.jpg" alt="" title="IMG_2589" width="600" height="400" class="alignnone size-full wp-image-805" /></a><br />
どこ行っちゃうのかなー？</p>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2608.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2608.jpg" alt="" title="IMG_2608" width="600" height="400" class="alignnone size-full wp-image-808" /></a><br />
スポットしすぎ。</p>
<p><a href="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2612.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2011/11/IMG_2612.jpg" alt="" title="IMG_2612" width="600" height="400" class="alignnone size-full wp-image-810" /></a><br />
手動操作でいろいろ動かしてみた。</p>
<p>今回は動きを観察して撮影してみましたが、次はリモコンで操作してルンバで描いた写真を共有できたらなと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/804/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

