<?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>SharpLab.</title>
	<atom:link href="http://blog.sharplab.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sharplab.net</link>
	<description>Shiroicaが学び、経験したことを綴る個人サイト。</description>
	<lastBuildDate>Thu, 03 Jun 2010 07:44:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>立った！OpenVPNが立った！</title>
		<link>http://blog.sharplab.net/computer/linux/3405/</link>
		<comments>http://blog.sharplab.net/computer/linux/3405/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 06:28:15 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bridge]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/linux/3405/</guid>
		<description><![CDATA[OpenVPNを、Ubuntu 10.04で立ててみました。この前のクリスマスだったか、OpenVPNのサービスを動かしていたVMをオペミスでESXiのDatastoreごと吹っ飛ばして以来、ずっと止まってしまっていたので、そのリベンジです。Ubuntu 10.04には最新のOpenVPN 2.1のパッケージが入っており、aptitudeで依存関係のあるパッケージもまとめて入れることができます。また、10.04はLTS（Long Time Support）版でもあり、OpenVPNを安定して運用するには便利なディストリとなっていました。
さて、そもそもOpenVPNとは何かというと、その名の通り、オープンソースで開発が進められているVPNデーモンです。L2、L3のどちらでのVPNも提供しています。今回は、L2でのVPNである、bridge接続でのVPNについてを扱います。
まずはネットワーク図をば。
 
今回はこんなネットワークを組みました。自宅のホストにはすべてプライベートアドレスがついていて、ルータのWAN側のポートにのみグローバルIPアドレスがついています。ちなみにアクセス回線はADSL、どこにでもあるような普通のホームネットワークですね。唯一異なっているのは、プライベートアドレスに10.10.0.0/16のサブネットを利用している点。出先のネットワークとなるべく被らないように、という理由です。「10.10.0.0/16は僕のアドレスなので使わないでください！」(笑)というやつです。 OpenVPNのクライアントとなるのはラップトップ。大学やバイト先などから家に接続することを想定しています。この時、ラップトップには有線LANや無線LANのネットワークインターフェイスとは別に、TAPインターフェイスという仮想的なインターフェイスがつき、このインターフェイスの先で直接自宅ネットワークのサブネットに仮想的に接続することになります。図の、点線部分がそれにあたります。10.10/16宛てのパケットはTAPインターフェイスから出ていき、それ以外のパケットは有線LANなり無線LANなりから出ていくというマルチホーム状態を構成しました。
参考までに自分の環境のconf晒し。


#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#  [...]]]></description>
			<content:encoded><![CDATA[<p>OpenVPNを、Ubuntu 10.04で立ててみました。この前のクリスマスだったか、OpenVPNのサービスを動かしていたVMをオペミスでESXiのDatastoreごと吹っ飛ばして以来、ずっと止まってしまっていたので、そのリベンジです。Ubuntu 10.04には最新のOpenVPN 2.1のパッケージが入っており、aptitudeで依存関係のあるパッケージもまとめて入れることができます。また、10.04はLTS（Long Time Support）版でもあり、OpenVPNを安定して運用するには便利なディストリとなっていました。</p>
<p>さて、そもそもOpenVPNとは何かというと、その名の通り、オープンソースで開発が進められているVPNデーモンです。L2、L3のどちらでのVPNも提供しています。今回は、L2でのVPNである、bridge接続でのVPNについてを扱います。</p>
<p>まずはネットワーク図をば。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/06/OpenVPN.png" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="OpenVPN" border="0" alt="OpenVPN" src="http://blog.sharplab.net/wp-content/uploads/2010/06/OpenVPN_thumb.png" width="600" height="441" /></a> </p>
<p>今回はこんなネットワークを組みました。自宅のホストにはすべてプライベートアドレスがついていて、ルータのWAN側のポートにのみグローバルIPアドレスがついています。ちなみにアクセス回線はADSL、どこにでもあるような普通のホームネットワークですね。唯一異なっているのは、プライベートアドレスに10.10.0.0/16のサブネットを利用している点。出先のネットワークとなるべく被らないように、という理由です。「10.10.0.0/16は僕のアドレスなので使わないでください！」(笑)というやつです。 OpenVPNのクライアントとなるのはラップトップ。大学やバイト先などから家に接続することを想定しています。この時、ラップトップには有線LANや無線LANのネットワークインターフェイスとは別に、TAPインターフェイスという仮想的なインターフェイスがつき、このインターフェイスの先で直接自宅ネットワークのサブネットに仮想的に接続することになります。図の、点線部分がそれにあたります。10.10/16宛てのパケットはTAPインターフェイスから出ていき、それ以外のパケットは有線LANなり無線LANなりから出ていくというマルチホーム状態を構成しました。</p>
<p>参考までに自分の環境のconf晒し。</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:fba60543-af8e-4992-8772-d4673bd276c2" class="wlWriterEditableSmartContent">
<pre name="code" class="ruby">#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients &lt;-&gt; one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine &lt;-&gt; single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# This config should work on Windows            #
# or Linux/BSD systems.  Remember on            #
# Windows to quote pathnames and use            #
# double backslashes, e.g.:                     #
# "C:\\Program Files\\OpenVPN\\config\\foo.key" #
#                                               #
# Comments are preceded with '#' or ';'         #
#################################################

# Which local IP address should OpenVPN
# listen on? (optional)
local 10.10.11.4

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap0
;dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node tap0

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca /etc/openvpn/ca.crt
cert /etc/openvpn/ambient.crt
key /etc/openvpn/ambient.key  # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys.
dh dh2048.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
; server 10.8.0.0 255.255.255.0

# Maintain a record of client &lt;-&gt; virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
server-bridge 10.10.11.3 255.255.0.0 10.10.90.1 10.10.90.254

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
push "route 10.10.0.0 255.255.0.0"
;push "route 192.168.10.0 255.255.255.0"
;push "route 192.168.20.0 255.255.255.0"

# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
;cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
user nobody
group nogroup

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
;log-append  openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20

#Autoconfigure scripts
up "./openvpn-startup"
down "./openvpn-shutdown"
</pre>
</div>
<p>&#160;</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:580d7a5a-e486-4e3f-a80c-7a722eddcec7" class="wlWriterEditableSmartContent">
<pre name="code" class="ruby">##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap
;dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node Tap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
;proto tcp
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote im3.sharplab.net 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nogroup

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca ca.crt
cert tpx201s.crt
key tpx201s.key

# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server".  This is an
# important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server".  The build-key-server
# script in the easy-rsa folder will do this.
ns-cert-type server

# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
comp-lzo
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/linux/3405/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hellow GTK+2.0</title>
		<link>http://blog.sharplab.net/computer/linux/3401/</link>
		<comments>http://blog.sharplab.net/computer/linux/3401/#comments</comments>
		<pubDate>Sun, 30 May 2010 16:11:16 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GTK+2]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/linux/3401/</guid>
		<description><![CDATA[
やむにやまれぬ事情でGTKを勉強中です。。とりあえずHello world。右のスクリーンショットはWindowsっぽいですが、テーマをいじっているだけで正真正銘のUbuntu上での表示です。 Hello world表 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/05/Screenshothellogtk.png" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="Screenshot-hello-gtk" border="0" alt="Screenshot-hello-gtk" align="right" src="http://blog.sharplab.net/wp-content/uploads/2010/05/Screenshothellogtk_thumb.png" width="337" height="266" /></a></p>
<p>やむにやまれぬ事情でGTKを勉強中です。。とりあえずHello world。右のスクリーンショットはWindowsっぽいですが、テーマをいじっているだけで正真正銘のUbuntu上での表示です。 Hello world表示するだけでちょこちょこコーディングしなければいけないのがめどい。。デザイナがあるらしいので、使い方を早くマスターしないと。。   </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:98172e55-5f82-4a05-bd33-c63de09f5178" class="wlWriterEditableSmartContent">
<pre name="code" class="c">#include &lt;stdio.h&gt;
#include &lt;gtk/gtk.h&gt;

static gboolean my_delete_event_handler(GtkWidget *widget,
                                        GdkEvent *event,
                                        gpointer data)
{
  g_print("delete!\n");

  return FALSE;
}

static void my_destroy_handler( GtkWidget *widget,
                                gpointer data)
{
  g_print("destry!\n");

  gtk_main_quit();
}

int main(int argc, char *argv[]){

  GtkWidget *window;
  GtkWidget *bbox;
  GtkWidget *button;

  gtk_init(&amp;argc, &amp;argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  bbox = gtk_hbutton_box_new();
  button = gtk_button_new();

  gtk_button_set_label(GTK_BUTTON(button), "Hello GTK!");

  g_signal_connect( G_OBJECT(window), "delete-event",
                    G_CALLBACK(my_delete_event_handler),
                    NULL);

  g_signal_connect( G_OBJECT(window), "destroy",
                    G_CALLBACK(my_destroy_handler),
                    NULL);

  gtk_container_add(GTK_CONTAINER(bbox), button);
  gtk_container_add(GTK_CONTAINER(window), bbox);

  gtk_widget_show_all(window);

  gtk_main();

  return 0;

}
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/linux/3401/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4のTrusted modeでRESTサービス</title>
		<link>http://blog.sharplab.net/computer/cprograming/silverlight/3396/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/silverlight/3396/#comments</comments>
		<pubDate>Tue, 04 May 2010 15:48:51 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/silverlight/3396/</guid>
		<description><![CDATA[厳しいかも。
Silverlight 4で追加されたTrusted mode、とりあえず試してみているのだけど、結構制限が厳しくてつらい感じ。。Cookieは使えないし、GETメソッド使っているときに、headerを追加 [...]]]></description>
			<content:encoded><![CDATA[<p>厳しいかも。</p>
<p>Silverlight 4で追加されたTrusted mode、とりあえず試してみているのだけど、結構制限が厳しくてつらい感じ。。Cookieは使えないし、GETメソッド使っているときに、headerを追加することもできない。これは、SilverlightがHTTP通信のスタックに、OSのTCP/IPスタックを直接たたいているのではなく、ブラウザのPlugin APIを叩いているためだとか。</p>
<blockquote><p>Silverlight only supports setting headers using the POST method not the GET method. This is due to a limitation in how the TCP/IP stack is implemented in Silverlight. It uses the browser extension APIs instead of going directly against the host OS&#8217;s APIs.      <br /><a title="http://stackoverflow.com/questions/622897/how-can-i-set-headers-with-silverlight-get-httpwebrequest" href="http://stackoverflow.com/questions/622897/how-can-i-set-headers-with-silverlight-get-httpwebrequest">http://stackoverflow.com/questions/622897/how-can-i-set-headers-with-silverlight-get-httpwebrequest</a></p>
</blockquote>
<p>この問題を回避する方法としては、@jz5さん曰く、Socketを自分で叩いてHTTP通信すればいい、ということらしい。なんだかなぁ。。Silverlight 4でTrusted Modeをどれぐらい使う需要があるかは知らないけど（自分ならWPF＋ClickOnceでいいや）、<strike>Windows PhoneアプリをSilverlightで書こうか、という場合に結構辛い気が。。WindowsPhoneは微妙に普通のSilverlightとビルディングブロックが違ってるから、案外動くのかもしれないけど（希望的観測）。</strike></p>
<p>(追記) 試しにWindows Phoneでやってみたらheader追加できたｗ 嬉しいんだけど、HttpWebRequestみたいな非常に一般的なクラスでこのように挙動が違うというのは、困るので、正直複雑。何とかならんのか。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/silverlight/3396/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPadよりThinkPad。～ThinkPad Edge、X100e、そしてX201s～</title>
		<link>http://blog.sharplab.net/computer/hardware/3379/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3379/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 14:37:39 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[ThinkPad]]></category>
		<category><![CDATA[ThinkPad Edge]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[X100e]]></category>
		<category><![CDATA[X201s]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/hardware/3379/</guid>
		<description><![CDATA[大分前の話になってしまいましたが、ThinkPad X100eとThinkpad Edge、ありがたいことに発売直後にバイト先でモニター用の貸出機を触る機会に恵まれました。
その時に撮った写真を載せておきます。携帯のカメ [...]]]></description>
			<content:encoded><![CDATA[<p>大分前の話になってしまいましたが、ThinkPad X100eとThinkpad Edge、ありがたいことに発売直後にバイト先でモニター用の貸出機を触る機会に恵まれました。</p>
<p>その時に撮った写真を載せておきます。携帯のカメラなので画質が悪くてすみません。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0002.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0002" border="0" alt="HI3E0002" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0002_thumb.jpg" width="604" height="454" /></a></p>
<p>X100e、11インチのモデルです。ボディの材質が変わったらしいですが、こうして写真をみるとThinkPadはThinkPadですね。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0001.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0001" border="0" alt="HI3E0001" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0001_thumb.jpg" width="604" height="454" /></a></p>
<p>開けた状態。キーボードがThinkPadが従来採用していたタイプではなくアイソレーションキーボードなのが目につきます。ですが、実際触ってみたところ、このサイズにしてはかなり打ちやすいかなと感じました。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0003.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0003" border="0" alt="HI3E0003" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0003_thumb.jpg" width="604" height="454" /></a></p>
<p>そして、赤いThinkPad！赤ですよ赤。ThinkPadといえば黒だと思っていましたが、こうしてみてみると、赤も悪くない、むしろこの思い切りの良さが魅力的です。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0004.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0004" border="0" alt="HI3E0004" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0004_thumb.jpg" width="604" height="454" /></a>     <br />中は流石に赤くないです。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0005.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0005" border="0" alt="HI3E0005" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0005_thumb.jpg" width="604" height="454" /></a>     <br />並べてみた。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0006.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0006" border="0" alt="HI3E0006" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0006_thumb.jpg" width="604" height="454" /></a>     <br />閉じてみた。みなさんはどの色が好きですか？</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0007.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HI3E0007" border="0" alt="HI3E0007" src="http://blog.sharplab.net/wp-content/uploads/2010/04/HI3E0007_thumb.jpg" width="604" height="454" /></a></p>
<p>こちらはThinkPad Edge。こっちは写真をこれしか撮っていないのですが、赤バージョンもあります。</p>
<h3>ねんがんの X201s をてにいれたぞ！</h3>
<p>そして、X201s。こちらは自腹購入。いやー、幸せ夢気分。快適快適。今まで使っていたVAIO Type SZ53Bがそろそろ四年目で限界なので購入してしまいました。。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/P10304461.jpg" rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="P1030446" border="0" alt="P1030446" src="http://blog.sharplab.net/wp-content/uploads/2010/04/P1030446_thumb1.jpg" width="604" height="454" /></a>     <br />去年の夏頃からずっと買い換えたいなぁと思いながら「Windows 7が出るまで待つ！」とか「Core i系に切り替わるまで待つ！」と必死に我慢していたのですが、先月Core i7のX201sが出たので18%OFFキャンペーン時に勢いに任せて買ってしまいました。。本体が大体１５万円程、その他には拡張保証をつけたりなどでした。まぁ、待っている間にだいぶ貯金は出来ていたので、なんとか。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/P10304431.jpg" rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="P1030443" border="0" alt="P1030443" src="http://blog.sharplab.net/wp-content/uploads/2010/04/P1030443_thumb1.jpg" width="604" height="454" /></a>     <br />閉じたときの外観。でこぼこのない、のっぺりした天板。マットな質感が凄く良いですね。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/P10304521.jpg" rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="P1030452" border="0" alt="P1030452" src="http://blog.sharplab.net/wp-content/uploads/2010/04/P1030452_thumb1.jpg" width="604" height="454" /></a></p>
<p>パームレストにはi7とWindows 7のロゴが光ります。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/P10304411.jpg" rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="P1030441" border="0" alt="P1030441" src="http://blog.sharplab.net/wp-content/uploads/2010/04/P1030441_thumb1.jpg" width="604" height="454" /></a>     <br />ACアダプタ。小さい！これは嬉しい。ただ、大学の研究室にはThinkPadのACアダプタが結構転がっているし、バッテリのもちは良いしで、ThinkPadの場合、そもそもACアダプタを持ち歩かなくても結構何とかなったり(笑) </p>
</p>
<h3>使用感とか</h3>
<p>最高です。キーボードは打ちやすいし、Trackpointは便利だし、バッテリは持つし、軽いし、解像度は高いし、何より速い。。どのぐらい速いって、シームレスモードのVirtualBox上でUbuntuがスムーズに動くぐらい(笑) Windowsをやめる気はさらさらないのですが、何かとUNIX環境が手元にあると便利なことも多いので、VirtualBox+Ubuntuが手元で動くというのは有り難いものです。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/image3.png" rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2010/04/image_thumb3.png" width="604" height="379" /></a>     <br />テキストモードで動かしておければ良いよねーと思っていたのですが、まさかGNOMEがストレスなく動くとは。もう、何がなんだかわかりません。。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/04/image2.png" rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2010/04/image_thumb2.png" width="604" height="379" /></a>     <br />WPFで全面的に作り直されたVisualStudio 2010もちゃんと動きます。先代のラップトップでBeta版を動かしたときは非常にもっさりしていて、買い替えを決意した一つの要因なのでした。これで生きていけます(笑)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3379/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ラップトップをSSDに換装してみた。</title>
		<link>http://blog.sharplab.net/computer/hardware/3336/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3336/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 17:48:41 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[SSD]]></category>
		<category><![CDATA[VAIO]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/hardware/3336/</guid>
		<description><![CDATA[買ってしまいましたSSD。ホントはSSDを買うつもりはなく、ラップトップごと買い換えたいと思っていたのですが、目をつけていたThinkPadのXシリーズがこの前のCESでモデルチェンジしてくれなかったので、最低でも春まで [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/01/image1.png" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blog.sharplab.net/wp-content/uploads/2010/01/image_thumb1.png" width="244" height="184" /></a>買ってしまいましたSSD。ホントはSSDを買うつもりはなく、ラップトップごと買い換えたいと思っていたのですが、目をつけていたThinkPadのXシリーズがこの前のCESでモデルチェンジしてくれなかったので、最低でも春までは今のラップトップで生活することになりそうなので現行のVAIO（SZ53B）をSSD化して延命することにしました。ThinkPad買った際にはそちらに載せ替える腹積もりです。</p>
<p>で、今回買ったのは<a href="http://kakaku.com/item/K0000036303/">OCZSSD2-1SUM120G</a>という製品です。SSDなら鉄板といわれるIntelや東芝（IO-DATA）も考えたのですが、Intelは自分が欲しいと思った120GB帯の製品が存在しないこと、東芝はちょっと値段が高めなため、kakaku.comでみたところ安く出ていたOCZのSSDとしました。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2010/01/image2.png" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="left" src="http://blog.sharplab.net/wp-content/uploads/2010/01/image_thumb2.png" width="244" height="211" /></a>で、アプリのインストールやデータのリストア作業など常用環境を整えた後でとったベンチ結果。公称値はやはり出ませんが、5400rpmの2.5inch HDDで暮らしてきた身には驚異的な数字です。特にランダムアクセス時の性能の良さは実に心強いです。</p>
<h3>どんな時にSSD化の恩恵にあずかれるのか</h3>
</p>
<p><strong>殆どあらゆる場面で。</strong>まずOSのインストールからして速い速い。Windows 7の新規インストールが大体20分ほどで完了。アプリケーションのインストールも含めても同様で、今までならOSを再セットアップして環境を再構築するのにほぼ丸一日かかっていたのが、五時間ほどで完了させることができました。勿論SSD化の恩寵の与えられる範囲はセットアップ時だけに限らず、日常利用でも同様です。まずスリープ。今のラップトップは4(3)GBメモリを積んでいますが、4秒でスリープします。シャットダウンも12秒ほどで完了します。これは、VisualStudioやらFirefoxやらTweetDeckを立ち上げた状態からでです。これまではスリープに軽く20秒以上かかっていたので、本当に目を疑いましたｗ そしてアプリも速いです。VS2008がちょっと高機能なテキストエディタかのようにサッと立ち上がるのには笑うしかありませんｗ アプリの中でも一番使い勝手が向上したのがキャッシュを大量に作っているであろうRSSリーダー。自分はFeedDemonというGoogleReaderのクライアントを使っているのですが、HDD時代はページング時などにイチイチもっさりしていたこのアプリも信じがたいほど速くなりました。</p>
<p>待たされるのはストレスです。ちょっとした時間でもそれが積み重なると大きなストレスになります。そのためにどのハードウェアメーカーも速いCPU、大量のメモリ量を追求し、ソフトウェアベンダは実装を効率化し、それでもどうしようもない待ち時間に関しては待ち時間をそれと意識させないような工夫をあらゆるところに盛り込みます。最近自分はそういった実装の上手いAppleの出しているMacやiPod Touchを使うことが多く、その工夫には本当によく感心させられ、学ぶところが多いのですが、一方で、SSDのように絶対的に、圧倒的に時間を削減する技術のもたらすインパクトも凄まじいなと感じる次第です。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3336/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>第二回プログラミング生放送勉強会行ってきました。</title>
		<link>http://blog.sharplab.net/computer/cprograming/3295/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/3295/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 04:23:11 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[C#Programing]]></category>
		<category><![CDATA[Gainer]]></category>
		<category><![CDATA[Pivot]]></category>
		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/3295/</guid>
		<description><![CDATA[昨日開催された、 プログラミング生放送勉強会 第2回 ＠新宿に行ってきました。ニコニコ生放送のプログラミング関係のオフ会ということなのですが、自分はそれまでニコニコ生放送というものを見たことがなかったので、若干どんなノリ [...]]]></description>
			<content:encoded><![CDATA[<p>昨日開催された、 <a href="http://co9320.spaces.live.com/blog/cns!F8FA3BD6ABDDDB63!224.entry">プログラミング生放送勉強会 第2回 ＠新宿</a>に行ってきました。ニコニコ生放送のプログラミング関係のオフ会ということなのですが、自分はそれまでニコニコ生放送というものを見たことがなかったので、若干どんなノリの会なのか分からずに行ったのですが、まぁ、わんくま勉強会と似たようなノリで、楽しんで帰ることができました。やはり、動画でセッションの模様を中継でき、それに対する反応がネットの向こう側で観ている側から帰ってくるというインタラクションは大変面白いですね。ただ、帰ってくる反応も、ニコニコ動画のカルチャーに影響されているところがあり、もっとフォーマルなイベントで公式に使うのは難しいだろうなということも身をもって感じました。</p>
<p>さて肝心の内容。色々面白い話が多かったですが、.NET好きという自分の性格も手伝って、Live Labs Pivotの紹介話とXBox LIVE インディーズゲーム製作苦労話、Gainer紹介といくつかのLTが特に面白かったです。</p>
<p>Live Labs Pivotは、事前に名前しか知らずに行ったのですが、あれはある形式に則ったデータを食わせたら、それをSeaDragonテクノロジ他を使って綺麗に整理して見せるデモアプリケーションというイメージで良いんでしょうか。インビテーションを取得するのが手間そうなので実際に使ったわけでないのですが、デモを見る限りWPFで実装されているのかな？いつかLive wave xでWindows LiveやBingのオプション機能として、このようなインターフェイスがSiverlightを使って実装されて欲しいものです。</p>
<p>XBox LIVE インディーズゲームの話は、XBox LIVE インディーズゲームを実際に製作されている方が、製作にあたっての技術的でない苦労点を語ったセッションでした。やっぱり、家庭用ゲームコンソールで動くゲームを作って販売できるというのは大変魅力的な話のようですが、それに見合った苦労もされていうようで、iPhoneアプリ同様アメリカへの税金払い方の話だとか、表現の規制に関する話だとか、インターフェイスに使う言語の話だとか。表現の規制の話は、まぁ家庭用ゲーム機なら控えめにならざるを得ないというのはよくわかる話だったのですが、ゲームのインターフェイスに使われる言語に、日本向けのゲームにアルファベットが使われているだけで外国人からピアレビューで差し戻しを受けて直さざるを得なかったというのは、どう考えても運営方針が間違っているような。。まだ始まったばかりの仕組みなので運営側も試行錯誤している段階なのでしょうが、聞いている限りだと、製作者と運営側のコミュニケーションロスによる問題のような気も。やっぱり海外で作られているスキームを使う場合には、こちらも交渉できるだけの英語力が求められるのだなぁと勝手に納得してました。</p>
<p>Gainer。イケメンのための雑誌の方じゃないよ、電子工作の方だよ、というギャグほか、スピーカーの方のしゃべりの上手さに大いに笑わせてもらったセッションでした。Gainer、面白そうですね。なんちゃって理系ですらないSFCでぼんやり過ごしていると、電子工作方面への知識が全く欠けているのですが、Gainerは自分みたいな高級言語ばっかり触っている人間が電子工作始めるのに最適なおもちゃだということがよく分かりました。PCの中に立てたローカルなサーバーを叩いてやるだけでいいというのは非常に手軽ですね。。近いうちに買いたいと思います。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020471.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="P1020471" border="0" alt="P1020471" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020471_thumb.jpg" width="324" height="244" /></a>そいういえば場所はMicrosoftの新宿オフィスのセッションルームの一室だったのですが、新宿のサザンテラス口側は結構イルミネーションが綺麗なんですね。向かいの高島屋や紀伊国屋側も綺麗ですし。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/3295/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Express 5800/S70が来た！</title>
		<link>http://blog.sharplab.net/computer/hardware/3290/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3290/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 13:06:47 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Express 5800/S70]]></category>
		<category><![CDATA[FreeNAS]]></category>
		<category><![CDATA[InstallManiax]]></category>
		<category><![CDATA[openfiler]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/uncategorized/3290/</guid>
		<description><![CDATA[先日申し込んでいたインストールマニアックス3 Hyper-V祭り、ありがたいことに当選しまして参加できることになり、昨日の朝、NEC Express 5800/S70が家に届きました。インストールマニアックスとは、
Wi [...]]]></description>
			<content:encoded><![CDATA[<p>先日申し込んでいた<a title="http://www.thinkit.co.jp/maniax/3/index.html" href="http://www.thinkit.co.jp/maniax/3/index.html">インストールマニアックス3 Hyper-V祭り</a>、ありがたいことに当選しまして参加できることになり、昨日の朝、NEC Express 5800/S70が家に届きました。インストールマニアックスとは、</p>
<blockquote><p>WindowsサーバーにOSSをいくつインストールできるかを競うコンテストです。参加者は、無償で提供されたサーバーハードウェアとOSを使い、Windows+IISを使用してできるだけ多くのソフトウェアインストールを行い、その評価点を競います。</p>
</blockquote>
<p>というイベントです。Windows Web Server 2008 R2とOSSの親和性の高さをプロモーションしたいということなんでしょうね。ハードウェアはそのまま頂けるという話なので、こちらとしてもこのようなイベントは嬉しい限りです。こちらが届いたマシン：</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020451.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020451" border="0" alt="P1020451" src="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020451_thumb.jpg" width="484" height="364" /></a></p>
<p>今回のインストールマニアックスは、Hyper-Vで仮想化した環境上でWindows Web Serverを動かせ、という条件付きなので、それに合わせて配布されるハードウェアも大盤振る舞いで、CPUはIntel Core2 Duo CPU E7400 @ 2.80GHz、メモリは2GBという構成。</p>
<p>というわけで早速開腹作業。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020454.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020454" border="0" alt="P1020454" src="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020454_thumb.jpg" width="484" height="364" /></a></p>
<p>このマシンのために前日買っておいた1TBのHDDの増設をしました。このイベントで使う分には元々積まれていた分で多分十分なのですが、ちょっとWindows Web Serverをインストールする前にやりたいことがありまして。。それはESXi ServerのDatastoreとしている<a href="http://nttxstore.jp/_II_P812921544">Express 5800/110a</a>のメンテ。110aは1TBのHDDを増設したうえでFreeNASを入れ、iSCSIターゲットサーバーとしてESXi ServerのDatastoreとして動かしているものなのですが、どうも大量にファイルアクセスしたときに落ちたり、Windowsファイル共有の転送速度が思うように上がらなかったりするので、openfilerにOSを入れ替えようと考えており、一時的にVMのイメージを退避する為に今回届いたS70を使うことにしました。というわけでopenfilerをインストール。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020462.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020462" border="0" alt="P1020462" src="http://blog.sharplab.net/wp-content/uploads/2009/12/P1020462_thumb.jpg" width="304" height="229" /></a><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/12/image.png" width="304" height="184" /></p>
<p>うん、いい感じ。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3290/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>めっきり投稿が減りましたが、、、</title>
		<link>http://blog.sharplab.net/computer/blog/3280/</link>
		<comments>http://blog.sharplab.net/computer/blog/3280/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 14:11:00 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/blog/3280/</guid>
		<description><![CDATA[生きてます。
なんだかんだ言って、やっぱり投稿が減った原因はTwitterですね。。Twitterの方が、圧倒的に書くのが手軽だし、何か書いた時に貰えるレスポンスが多いし、でBlogをサボってしまっています。良くないです [...]]]></description>
			<content:encoded><![CDATA[<p>生きてます。</p>
<p>なんだかんだ言って、やっぱり投稿が減った原因はTwitterですね。。Twitterの方が、圧倒的に書くのが手軽だし、何か書いた時に貰えるレスポンスが多いし、でBlogをサボってしまっています。良くないですね。別にTwitterで良いじゃん、Blog書かないでも、という考え方もあるのでしょうが、やっぱり良くないと自分は感じていて、というのは、やはり、Twitterというサービスは、Blog以上にリアルタイムのストリーム的な特性が強く、Tweetの内容が、その時自分をフォローしてくれている人にしか届かず、後からその情報を求めてGoogleなどで検索した人に上手く届けることができないのが問題だと思っています。これは、Twitterのサイト構造が、古いTweetを積極的に見せようとしていないということ以上に、140文字という文字数制限が、Tweetのコンテキストを削ぎ落としてしまっており、検索に引っかかりにくくなっているというのがあります。ぼちぼちまた書いて行きたいなぁと思っています。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/blog/3280/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自宅ネットワークのトポロジ図</title>
		<link>http://blog.sharplab.net/computer/hardware/3277/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3277/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 03:22:34 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[GS2108A]]></category>
		<category><![CDATA[gt110a]]></category>
		<category><![CDATA[Network]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/hardware/3277/</guid>
		<description><![CDATA[大学の授業で自宅のネットワークのトポロジ図を書けという課題が出たので、Visioの試用版を使い、見よう見まねで書いてみました。ちゃんとした書き方は教わっておらず、「思うように書け」ということだったので、おかしなところも多 [...]]]></description>
			<content:encoded><![CDATA[<p>大学の授業で自宅のネットワークのトポロジ図を書けという課題が出たので、Visioの試用版を使い、見よう見まねで書いてみました。ちゃんとした書き方は教わっておらず、「思うように書け」ということだったので、おかしなところも多いでしょうが。。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/10/a3c096caf42c.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="家ネットワークトポロジ図" border="0" alt="家ネットワークトポロジ図" src="http://blog.sharplab.net/wp-content/uploads/2009/10/thumb.png" width="614" height="436" /></a>&#160;&#160; <br />こうしてみると、結構充実してますね。。 ここ一年ぐらい、自室の機器の増設にバイト代のかなりを注いでいて、気がついたこんな状態でした。</p>
<p>最近の変更としては、FreeNASを入れた<a href="http://nttxstore.jp/_II_P812921544">NEC Express5800/GT110a</a>を追加し、iSCSI Targetとして動かし始めたことでしょうか。また、それにあわせてGbE対応スイッチを無線イーサネットコンバータの下に設置し、自室内での通信をギガビット化しました。<a href="http://nttxstore.jp/_II_P812921544">NEC Express5800/GT110a</a>は、NEC製の激安PCサーバー。ほんと安いですねぇ、一万円台とは。NICがGbEに対応しているファイルサーバーが必要だっただけなので、これで十分です。これを買うに当たっては、ML115にも心惹かれたのですが、その時たまたまNTT-Xで品切れだったことから、今回は見送り（泣）。とまれ、これに1TBのHDD*2をRAID1を組むために増設し、FreeNAS 7.0RC1を入れれば立派なiSCSI Targetの出来上がりです。ZFSもサポートされているので、よくZFSはわかっていないのですが、使ってみています。</p>
<p>FreeNASでiSCSIターゲットを作って何に使っているかというと、先日構築したVMware ESXiのDataStoreとしています。VMware ESXiはハイパーバイザ方式で動作が軽いので、ついついVMを追加してしまうのですが、そうやってVMをたくさん作っていると、あっという間にHDDが食いつぶされていきます。もともと500GBのHDDを内蔵させて自作したマシンなのですが、ケースがShuttleのCube型ベアボーンなので、HDDを増設する余裕がありません。そこで、熱源を少しでも外に出す意味でも、またRAIDを組むためにも作ってみました。</p>
<p>ちなみにGbE対応スイッチは、NETGEARの<a href="http://nttxstore.jp/_IIUL_NG12201818_goorct_goorct">GS2108A</a>。折角iSCSI Targetを構築したのに、100BASE-TXでリンクアップしているのでは、USB接続のドライブにも劣る！ということで購入。金属筐体の方が良いとは聞きますが、8portで\4000切ってますし、三年保証さえついているので、アタリだったかなと考えています。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3277/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 7 WHOPPER食べてきました。。</title>
		<link>http://blog.sharplab.net/life/diary/3274/</link>
		<comments>http://blog.sharplab.net/life/diary/3274/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 04:57:01 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Diary]]></category>
		<category><![CDATA[BURGER KING]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows 7 WHOPPER]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/life/diary/3274/</guid>
		<description><![CDATA[
Windows 7発売記念プロモーションの一環としてBURGER KINGから期間限定で発売されたWindows 7 WHOPPER食べてきました。
これ、隣に置いてあるのiPod Touchなんだぜ…。どんだけ大きい [...]]]></description>
			<content:encoded><![CDATA[</p>
<p>Windows 7発売記念プロモーションの一環として<a href="http://www.burgerkingjapan.co.jp/news/win7.php">BURGER KINGから期間限定で発売されたWindows 7 WHOPPER</a>食べてきました。</p>
<p>これ、隣に置いてあるのiPod Touchなんだぜ…。どんだけ大きいんだ。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/10/img_001.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMAGE_332.JPG" border="0" alt="IMAGE_332.JPG" src="http://blog.sharplab.net/wp-content/uploads/2009/10/img_001_thumb.jpg" width="614" height="462" /></a> </p>
<p>完食した自分偉い。よく頑張った。。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/life/diary/3274/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>E30HT</title>
		<link>http://blog.sharplab.net/computer/hardware/3270/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3270/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 16:36:35 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Windows Mobile]]></category>
		<category><![CDATA[E30HT]]></category>
		<category><![CDATA[Touch Diamond]]></category>
		<category><![CDATA[Touch Pro]]></category>
		<category><![CDATA[WindowsMobile]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/hardware/3270/</guid>
		<description><![CDATA[研究室にAU初のスマートフォン、E30HTが届きました。いわゆるTouch Pro。なんかのプロジェクトで使う端末らしいです。折角なので姉妹機である自分のTouch Diamondと並べてみました。
 
Touch Pr [...]]]></description>
			<content:encoded><![CDATA[<p>研究室にAU初のスマートフォン、E30HTが届きました。いわゆるTouch Pro。なんかのプロジェクトで使う端末らしいです。折角なので姉妹機である自分のTouch Diamondと並べてみました。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/10/091005_150201.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="091005_1502~01" border="0" alt="091005_1502~01" src="http://blog.sharplab.net/wp-content/uploads/2009/10/091005_150201_thumb.jpg" width="404" height="244" /></a> <a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/10/091005_150801.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="091005_1508~01" border="0" alt="091005_1508~01" src="http://blog.sharplab.net/wp-content/uploads/2009/10/091005_150801_thumb.jpg" width="404" height="244" /></a></p>
<p>Touch Proのキーボードがある側だけでTouch Diamondと同じ厚みがある。。まぁ、Touch Diamondが薄くて良い端末だと信じることにします（ぇ</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3270/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPod Touch買いました。</title>
		<link>http://blog.sharplab.net/computer/hardware/3265/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3265/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 16:22:11 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Byline]]></category>
		<category><![CDATA[iPod Touch]]></category>
		<category><![CDATA[WindowsMobile]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/hardware/3265/</guid>
		<description><![CDATA[ 良い良いと巷で人気のiPhone/iPod Touch。いったいどれほどのものかということで、つい新iPod Touch 32GB買ってしまいました。いやホント良いですねコレ。Windows Mobileのもっさり感に [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/10/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/10/image_thumb.png" width="218" height="278" /></a> 良い良いと巷で人気のiPhone/iPod Touch。いったいどれほどのものかということで、つい新iPod Touch 32GB買ってしまいました。いやホント良いですねコレ。Windows Mobileのもっさり感に慣らされた身としては、どうしてこれほどヌルヌルUIが反応するのか不思議でなりません。これがGPUのサポートの威力なのでしょうか。。</p>
<p>本当に生活スタイルを変化させるシロモノで、移動中はほぼiPod Touchを弄っています。様々なアプリの中でも、一番気に入っているのはBylineというRSSリーダー。Google Readerと同期が可能なRSSリーダーで、エントリのパーマリンクが紐付けられたページのキャッシングにも対応しているタイプのものです。朝、家を出るまでにWifiにぶら下がって新着のエントリをダウンロードしておき、通学中にバシバシRSSの消化を行い、大学に着いたら、同じくGoogle Readerと同期させているFeed DemonというRSSリーダーで残りや、詳しく読み込む必要のあるエントリを消化するというサイクルを確立することが出来ました。</p>
<p>一応E-Mobile版Touch Diamondの方にはWifi Routerという、Windows Mobile端末を無線LANのAP化するアプリを入れ、移動中もネットが使えるようにしているので、カメラがない以外はiPhoneっぽいことが出来るようにしているので中々快適です。</p>
<p>ただ、不満もないわけではなく、例えば、マルチタスクをサポートしていないのは残念な点です。上でBylineのキャッシングについて述べましたが、Bylineがキャッシュを作成している間にも、並行して他のアプリにキャッシュを作らせるというようなことが出来ないのが不便です。Bylineの同期作業が終わるのを待って、GNReaderなり、他のアプリを起動しなければならないわけですから。この点では、Androidの方が自分の好みに合ったつくりになっていると聞いているので、期待したいものです。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3265/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XREAのサーバーに設置したWordPressを自動バックアップする環境を整える</title>
		<link>http://blog.sharplab.net/computer/wordpress/3259/</link>
		<comments>http://blog.sharplab.net/computer/wordpress/3259/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 13:35:35 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CoreServer]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[pdumpfs]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[XREA]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/wordpress/3259/</guid>
		<description><![CDATA[みんな大好きWordPress。だからこそ、データが飛んでしまうのはなんとしても避けたいもの。そのためには、常日頃からデータのバックアップを取っておくのが重要なのですが、いちいち手動でバックアップするのは手間なので、なる [...]]]></description>
			<content:encoded><![CDATA[<p>みんな大好きWordPress。だからこそ、データが飛んでしまうのはなんとしても避けたいもの。そのためには、常日頃からデータのバックアップを取っておくのが重要なのですが、いちいち手動でバックアップするのは手間なので、なるべく自動化しておきたいものです。バックアップしたいのは次の二つ：アップロードしたファイルとMySQLのダンプ。そこで、UNIX環境の勉強がてら、今このブログが設置されているXREAのサーバーから、ローカルに立てたサーバへ自動的にバックアップする体制を整えてみることにしました。今回のエントリではその方法をまとめてみました。</p>
<h3>処理の流れ</h3>
<p>今回XREAのサーバーに設置したWordPressのデータをバックアップするにあたっては、まず、XREAのサーバー側で、MySQLのデータをダンプし、圧縮をかけてファイルとして保存する、という処理を行います。その上で、ローカル側に設置したサーバーで、ryncという差分コピー可能なコマンドをつかい、SSHを通じてサーバーからMySQLのダンプしたデータや、アップロードした画像、WordPressの本体やプラグイン、テーマをひっくるめて同期します（Pull）。そして同期したディレクトリを元に、pdumpfsを使い世代別バックアップを作成します。この処理をcronで毎日実行してやるという流れです。</p>
<p>このように今回はcronやrsyncを使うために、ローカル側に、毎日その時間に起きているUNIXなマシンが必要になります。そのため今回のエントリは、ファイルサーバーにするなどで自宅サーバーを運用している人以外にはハードルが高いかも知れません。ただ、起きっぱなしのサーバーが家に一台あれば、前述のようにファイルサーバーに出来るなど何かと便利ですので、これを機に、自宅サーバー構築に手を出してみるのもおススメです:D 遊んでいるマシンがあるなら、それにLinuxを入れてしまうとか、遊んでいなくても常時起こしておけるWindowsマシンがあれば、VirtualBoxを入れてその中でLinuxを動かすとか、色々方法はあります。</p>
<h3>バックアップ手順</h3>
<p>まずは下ごしらえ。ローカルのサーバーからリモートのサーバー（XREA）に対して操作を行うわけですが、そのためにはSSHで接続できるようにしなければなりません。XREAへのSSHでの接続については、<a href="http://another.maple4ever.net/archives/32/">こちらのhiromasaさんの記事</a>を参照。但し、今回は、バックアップの自動化が目的なので、そのプロセスで手動でのパスワードの入力を求められるのは困るので、パスフレーズを空にした鍵による公開鍵認証を使います。ssh-keygenを使ってローカルのサーバーで鍵ペアを作り、公開鍵をリモートのサーバー（XREA）に配置しましょう。鍵ペアの作り方については<a href="http://www.turbolinux.co.jp/support/document/knowledge/152.html">ssh にてパスワードを使用しないでログインする方法</a>を参照。</p>
<p>次にMySQLのダンプと圧縮。と言っても、難しいことは何もありません。これについてもhiromasaさんが既に<a href="http://another.maple4ever.net/archives/445/">サーバー側のcronで定期的にMySQLをダンプする方法についての記事</a>を書かれています。これを使わせてもらいましょう。今回は、pdumpfsで世代別バックアップを取っているので、日付別に保存しないように改変したものを以下に示します。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:e944ef81-0ac6-4f4d-825d-cf3296f44fac" class="wlWriterEditableSmartContent">
<pre name="code" class="py">#!/bin/sh

# 設定(ここを自分に合わせる)
DATABASE=
DBUSERNAME=
PASSWORD=
XREAUSERNAME=
BACKUPDIR=
KEEPDAY=14

# 初期化(XREA/CORESERVER用)
PREFIX=mysql
SERVER=localhost
NOWDATE=`date +%Y%m%d`
DESTDIR=/virtual/$XREAUSERNAME/$BACKUPDIR
# DUMPFILE=$PREFIX.$NOWDATE.dump
DUMPFILE=$PREFIX.dump
# TARFILE=$PREFIX.$NOWDATE.tar.gz
TARFILE=$PREFIX.tar.gz
OLDDATE=`date "-d$KEEPDAY days ago" +%Y%m%d`

# MySQLダンプ/圧縮
cd $DESTDIR
/usr/local/mysql/bin/mysqldump $DATABASE --host=$SERVER -u $DBUSERNAME --password=$PASSWORD &gt; $DUMPFILE
tar zcvf $TARFILE $DUMPFILE

# 処理判定
if [ $? != 0 -o ! -e $TARFILE ]; then
    echo "backup faild -- ($DUMPFILE)"
    exit 1
fi

# 圧縮前ファイル削除
rm -f $DUMPFILE

# n日ローテートを削除
#rmfile=$DESTDIR/$PREFIX.$OLDDATE.tar.gz
#if [ -e $rmfile ]; then
#    rm -f $rmfile
#fi</pre>
</div>
<p>cronの設定をしない以外は、記事の通りにXREAのサーバーに配置し、設定を書き換えてやれば大丈夫です。では、試しにSSHを通じてコマンドを発行し動かしてみましょう。ローカルのサーバーで以下のコマンドを実行してみましょう。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:0ec4eb0b-f11a-489f-8ea5-caced06ff28f" class="wlWriterEditableSmartContent">
<pre name="code" class="ruby">ssh -i &lt;秘密鍵へのパス&gt; &lt;XREAのユーザー名&gt;@&lt;サーバ名&gt; &lt;hiromasaさん製スクリプトへのパス&gt;

#ウチの環境だと以下のようになります。
ssh -i ./nopass sharplab@s333.xrea.com /virtual/sharplab/backup-mysql/mysqlbackup.sh</pre>
</div>
<p>動きましたか？動かない？SSHの接続が拒否された？それはもしかすると、XREAのサーバーにホスト情報を登録し忘れているせいかもしれません。hiromasaさんの先ほどの記事を参考に登録を行ってみましょう。</p>
<p>さて、とりあえず手動で登録すればよいことは分かりましたが、登録の有効期限は30日間だけに限られています。また、出先でSSHで繋ぐために別のIPアドレスを登録した場合、上書きされてしまい、再度登録しないと繋がらなくなってしまいます。そのため、ホスト情報の登録も自動化する必要があります。そこでこんなスクリプトをPythonで書いてみました。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:389ef65b-4ea6-402e-806f-c66c9f46df84" class="wlWriterEditableSmartContent">
<pre name="code" class="py">#!/usr/bin/env python
# vim:fileencoding=utf_8
import sys
import urllib
import re

#ここを書き換えてください
server = ''
username = ''
password = ''
ipaddressResponder = ''#'http://scripts.sharplab.net/ipaddress.php'//←ウチの場合

adminURL = 'http://%s/jp/admin.cgi' % server

try:
	ipRes = urllib.urlopen(ipaddressResponder)
	ipaddress = ipRes.read()
except:
	print u'Failed'
	sys.exit()

pattern = re.compile('\d+\.\d+\.\d+\.\d+')
if pattern.match(ipaddress) == None:
	print u'Failed'
	sys.exit();

values = {'id':username, 'pass':password,'remote_host':ipaddress,'ssh2':'SSH登録'}
data = urllib.urlencode(values)
print u'Registing ipaddress(%s)...'  % ipaddress
response = urllib.urlopen(adminURL,data)
try:
	response.read().decode('shift_jis').index(u'データベースに追加しました。反映には５〜１０分程度掛かります。')
	print u'Complete!'
except ValueError:
	print u'Failed.'
</pre>
</div>
<p>まず、前もって接続してきたホストのIPを返すPHPのページをサーバーに設置し（ipaddressResponder）、そこにアクセスすることでホストのIPアドレスを調べています。PHPのページのソースはこう。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:37dc2061-26d5-425f-8089-1229e92a5e02" class="wlWriterEditableSmartContent">
<pre name="code" class="php">&lt;?php
echo getenv("REMOTE_ADDR");
?&gt;
</pre>
</div>
<p>その上で、調べたホストのIPとユーザー名、パスワードをホストの登録ページにPOSTするだけの簡単なお仕事です。Cookieとか憶えないといけないかなと思ってPython Mechanize使おうとしたのですが、必要なかったです(笑) </p>
<p>さて、ここまでで、SSHを通してサーバー側でMySQLをダンプする処理と、SSHのためにホストを自動登録するスクリプトの準備が出来ました。では次はいよいよ本題、rsyncによるファイルのバックアップです。rsyncによるリモートバックアップは、リモートとSSHで繋げ、リモートにもrsyncが入っていれば使えると記憶していますが、XREAはどちらも満たしています。他のレンタルサーバーでも、SSHで繋げるところなら使えるところはあるかと思います。</p>
<p>ではrsyncのコマンドを。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:d5ba4190-4bdb-4748-8613-d3ee421ad28d" class="wlWriterEditableSmartContent">
<pre name="code" class="c">&lt;rsyncへのパス&gt; -avz --delete -e 'ssh -i &lt;秘密鍵へのパス&gt;' &lt;XREAのユーザー名&gt;@&lt;サーバー名&gt;.xrea.com:&lt;バックアップしたいディレクトリへのパス&gt; &lt;同期先へのパス&gt;

#ウチの環境だと以下のようになります
./rsync/rsync -avz --delete -e 'ssh -i ./nopass' sharplab@s333.xrea.com:/virtual/sharplab/ ./sharplab/workspace
</pre>
</div>
<p>これでXREAのサーバーとローカルのサーバーの中身を同期させられます。rsyncは更新のあった差分のみをやり取りするので二度目以降は効率が上がるのが嬉しいですね！</p>
<p>そしてpdumpfs。同期したフォルダをソースに、世代別バックアップを作ってやります。pdumpfsはハードリンクを活用しているので、毎日世代別バックアップを取っても、更新がかかったファイル分位しか必要とする領域が増えないので使うのに気が楽ですね。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5bbccc4f-913d-4115-b4ba-37582cdf0264" class="wlWriterEditableSmartContent">
<pre name="code" class="sql">pdumpfs &lt;ソースディレクトリ&gt; &lt;バックアップ先ディレクトリ&gt;

//ウチの環境だと以下のようになります
pdumpfs ./sharplab/workspace/ ./sharplab/backup/
</pre>
</div>
<p>ではこれらをまとめた上でcronに登録してみましょう。<br />
  <br />まずバックアップ処理手順をまとめたスクリプトを作成します。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:e0bde101-da72-402b-a64f-3e80bcfc4992" class="wlWriterEditableSmartContent">
<pre name="code" class="c">#サーバーに配置したMySQLのダンプ＆圧縮スクリプトを起動
ssh -i &lt;秘密鍵へのパス&gt; &lt;XREAのユーザー名&gt;@&lt;XREAのサーバー名&gt;.xrea.com &lt;hiromasaさん作のスクリプトへのパス&gt;
#サーバー全体をworkspaceディレクトリと同期
&lt;rsyncへのパス&gt;/rsync -avz --delete -e 'ssh -i &lt;秘密鍵へのパス&gt;' &lt;XREAのユーザー名&gt;@&lt;XREAのサーバー名&gt;.xrea.com:&lt;バックアップ対象としたいディレクトリへのパス&gt; &lt;一時保存先のディレクトリへのパス&gt;
#pdumpfsで世代別バックアップ
pdumpfs &lt;一時保存先のディレクトリ&gt; &lt;バックアップ先&gt;
</pre>
</div>
<p>そしてこれを毎日呼び出すようにcronを設定します。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:e82c32d7-e091-4124-8d11-a7f787a3348e" class="wlWriterEditableSmartContent">
<pre name="code" class="py">HOME=&lt;registHost.pyやbackup.shを配置したディレクトリ&gt;
#毎日午前四時 SSHを使うにあたり、ホスト情報をXREAに登録
0 4 * * * &lt;registHost.pyやbackup.shを配置したディレクトリ&gt;/registHost.py

#毎日午前四時十分 XREAのバックアップの本処理
10 4 * * * &lt;registHost.pyやbackup.shを配置したディレクトリ&gt;/backup.sh
</pre>
</div>
<p>さて、最後に忘れちゃいけない作業があります。</p>
<p>それはバックアップのリストア作業のテスト。バックアップをとったは良いけど、実はうまく取れていなくて、いざ必要になった時に使い物になりませんでしたでは悲しすぎます。忘れずにリストア出来るか確認しておきましょう。お疲れ様でした！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/wordpress/3259/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UnhandledExceptionイベントは、サブスレッドの例外も捕捉可能</title>
		<link>http://blog.sharplab.net/computer/cprograming/3253/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/3253/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 06:35:02 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[C#Programing]]></category>
		<category><![CDATA[Async Operation]]></category>
		<category><![CDATA[BeginInvoke]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[UnhandledException]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/3253/</guid>
		<description><![CDATA[以前あげたC# .NETアプリケーション開発 徹底攻略 Listing2.26への疑問 &#8211; SharpLab.というエントリに対して、なちゃさんから、
なちゃ 09-09-23 09:15:19 JST 
本 [...]]]></description>
			<content:encoded><![CDATA[<p>以前あげた<a href="http://blog.sharplab.net/computer/cprograming/3149/#comments">C# .NETアプリケーション開発 徹底攻略 Listing2.26への疑問 &#8211; SharpLab.</a>というエントリに対して、なちゃさんから、</p>
<blockquote><p>なちゃ 09-09-23 09:15:19 JST </p>
<p>本来、デリゲートでBeginInvokeした場合は、必ずEndInvokeする必要がありますね。      <br />リソースリークなども発生する危険があります。       <br />※デリゲート以外でもBegin～系は基本的には同じですが </p>
<p>EndInvokeさえすれば、きちんと発生した例外がスローされてきます。      <br />けして例外が握りつぶされているのではなく、正しく使っていないために握りつぶされているように見えているだけですね。       <br />ちょっと書籍の記述がまずいと思います。</p>
</blockquote>
<p>という指摘がありました。なるほど！指摘の通り、Begin EndパターンなのでEndInvokeを必ず呼び出す必要がありました。恥ずかしながらすっかり失念していました。。というわけでEndInvokeを使うように修正。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c1a69e42-940e-4c04-9db2-55c28372650c" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;

namespace SharpLab.ThreadExceptionTest {
	static class Program {

		static Form form;

		/// &lt;summary&gt;
		/// アプリケーションのメイン エントリ ポイントです。
		/// &lt;/summary&gt;
		[STAThread]
		static void Main() {

			Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
			Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(Program_UnhandledException);

			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			form = new Form();
			Application.Run(new Form1());
		}

		static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
			MessageBox.Show(e.Exception.Message);
		}

		static void Program_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
			Exception ex = (Exception)e.ExceptionObject;
			MessageBox.Show(ex.Message);
			Application.Exit();
			Environment.Exit(0);
		}

	}
}</pre>
</div>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f2bb3009-b823-403f-b67d-997f4b5d6ba4" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace SharpLab.ThreadExceptionTest {
	public partial class Form1 : Form {
		public Form1() {
			InitializeComponent();
		}

		private delegate void SampleDelegate();

		private void button1_Click(object sender, EventArgs e) {

			SampleDelegate a = new SampleDelegate(ThreadMethod);
			a.BeginInvoke((asyncResult) =&gt; {
				a.EndInvoke(asyncResult);
			}, null);
		}

		private void ThreadMethod() {
			//意図的に起こした例外
			Thread.Sleep(5000);
			throw new Exception("非同期スレッドで起こった例外です。");
		}

	}
}</pre>
</div>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb9.png" width="304" height="235" /></a></p>
<p>こんな感じでしょうか。ちゃんとサブスレッドで例外が発生した時にUnhandledExceptionが呼び出されるようになりました！これで正しく確実な終了処理ができそうです。サブスレッドの処理内容をすべてtry~catchで括って必要に応じて例外をリスローする必要があると憶えていたのですが、そうではなかったのですね。いつもtry~catch書きながらなんかおかしい気がしていたのですが、これですっきりしました。なちゃさん、ありがとうございました。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/3253/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webkit.NETのDOMをJavaScriptを使って操作する方法</title>
		<link>http://blog.sharplab.net/computer/cprograming/3249/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/3249/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 06:50:21 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[C#Programing]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Webkit]]></category>
		<category><![CDATA[Webkit.NET]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/3249/</guid>
		<description><![CDATA[前のエントリで紹介したWebkit.NETはまだC#などのコードからDOMにアクセスする方法は実装中であるため、正式には提供されていません。提供されているのは基本的なナビゲーションなどに限られています。そのため、出来るこ [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.sharplab.net/computer/cprograming/3247/">前のエントリ</a>で紹介した<a href="http://webkitdotnet.sourceforge.net/">Webkit.NET</a>はまだC#などのコードからDOMにアクセスする方法は実装中であるため、正式には提供されていません。提供されているのは基本的なナビゲーションなどに限られています。そのため、出来ることは相当制限されています。がしかし、<a href="http://sourceforge.net/projects/webkitdotnet/forums/forum/939856/topic/3348839">表示されているページの中でJavaScriptのコードを実行させる方法</a>がForumに上がっていましたので紹介します。これがあれば多少の助けにはなりそうです。</p>
<p>ソースコードはこんな感じ。</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:2d249c4a-6133-4423-94ea-81a41deebc0b" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">private void button1_Click(object sender, EventArgs e) {
    FieldInfo fi = typeof(WebKitBrowser).GetField("webView", BindingFlags.NonPublic| BindingFlags.Instance);
    WebView webView = (WebView)fi.GetValue(this.webBrowser1);
    webView.stringByEvaluatingJavaScriptFromString(@"document.body.innerHTML = 'Hello Webkit DOM!';");
}</pre>
</div>
<p>リフレクションを使っています。WebKitBrowserにはwebViewというprivateなメンバがあり、それはWebViewインターフェイスを実装しています。このwebViewをリフレクションで取得し、そのメンバにstringByEvaluatingJavaScriptFromStringというJavaScriptコードを引数として渡してやると実行してくれるメソッドがあるので、これを利用するという方法です。このメソッドの戻り値の型はstringなのですが、実行結果を取得することはどうもできないようです。 WebViewの他のメンバの実装がどれぐらい進んでいるかはまだ試していないのでわからないのですが、WebViewについては、Webkitですし、Cocoaのリファレンスを参照するとよさそうな感じがします。 </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/3249/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webkit.NETを触ってみた</title>
		<link>http://blog.sharplab.net/computer/cprograming/3247/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/3247/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 16:52:13 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[C#Programing]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Webkit]]></category>
		<category><![CDATA[Webkit.NET]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/3247/</guid>
		<description><![CDATA[ 「C#凄い使いやすくて良い言語なんだけど、WebBrowserコントロールは残念だよなー、Trident最近頑張ってるんだけどWebkitとかに比べるとまだまだだよなー」とか常日頃から感じていたのですが、ふと「Webk [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb1.png" width="244" height="142" /></a> 「C#凄い使いやすくて良い言語なんだけど、WebBrowserコントロールは残念だよなー、Trident最近頑張ってるんだけどWebkitとかに比べるとまだまだだよなー」とか常日頃から感じていたのですが、ふと「WebkitをC#から扱うためのラッパーとか探せばあるんじゃね？」という思いつきで「Webkit .net」とググってみると、ありましたありました、「Webkit.NET」というまんまなタイトルのプロジェクトが。オープンソース恐るべし。コンパイル済みのバイナリと共に、サンプルアプリがあったので実行してみました。 </p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image2.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb2.png" width="404" height="267" /></a></p>
<p>･･･なにこれ凄い。日本語も全く普通に通りますし、普通に使えそうです。というわけで自分でもテスト用にWinFormsプロジェクトを作って動かすテストをしてみたので、メモを残しておきます。</p>
<p>まず、WebKit.NETライブラリを<a href="http://sourceforge.net/projects/webkitdotnet/">WebKit .NET | Get WebKit .NET at SourceForge.net</a>からDLしてきます。その中のbinフォルダ内のファイルがライブラリを構成しています。WebKitBrowser.dllがC#から参照するラッパーです。</p>
<p>まず、WebKitBrowserをツールボックスに追加してやります。ツールボックスのコンテキストメニューの「アイテムの選択」という項目をクリックします。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb3.png" width="244" height="185" /></a> </p>
<p>この際、ダイアログが表示されるまで、めちゃ重たいかもしれませんが、ぐっとこらえましょう。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb4.png" width="244" height="176" /></a></p>
<p>そして参照ボタンをクリックして、WebKitBrowser.dllを選択してやれば、ツールボックスにWebKitBrowserが追加されます。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb5.png" width="242" height="159" /></a> </p>
<p>あとは普通にコントロールをポトベタしておわり…でもありません。。</p>
<p>まず、プロジェクトのプロパティから、プラットフォームターゲットをx86に設定します。Webkitは、現在、x86版のみ提供されているそうです。    <br /><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb6.png" width="404" height="242" /></a></p>
<p>続いて、デバッグのタブにある、「Visual Studio ホスティング プロセスを有効にする」という項目のチェックを外します。Visual Studioホスティングプロセスは、Visual Studioでのデバッグを効率化させるためのもののようですが、今回のようにアンマネージドコードを連携する場合は上手く働かず、エラーの原因になることがあるようです（Visual Studioホスティングプロセスの解説：<a href="http://www.atmarkit.co.jp/fdotnet/dotnettips/410vshost/vshost.html">VSホスト・プロセス（*.vshost.exe）とは何か？［VS 2005のみ、C#、VB］ － ＠IT</a>）。これが原因のエラーにぶつかって、<a href="http://blogs.wankuma.com/katamari/">@JZ5さん</a>に助けを求めたところ、このオプションを教えていただけました。ありがとうございました。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb7.png" width="304" height="125" /></a></p>
<p>こうしてビルドした上で、最後に仕上げに、ビルドして出来た実行ファイルやWebKitBrowser.dllと同じディレクトリに、Webkit本体であるWebkit.dllや、その依存するdll群を放り込みます。ビルド後のイベントでコピーするコマンドを発行してやると良いようです。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="left" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb8.png" width="284" height="172" /></a></p>
<p>というわけで出来ました。よいよい。素晴らしい。DOM周りのメンバの実装が未だらしく、出来ることは結構限定されていますが、Monoでも動かせるようにしたいよねー、とREADMEに書かれていたりと、これからの進展に期待したいプロジェクトです。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/3247/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>タイ行ってきました。</title>
		<link>http://blog.sharplab.net/life/travel/3230/</link>
		<comments>http://blog.sharplab.net/life/travel/3230/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 17:08:18 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Travel]]></category>
		<category><![CDATA[Thailand]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/life/travel/3230/</guid>
		<description><![CDATA[タイ行ってきました。寺院めぐりとかしてみると、日本の仏教建築との違いが結構面白かったのですが、街中ではタイにおける日本の文化的な影響力が強すぎて、「海外に来た―！」という高揚感があんまりなかったのも事実。まぁ楽しかったで [...]]]></description>
			<content:encoded><![CDATA[<p>タイ行ってきました。寺院めぐりとかしてみると、日本の仏教建築との違いが結構面白かったのですが、街中ではタイにおける日本の文化的な影響力が強すぎて、「海外に来た―！」という高揚感があんまりなかったのも事実。まぁ楽しかったです。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020226.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020226" border="0" alt="P1020226" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020226_thumb.jpg" width="364" height="274" /></a><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020091.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020091" border="0" alt="P1020091" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020091_thumb.jpg" width="207" height="274" /></a>     <br /><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020097.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020097" border="0" alt="P1020097" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020097_thumb.jpg" width="364" height="274" /></a><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020075.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020075" border="0" alt="P1020075" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020075_thumb.jpg" width="207" height="274" /></a>     <br /><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020062.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020062" border="0" alt="P1020062" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020062_thumb.jpg" width="207" height="274" /></a><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020166.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020166" border="0" alt="P1020166" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020166_thumb.jpg" width="364" height="274" /></a>     <br /><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020217.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020217" border="0" alt="P1020217" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020217_thumb.jpg" width="206" height="274" /></a><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020214.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1020214" border="0" alt="P1020214" src="http://blog.sharplab.net/wp-content/uploads/2009/09/P1020214_thumb.jpg" width="364" height="274" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/life/travel/3230/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>物欲沸々。。</title>
		<link>http://blog.sharplab.net/life/shopping/3211/</link>
		<comments>http://blog.sharplab.net/life/shopping/3211/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:46:52 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Shopping]]></category>
		<category><![CDATA[iPod Touch]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[ThinkPad]]></category>
		<category><![CDATA[Touch Diamond]]></category>
		<category><![CDATA[VAIO]]></category>
		<category><![CDATA[X200]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/life/shopping/3211/</guid>
		<description><![CDATA[涼しくなってきましたね。秋です。物欲の秋です！
夏にしていた頼まれ仕事が落ち着いて、普段しているバイトとあわせて財布に結構余裕が出てきたので、物欲がどんどん膨らんできている今日この頃です。
ラップトップ
今買いたいなぁと [...]]]></description>
			<content:encoded><![CDATA[<p>涼しくなってきましたね。秋です。物欲の秋です！</p>
<p>夏にしていた頼まれ仕事が落ち着いて、普段しているバイトとあわせて財布に結構余裕が出てきたので、物欲がどんどん膨らんできている今日この頃です。</p>
<h3>ラップトップ</h3>
<p>今買いたいなぁと思っているのはまずラップトップ。何しろ10/22にWindows 7が一般向けにリリースされますし、Visual Studio 2010はWPF化されてやたら重くなりそうなので、そろそろラップトップを買い替えたいなぁと思っています。買い換える上で基準としたいのは、処理速度、堅牢性、携帯性、適度な画面サイズです。</p>
<p>今気になっているのはThinkPadのX200とVAIO Type Z。ThinkPadは大学の研究室に結構あり、触れてみる限りでは確かに噂通り頑丈で良さそうな印象を持っています。逆にVAIOは、現在使っているVAIO Type SZから判断するに、結構軟弱です。機嫌よく動いていてくれている時は良い機種なのですが、故障が多く、かなり修理に出費を強いられたのは苦い思い出です。まぁSonyは延長保証（\15,000程）さえ入れば3年間無償修理をしてくれるので、今度はそれに入っておけば問題にならないかなぁと。。</p>
<p>ちなみに筐体で言えば、MacのUnibodyは正直無いなぁと思っています。結構周りでぶつけた拍子にMBPの角が凹んでしまった人を見かけますし、Airは筐体が歪んで机に置いたときにがたつく様になったという話も聞きます。その上延長保証サービスであるAppleCare Protection Planは￥31,500もしますし（そんなに故障率が高いのか？）。。表面的なカタログスペックや見てくれは立派なんですが、ちょっとMacBookは、ねぇ。。</p>
<p>話をThinkPadに戻すと、やはり携帯性を考えると、モバイル最重視のXシリーズっていいなぁと。画面サイズで言えばX301が13.3インチで1.5kg程と一番望ましく感じられるのですが、CPUが低電圧版なのが気にくわないところです。低電圧版はバッテリの持ちは良くなりますが、値段が跳ね上がり、処理性能は落ちます。自分はたとえバッテリの持ちが悪くなっても通常電圧版CPUであってほしいと考えるタイプなので、やはり画面の小ささは我慢してX200なのかなぁと。</p>
<p>頑健さでいえばLet&#8217;s Noteがありますが、こちらは全てのモデルのCPUが低電圧版、超低電圧版に限られているので、これも自分的にはないなぁと。</p>
<p>一方VAIO。Type Z、以前は30万越えは普通というとてつもなく高いシリーズというイメージがありましたが、最近はSSD他の値段の下落に応じてか、20万半ば頑張って捻出すれば十分すぎる性能のモデルが手に入るようになってきたようで、心惹かれるものがあります。画面サイズは13.1インチあり、重量は1.6kg、CPUは通常電圧版と、カタログスペックは非常に素敵です。 </p>
<p>ただ、じゃあType ZかX200を買うかというと、まだ迷っていて、というのは<a href="http://www.gizmodo.jp/2009/09/5_16.html">コードネームCalpellaとかいうモバイル向けCPUが出てくる</a>そうですし、それにあわせたモデルチェンジをまってみるのもいいかなぁと考えています。なかなか、腹が括れません。。 </p>
<h3>ハンディデバイス</h3>
<p>それより、いま一番買おうかと悩んでいるのがiPod Touch。自分はApple教信者じゃないので、iPhoneは買わずにきました（アプリ開発にMacが要るのが気にくわなかった）。ですが、これだけiPhone/iPod Touchのアプリが揃ってくると流石に興味が出てくるもので、アプリは書けないものの、おもちゃとして買ってみようかなぁと考えています。本当はiPhone 3GSがGPSやカメラなど各種機能が一番統合されていて便利なのでしょうが、今手持ちのTouch DiamondにE-Mobile公認の機能としてあるラップトップとのテザリング機能を手放す気にはなれないので、iPhoneを買うのではなく、iPod Touchを買い、Touch DiamondとiPod TouchをWifiかBTで結んで使ってみるという絵図を描いています。</p>
<p>Appleが出すと噂のタブレットも気になって入るのですが、登場時期が早くとも年明け以降と予測されていて、結構まだ時間が空いていること、出たとしても結構値が張りそう、タブレットだと片手で歩きながら弄れるサイズではない、ということを理由にiPod Touchの方が自分には合っているのだと自分に言い聞かせています(笑)。（しかし、タブレットが出たとして、通信モジュールはどうなるんでしょうね？Touch以上にインターネットへの接続が重要なデバイスになりそうですが、Expressカード型などの通信カードに頼るのか、WiMAX/Wifiモジュールを内蔵するのか、3Gを内蔵するのか、結構興味があります。USBドングルやExpressカード型の通信カードをぶっさすスタイルは見てくれがスマートじゃないのでJobsが嫌いそうなものですが。。）</p>
<p>まぁ、というわけで、これから数カ月は節制生活に入ります。。買ってやるぞー！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/life/shopping/3211/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ShuttleのベアボーンにVMware ESXiをインストールしてみた</title>
		<link>http://blog.sharplab.net/computer/software/3209/</link>
		<comments>http://blog.sharplab.net/computer/software/3209/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 13:49:15 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Cent OS]]></category>
		<category><![CDATA[FreeNAS]]></category>
		<category><![CDATA[Intel NIC]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[VMware ESXi]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/software/3209/</guid>
		<description><![CDATA[以前組み立てたは良いものの、大学やバイト先に持っていくので常用しているラップトップ（VAIO Type SZ）と使い分けが出来ず、メインマシンになりそこねていたShuttleのベアボーンを使って、流行りの仮想化というもの [...]]]></description>
			<content:encoded><![CDATA[<p>以前組み立てたは良いものの、大学やバイト先に持っていくので常用しているラップトップ（VAIO Type SZ）と使い分けが出来ず、メインマシンになりそこねていた<a href="http://blog.sharplab.net/computer/hardware/1889/">Shuttleのベアボーン</a>を使って、流行りの仮想化というものに挑戦してみました。</p>
<p>仮想化というのは、一台のマシンの上で、実機をエミュレートした仮想のマシンを走らせることで、複数のOSを並行して走らせたりすることをいいます。一台のサーバーが複数のマシンの役割を果たしてくれる仮想化は、遊んでいるハードウェアは殆ど持っていない自分にとって夢のような技術です。幸い、組み立てていたPCは、こういうこともあろうかと余裕を持たせて4コアのCPUを積んでいたりしたので、挑戦することが出来ました。</p>
<p>これまでもWindows 7 RCとUbuntuをデュアルブートで入れてみたり、それらのOSの上で動くVirtual Boxという仮想化用のソフトを使いDebianやら色々走らせること（ホストOS方式）はしていたのですが、今回は仮想化でも、ハイパーバイザ方式での仮想化を試みてみました。ハイパーバイザ方式とは、ハイパーバイザという仮想化専用のOSを実機にインストールし、そのハイパーバイザが提供する仮想のマシンの上でOSを動かす方式です。ハイパーバイザ方式だと何がいいかというと、仮想化専用のOSがホストOSなため、ホストOSに無駄なリソースを喰われたり、ホストOSのアップデートなどでVMを落とす必要に迫られることが少ない点が優れています。今回は、VMware ESXiというハイパーバイザを入れ、その上にWindows 7 RCとUbuntu、CentOS、Free NASなど諸々を入れてみることを目指しました。VMware ESXiは以前、大学のサーバーで触らせてもらったことがあったのですが、そのときはCPUのコア：たくさん、メモリ：いっぱい、という、まぁ化け物みたいな構成のもので、後はVMを作るだけという状態で弄らせてもらったので簡単だったのですが、今回はサーバー機でない単なるベアボーンで一から構築したので少し難儀しました。</p>
<p>まず一点目がインストール時にHDDを認識しないという点。IDEのHDDを認識しないというのは聞いていたのですが、SATAで繋いでいた自分のマシンでも駄目でした。色々試したりしているうちに、ググって出てきたのが<a href="http://techno-st.net/2009/01/23/vmware-esxi-ide-hdd.html">VMware ESXi を IDE HDD にインストール &#8211; trial and error</a>というページ。曰く、SATAでもAHCI モードで動いてない場合、IDE HDDとして認識され、それがもとで弾かれているとかなんとか。そこでBIOSの設定を見直し、AHCIモードに切り替えてみたのですが、こんどはSATA接続のDVDドライブが認識されないという問題が発生。どうもDVDドライブのファームウェアに問題があるらしく、泣く泣く設定を戻し、<a href="http://techno-st.net/2009/01/23/vmware-esxi-ide-hdd.html">VMware ESXi を IDE HDD にインストール &#8211; trial and error</a>で紹介されている、インストールスクリプトでIDE接続のHDDをはじいている部分を書き換えるという方法で乗り切りました。DVDドライブをあきらめても良かったのですが、そうするとESXiをアップデートする必要に迫られた時に面倒がおきそうだったので、AHCIモード動作化は今回は見送りました。</p>
<p>続いて直面したのがオンボードのNICが認識されないという問題。なんでもESXiはIntelかBroadcomのチップを載せた一部のLANボードにしか対応していないとか。。こればかりは仕方がないので、<a href="http://www.amazon.co.jp/%E3%82%A4%E3%83%B3%E3%83%86%E3%83%AB-EXPI9301CT-%E3%82%AE%E3%82%AC%E3%83%93%E3%83%83%E3%83%88-CT-%E3%83%87%E3%82%B9%E3%82%AF%E3%83%88%E3%83%83%E3%83%97%E3%83%BB%E3%82%A2%E3%83%80%E3%83%97%E3%82%BF/dp/B001CXWWBE">EXPI9301CT</a>というLANボードをAmazonでポチリ。\4,680と、目玉が飛び出るような高さではないけれど、今じゃ\4000もあればバルクのDVD±RWドライブが買えてしまうことを考えると、ちょっと高いかなと感じたり。そういうものなのでしょうか。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/09/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="left" src="http://blog.sharplab.net/wp-content/uploads/2009/09/image_thumb.png" width="244" height="146" /></a> ここまで来ると後は簡単で、ハイパーバイザに固定IPを割り振り、そのIPに対して、ラップトップにインストールしたVMware Infrastructure Clientで接続してVMを作っていくだけの簡単なお仕事になります。</p>
<p>なにはともあれまず入れたのはWindows 7。もうRTMもMSDNやTech Netで出てますし、Tech Net Direct Plusに申し込んで、RTMを手に入れても良いかと思ったのですが、折角Tech Net Direct Plusに申し込むならOffice 2010も欲しいよね、ということで、ぐっと我慢してOffice 2010のリリース時期がもう少し信じられるレベルまで固まるまで待つことにし、とりあえずはWindows 7 RCをインストール。その上でそのWindows 7に対し、リモートデスクトップ接続できるように色々と設定を行いました。VMware Infrastructure Clientのコンソールも、よいのですが、Aeroが効かないし、効率はやはりリモートデスクトップ接続に劣るからです。LAN内での接続はすぐ上手くいったのですが、外からインターネット経由で繋ぐのは少し難儀しました。自分の家は当然固定IPなぞ持っていないので、ダイナミックDNSサービスを利用し、ドメイン名でアクセスし、ブロードバンドルータからWin7のVMに対してリモートデスクトップ接続に使うポートをポートマッピングしてやったのですが、なぜか繋がらないという。。ラップトップからLANケーブルを引っこ抜き、代わりにイーモバイルの回線経由で接続のテストをしているつもりだったのですが、実は無線LANで家のネットワークにぶら下がりっぱなしだったのが原因でした。VMware Infrastructure Clientの接続が切断されない時点で気付くべきだったのですが、なかなか。。。時間を無駄にしてしましました。</p>
<p>つづいてセットアップしたるはFreeNAS。古いPCを簡単お手軽にNAS化できるアプライアンスOSです。数日前に7年程前のPCを引っ張り出してきて試してみたものの、そのPCのファンの五月蠅さに常時立ち上げておく気になれず、どうしたものかと思っていたものを移行させるために作成しました。本当はRAID化やバックアップの設定もしたいところなのですが、何せ物理HDDがベアボーンに内蔵させている一台しかないので、今のところはあきらめています。いずれeSATAでいくつもHDDを足したいところです。</p>
<p>更に続くはUbuntu.今のところ一応入れてみただけです。多分ずっと寝かせっぱなしになりそうだなぁ。。</p>
<p>そしてCentOS。とりあえずこいつを安定的に運用するのが目的。ぶっ壊すの覚悟のテスト用と、安定的に運用する奴と二つ。仮想化環境でなければ自分には到底実現できない、ぶるじょあな構成(笑)。壊したとしても、スナップショットがあるので、直ぐ戻せるという仮想化の利点を生かして、これでLinuxの勉強をしてみたいと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/software/3209/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>明石海峡大橋を渡ってきました。</title>
		<link>http://blog.sharplab.net/life/travel/3205/</link>
		<comments>http://blog.sharplab.net/life/travel/3205/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 15:14:23 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Travel]]></category>
		<category><![CDATA[Bridge]]></category>
		<category><![CDATA[Udon]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/life/travel/3205/</guid>
		<description><![CDATA[
7日から墓参りなどで大阪の母方・父方の実家を回っていまして、昨日は一日時間があったので、レンタカーを借りて明石海峡大橋を渡り、鳴門まで行ってきました。いやー明石海峡大橋、デカい！流石世界一の吊り橋。垂水側のアンカレイジ [...]]]></description>
			<content:encoded><![CDATA[</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/08/P1010331.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="P1010331" border="0" alt="P1010331" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/08/P1010331_thumb.jpg" width="324" height="219" /></a>7日から墓参りなどで大阪の母方・父方の実家を回っていまして、昨日は一日時間があったので、レンタカーを借りて明石海峡大橋を渡り、鳴門まで行ってきました。いやー明石海峡大橋、デカい！流石世界一の吊り橋。垂水側のアンカレイジ脇で写真を撮ったのですが、淡路島側はロクに写りませんでした。。</p>
<p>鳴門側では大鳴門橋の下部から、有名な鳴門の渦潮を見てきました。途中、渋滞に引っかかったりしたので、満潮時刻には間に合わず、綺麗な写真は撮れなかったのですが、波が渦を巻いている様は、非常に迫力のあるものでした。</p>
<p>そして鳴門では「釜揚げうどん」を食べてきました。本当は本場、讃岐まで行きたかったのですが、時間がなかったので。。とても美味しかったです。</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/08/P1010363.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1010363" border="0" alt="P1010363" src="http://blog.sharplab.net/wp-content/uploads/2009/08/P1010363_thumb.jpg" width="244" height="184" /></a><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/08/P1010386.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="P1010386" border="0" alt="P1010386" src="http://blog.sharplab.net/wp-content/uploads/2009/08/P1010386_thumb.jpg" width="244" height="184" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/life/travel/3205/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>中国でTwitterを利用する方法</title>
		<link>http://blog.sharplab.net/computer/software/3198/</link>
		<comments>http://blog.sharplab.net/computer/software/3198/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 14:30:25 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[China]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[sobees]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/software/3198/</guid>
		<description><![CDATA[ ご存知の通り、中国では政府にとって好ましくないとされるサイトへのアクセスはブロックされており、Twitterもその一つです。TwitterのWebページのアクセスも、TwitterクライアントがTwitter APIを [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/08/image.png" width="304" height="192" /> ご存知の通り、中国では政府にとって好ましくないとされるサイトへのアクセスはブロックされており、Twitterもその一つです。TwitterのWebページのアクセスも、TwitterクライアントがTwitter APIを叩きに行くのもブロックされています（自分は普段TweetDeckを使っています）。しかし、それで「はいそうですか」、と素直に引き下がれるほど自分のTwitter依存度は低くなく。。一緒に上海に行った人達は日本にWebプロキシを建てた上で使っていたようですが、自分はちょっと違った方法を使いました。<a href="http://www.sobees.com/">sobees</a>を使うという方法です。これはSilverlightで作られたTweetDeckライクなマルチカラムTwitterクライアントで、これはSilverlight3で構築されていて、Out of Browser機能が有効化されているので、これをデスクトップにインストールして使用していました。</p>
<p>ではなぜTweetDeckが使えずにsobeesが使えるかというと、sobeesはSilverlightで構築されているので、直接クライアントがTwitterのAPIを叩きに行けず、クライアントの配布されているsobeesのサーバーがsobeesのクライアントからのAPI呼び出し要求をTwitter APIに中継しているという性質によるものです。実は、中国国内からのアクセスが制限されいるのはTwitterのWebページとTwitter APIを直接呼び出すケースだけで、もばついやsobeesのように、Twitter APIを叩くサーバーが中国国外にあるWebクライアントは利用可能なのです。sobeesは現在リリースされているSilverlightアプリケーションの中では最もよく作り込まれているアプリケーションの一つで、TweetDeckと互角か、それ以上に使いやすいアプリケーションと言えるので、中国に行かれる場合はおススメのクライアントと言えるでしょう。ただ、ひとつだけ残念なことがあり、それは、IMEによる変換を行うときに誤動作をするという点。変換を行う時のEnterキー入力で入力が完了したものと勘違いし、そこでTweet送信をしてしまうというバグがあります。そのため、現状では、Tweetはテキストエディタで書いた上で張り付けて送信をせざるおえないという残念な状態です。バグレポートを投げようと思うので、それが対応されたらTweetDeck代替として結構使えるのではないかと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/software/3198/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>上海から帰還</title>
		<link>http://blog.sharplab.net/life/travel/3196/</link>
		<comments>http://blog.sharplab.net/life/travel/3196/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 14:24:10 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Travel]]></category>
		<category><![CDATA[Photosynth]]></category>
		<category><![CDATA[Shanghai]]></category>
		<category><![CDATA[Study]]></category>
		<category><![CDATA[Traval]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/life/travel/3196/</guid>
		<description><![CDATA[何とか上海から帰ってきました。今回は自分の研究室が提携している研究室のネットワークでの発表会で、自分もちょっと刺激を受けてこい、ということで行かせて貰ったのですが、いやはや向こうの学生のレベルは高かったです。研究内容のレ [...]]]></description>
			<content:encoded><![CDATA[<p>何とか上海から帰ってきました。今回は自分の研究室が提携している研究室のネットワークでの発表会で、自分もちょっと刺激を受けてこい、ということで行かせて貰ったのですが、いやはや向こうの学生のレベルは高かったです。研究内容のレベルはともかくとして（向こうは院生ばかりですから）、英語力の面からみて。中国からはFudan Univ.が、韓国からはKAISTが参加していたのですが、どちらも発表後の質疑応答をちゃんとこなしていて、しどろもどろになってしまった自分とは大違いでした。反省します。。</p>
<p>そういえば、滞在していたホテルが予想に反してあまりに綺麗だったので写真を撮りまくってPhotosynthでの合成表示を試してみました。Silverlightをインストールした上で観てみてください。</p>
<p><iframe height="300" src="http://photosynth.net/embed.aspx?cid=96ACADA8-D49A-4301-95C3-C62DD480AF94&amp;delayLoad=true&amp;slideShowPlaying=false" frameborder="0" width="500"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/life/travel/3196/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ちょっと上海行ってきます</title>
		<link>http://blog.sharplab.net/life/travel/3195/</link>
		<comments>http://blog.sharplab.net/life/travel/3195/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 00:00:02 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Travel]]></category>
		<category><![CDATA[Shanghai]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/life/travel/3195/</guid>
		<description><![CDATA[提携している研究室同士の研究発表会ということで、2日までの日程で上海行ってきます。まぁ要は、ちょっと海外行って自分の英語の出来なさに打ちのめされて来い、というイベント。ありがたい話です。
]]></description>
			<content:encoded><![CDATA[<p>提携している研究室同士の研究発表会ということで、2日までの日程で上海行ってきます。まぁ要は、ちょっと海外行って自分の英語の出来なさに打ちのめされて来い、というイベント。ありがたい話です。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/life/travel/3195/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac始めました。</title>
		<link>http://blog.sharplab.net/computer/hardware/mac/3191/</link>
		<comments>http://blog.sharplab.net/computer/hardware/mac/3191/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 16:48:20 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[FILCO FKB108M/NB]]></category>
		<category><![CDATA[MacBook Kuro]]></category>
		<category><![CDATA[VAIO]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/uncategorized/3191/</guid>
		<description><![CDATA[ 唐突ですが、Mac使いになりました。まさか自分がMacを使う日が来るとは思っていなかったので、自分でも驚いています(笑) SAをやらせて貰ったりと色々とお世話になっている大学の先生からMacBook KUROを貸してい [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_291.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="IMAGE_291" border="0" alt="IMAGE_291" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_291_thumb.jpg" width="244" height="184" /></a> 唐突ですが、Mac使いになりました。まさか自分がMacを使う日が来るとは思っていなかったので、自分でも驚いています(笑) SAをやらせて貰ったりと色々とお世話になっている大学の先生からMacBook KUROを貸していただけることになり、今、手元にあのMacが。研究室で同期や後輩が次々にMacに乗り換えているのを見て、「WPFの使えないデスクトップOSなんて使う奴の気が知れないわ～」とかのたまっていたのですが、いちいち画面が綺麗で統一感があり、Macも目的によれば良いかもしれないなーと思ったりしています。これまでずっとWindowsで、全くMacをつかったことがないので、まず操作からしてよくわからないことが多いのですが（GNOMEの方が百倍とっつきやすいです）、躓きながら慣れていこうかと思います。ただ、残念なことに、八月の頭にかけては全く触る暇がなさそうなので、ちょっとの間、放置になりそうではあります。しかしMacかー。どう使ったものか。流石にMacまで来てMonoでC#コードをゴリゴリ書くというのは考えていないのですけど（まぁMonoDevelopは入れるでしょうが）、今更Objective Cとやらを覚えるのもなー、とも思います。なるべく潰しのきかない言語は勉強したくないという思いがあるので、pureなCや、Pythonを書くのに使わせて貰おうかなと思います。</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_292.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="IMAGE_292" border="0" alt="IMAGE_292" align="left" src="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_292_thumb.jpg" width="244" height="184" /></a> しかし貸して頂いているマシン、先生が新しいマシン（勿論Mac）を買ったので使わなくなったから、ということで貸して頂いているのですが、自分のラップトップ（VAIO）よりパワーがあるという。。自分のはVAIO Type SZ53Bをメモリ4GBに増設して使っているのですが、CPUはIntel Core 2 Duo 1.67GHzで、借りているMacBookはIntel Core 2 Duo 2GHz。。なんか、ブートキャンプでWindows 7 RC入れてWindows機としてVAIOをリプレースしたくなるのですが(笑)うーむ。</p>
<h3>FILCO FKB108M/NB</h3>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_294.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="IMAGE_294" border="0" alt="IMAGE_294" align="right" src="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_294_thumb.jpg" width="244" height="184" /></a> そしてFILCOのキーボードもお借りしました。いやーこれまでキーボードにはそれほど拘らずにきたのですが、良いキーボードってあるんですね。なかなか打ち心地が滑らかで、変な突っかかりや重さがないので、軽快にタイピングをすることができます。この打ち心地を覚えてしまうと、もう安キーボードには戻れない気がするので、もう少しこのキーボードを試したら、秋葉原でRealforceとかと打ち較べてみて新しいキーボードを自分で買ってみようかと思います。</p>
<p>&#160;</p>
<p>なんか最近、部屋がますますマニアックな雰囲気になってきてヤバいです。。どげんかせんといかん（ぇ</p>
<p><a href="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_287.jpg" rel="lightbox"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMAGE_287" border="0" alt="IMAGE_287" src="http://blog.sharplab.net/wp-content/uploads/2009/07/IMAGE_287_thumb.jpg" width="604" height="454" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/mac/3191/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>悲しいけどこれ、仕様なのよね。。（Silverlightの愚痴エントリ）</title>
		<link>http://blog.sharplab.net/computer/cprograming/silverlight/3182/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/silverlight/3182/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 13:32:21 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[M-V-VM]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/silverlight/3182/</guid>
		<description><![CDATA[
CardSafe/EはMVVMパターンに則って作るように心掛けたのですが、WPFと同じ感覚でSilverlightにMVVMパターンを適用しようとすると、色々と不都合が出てきて苦労させられました。Silverlight [...]]]></description>
			<content:encoded><![CDATA[</p>
<p><a href="http://blog.sharplab.net/cardsafeeverywhere/">CardSafe/E</a>はMVVMパターンに則って作るように心掛けたのですが、WPFと同じ感覚でSilverlightにMVVMパターンを適用しようとすると、色々と不都合が出てきて苦労させられました。Silverlightではオミットされている機能が結構あるので、そこに引っかかるとしばしば手戻りが発生します。このエントリではCardSafe/Eを書いていて気付いた点をとりあえず二点ほど。</p>
<h3>SilverlightにはDataTemplate.Datatypeが存在しない</h3>
<p>地味に痛いですこの仕様。ItemsControlから派生したコントロール（ListBoxなど）のItemをItemsSourceにセットしたINotifyPoropertyChangedを実装したコレクションから生成する際に、コレクションが列挙するインスタンスの型によってDataTemplateを切り替える場合、WPFではDataTemplate.Datatypeがあるので重宝するのですが、Silverlightでは3 RTWでもサポートされていません。DataTemplateSelectorもサポートされていないので、インスタンスの型や状態によってDataTemplateを切り替えることはできないようです。とりあえず逃げ道として自分はDataContextにセットされたインスタンスをみてContentを書き換えるロジックを書いたUserControlを用意しているのですが、面倒ですね。XAMLで宣言的に書きたいのでDataTemplate.Datatypeは是非サポートしてもらいたいものです。</p>
<h3>TabcotrolのItemsSourceはTabItemのコレクションしか受け付けない</h3>
<p>なんでー！？これまたあんまりな仕様。WPFではItemsControlから派生したコントロールのItemsSourceにINotifyPoropertyChangedを実装したコレクションをセットすると、その列挙する内容をListBoxItemやTabItemなど適当なコンテナに包んで表示してくれるので、あとはDataTemplateで表示内容を好きなようにカスタマイズしてやればよかったのですが、SilverlightのTabControlのItemsSourceはTabItemのコレクションしか受けてつけてくれないという。。これでは<a href="http://msdn.microsoft.com/ja-jp/magazine/dd419663.aspx">TabItemに対応するViewModelのインスタンスをセットし、DataTemplateでViewを設定して表示内容をカスタマイズするというM-V-VMでよく知られたパターン</a>が使えません。SilverlightでもListBoxではListBoxItem以外も受け付けてくれたのですけどねぇ。。ではどうするか。自分の場合はViewModelのコレクションをラップしてTabItemのコレクションとして公開するラッパークラスとConverterを用意することで凌ぎました。</p>
<p>ラッパークラスはこんな感じです。ViewModelのコレクションとViewModelからTabItemへの変換を行うFuncをコンストラクタの引数として取ります。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:e205b002-58ba-48fa-9380-15d6a59c54a1" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Windows.Controls;

namespace SharpLab.CredentialsLockerSilverlight.ViewModels {
	public class ReadOnlyObservableTabItemCollection&lt;TViewModel, TViewModelCollection&gt; : ICollection&lt;TabItem&gt;, INotifyCollectionChanged where TViewModelCollection : ICollection&lt;TViewModel&gt;, INotifyCollectionChanged {

		private TViewModelCollection _viewModels;
		private ObservableCollection&lt;TabItem&gt; _tabItems;
		private Func&lt;TViewModel, TabItem&gt; _converter;

		public ReadOnlyObservableTabItemCollection(TViewModelCollection viewModels, Func&lt;TViewModel, TabItem&gt; converter) {
			_converter = converter;
			_viewModels = viewModels;
			_tabItems = new ObservableCollection&lt;TabItem&gt;();

			foreach (var item in _viewModels) {
				_tabItems.Add(_converter(item));
			}

			_viewModels.CollectionChanged += new NotifyCollectionChangedEventHandler(_viewModels_CollectionChanged);

			_tabItems.CollectionChanged += new NotifyCollectionChangedEventHandler(_tabItems_CollectionChanged);
		}

		void _viewModels_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
			switch (e.Action) {
				case NotifyCollectionChangedAction.Add:
					_tabItems.Insert(e.NewStartingIndex, _converter((TViewModel)e.NewItems[0]));
					break;
				case NotifyCollectionChangedAction.Remove:
					_tabItems.RemoveAt(e.OldStartingIndex);
					break;
				case NotifyCollectionChangedAction.Replace:
					_tabItems.RemoveAt(e.OldStartingIndex);
					_tabItems.Insert(e.NewStartingIndex, _converter((TViewModel)e.NewItems[0]));
					break;
				case NotifyCollectionChangedAction.Reset:
					_tabItems.Clear();
					foreach (var item in _viewModels) {
						_tabItems.Add(_converter(item));
					}
					break;
			}
		}

		void _tabItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
			if (CollectionChanged != null) {
				CollectionChanged(this, e);
			}
		}

		public event NotifyCollectionChangedEventHandler CollectionChanged;

		#region ICollection&lt;TabItem&gt; メンバ

		public void Add(TabItem item) {
			throw new NotSupportedException();
		}

		public void Clear() {
			throw new NotSupportedException();
		}

		public bool Contains(TabItem item) {
			throw new NotImplementedException();
		}

		public void CopyTo(TabItem[] array, int arrayIndex) {
			throw new NotSupportedException();
		}

		public int Count {
			get {
				throw new NotImplementedException();
			}
		}

		public bool IsReadOnly {
			get {
				return true;
			}
		}

		public bool Remove(TabItem item) {
			throw new NotSupportedException();
		}

		#endregion

		#region IEnumerable&lt;TabItem&gt; メンバ

		public IEnumerator&lt;TabItem&gt; GetEnumerator() {
			foreach (var item in _tabItems) {
				yield return item;
			}
		}

		#endregion

		#region IEnumerable メンバ

		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
			return GetEnumerator();
		}

		#endregion
	}
}
</pre>
</div>
<p>これを以下のようなConverterから利用します。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:1a134c19-118b-4526-9580-4b33d288c890" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Windows.Data;
using SharpLab.CredentialsLockerSilverlight.ViewModels;

namespace SharpLab.CredentialsLockerSilverlight.Views.Converter {
	public class CardVMCol2TabItemColConverter : IValueConverter{
		#region IValueConverter メンバ

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
			return new ReadOnlyObservableTabItemCollection&lt;CardViewModel, ObservableCollection&lt;CardViewModel&gt;&gt;((ObservableCollection&lt;CardViewModel&gt;)value,
				(each) =&gt; {
					var newTabItem = new TabItem() {
						DataContext = each,
						Header = new CardTabHeaderView(),
						Content = new SharpLab.CredentialsLockerSilverlight.Views.CardView()
					};
					return newTabItem;

				});
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
			throw new NotImplementedException();
		}

		#endregion
	}
}
</pre>
</div>
<p>こうしてやることでTabControlのItemsSourceにViewModelのコレクションをバインドできるようになります。Converterは無理を通すのに便利な機能ですね。。</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:35c84690-fda2-43d6-98b5-f6090cbc317f" class="wlWriterEditableSmartContent">
<pre name="code" class="xml"> ItemsSource="{Binding Path=CardViewModels, Converter={StaticResource CardVMCol2TabItemColConverter}}"</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/silverlight/3182/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silverlight3 RTWリリースに関する変更</title>
		<link>http://blog.sharplab.net/computer/cprograming/silverlight/3181/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/silverlight/3181/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 13:33:44 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Attached Behavior]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[M-V-VM]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/silverlight/3181/</guid>
		<description><![CDATA[Silverlight 3のRTWがリリースされましたね。Silverlight Tools for Visual Studio 2008やExpression BlendのRCもリリースされています。version3か [...]]]></description>
			<content:encoded><![CDATA[<p>Silverlight 3のRTWがリリースされましたね。Silverlight Tools for Visual Studio 2008やExpression BlendのRCもリリースされています。version3から本気出すというMSの本領発揮とばかりに、結構便利になってきました。このエントリでは、自分が弄ってみて気づいたSilverlight 3 Betaからの変更点を書いてみたいと思います。</p>
<h3>Silverlight 3 SDK Betaに含まれていたコントロールの一部がSilverlight Toolkitに移動</h3>
<p>DataForm, DockPanel, WrapPanel, Expander, HeaderedContentControl, ViewboxがToolkitに移動したようです。それに伴って所属する名前空間が変わっているので注意が必要です。</p>
<h3>Interactivity.dllの名前空間の変更</h3>
<p>Expressionでは、3 MixPreviewからBehaviorというパターンがサポートされました。3 MixPreviewではプロジェクトでMicrosoft.Expression.Interactivity.dllというアセンブリを参照した上で、Behavior&lt;T&gt;クラスなどを継承して自分でBehaviorを作成するか、<a href="http://gallery.expression.microsoft.com/en-us/site/search?f[0].Type=Tag&amp;f[0].Value=Behavior">Microsoft Expression Community Gallery</a>などからダウンロードして使うという流れでした。今回リリースされたExpression 3RCでは、Microsoft.Expression.Interactivity.dllがSystem.Windows.Interactivity.dllと改名され、名前空間も変更されているので注意が必要です。この改名は<a href="http://shinichiaoyagi.blog25.fc2.com/blog-entry-186.html">Blend SDK</a>の絡みでしょうか。また、BehaviorやTriggerActionの組み込み実装として、StoryBoardActionなどがMicrosoft.Expression.Interactions.dll内で提供されていますので、<a href="http://gallery.expression.microsoft.com/en-us/site/search?f[0].Type=Tag&amp;f[0].Value=Behavior">Microsoft Expression Community Gallery</a>と共に活用していくよいでしょう。</p>
<h3>DataGridのItemsSourceへのBindingが上手くいかない問題が修正</h3>
<p>Silverlight 3 Betaの頃はDataGridのItemsSourceへのBindingが上手く動かないという問題がありました（<a href="http://silverlight.net/forums/t/85303.aspx">DataGrid &#8212; binding to ItemsSource is broken : The Official Microsoft Silverlight Site</a>）。今は修正されています。（これはむしろSilverlight Toolkitの話？）</p>
<h3>Silverlight Tools for VS2008のSilverlightデザイナ削除</h3>
<p>Silverlight 3 Tools for VS2008ではSilverlightデザイナが削除されています。まぁプレビューが上手く出来ない場合も多かったので、VS2010に期待ですね。今のうちにBlend 3に習熟しておきたいものです。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/silverlight/3181/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CardSafe/E公開！</title>
		<link>http://blog.sharplab.net/computer/cprograming/live-framework/3179/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/live-framework/3179/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 13:49:49 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Live Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CardSafe/E]]></category>
		<category><![CDATA[Live Mesh]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/live-framework/3179/</guid>
		<description><![CDATA[&#160;
ここ一か月ほど、週末やらに暇を見つけては作っていたアプリケーションが完成しました。CardSafe/Eというタイトルで、いわゆるパスワードマネージャなのですが、特長としてはMesh enabled webア [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.sharplab.net/cardsafeeverywhere/"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="CardSafeEverywhere" border="0" alt="CardSafeEverywhere" src="http://blog.sharplab.net/wp-content/uploads/2009/07/CardSafeEverywhere2.png" width="610" height="317" /></a>&#160;
<p>ここ一か月ほど、週末やらに暇を見つけては作っていたアプリケーションが完成しました。<a href="http://blog.sharplab.net/cardsafeeverywhere/">CardSafe/E</a>というタイトルで、いわゆるパスワードマネージャなのですが、特長としてはMesh enabled webアプリケーションとして実装していることが挙げられます。Mesh enabled webアプリケーションとは、Microsoftが開発中のLive Frameworkを利用したアプリケーションの一形態です。Mesh enabled webアプリケーションは、Live Meshという、MicrosoftによるDropBox的なデータ同期サービス上に配置され、複数デバイス・サーバー間でのアプリケーションとそのデータの同期が自動的に行われるという特長があり、開発に用いる技術がAjaxやSilverlightであることから、デスクトップアプリケーションとして動かすだけでなく、Webブラウザ上の通常のWebアプリケーションとしても動かすことが出来ます。CardSafe/Eはこれを利用し、データ同期機能を持ったパスワードマネージャを実現しています。</p>
<h3>利用方法</h3>
<p>残念なことに、このLive Frameworkという技術はまだCTP版という扱いであり、通常のLive Mesh Beta版ではMesh enabled webアプリケーションであるCardSafe/Eは利用できません。CardSafe/Eを利用するには、<a href="https://developer.mesh-ctp.com/">https://developer.mesh-ctp.com/</a>という開発者用のLive Meshを利用する必要があります。開発者用Live Meshは、テスト用ということもあり、Mesh enabled webアプリが使えるほかは、Live Mesh Beta版に比べて機能がかなり省かれており、CardSafe/E共々常用には向かないかと思います。それでもLive Frameworkを触ってみたいという場合は、</p>
<ol>
<li>Microsoft Connectの<a href="http://go.microsoft.com/fwlink/?LinkID=130226">Azure Services Invitation Program</a>からLive ServicesのInvitation Codeを取得 </li>
<li>そのInvitation Codeを利用してAzure Services Developer Portalに登録 </li>
<li><a href="https://developer.mesh-ctp.com/">開発者用Live Mesh</a>にサインイン </li>
<li><a href="https://developer.mesh-ctp.com/Web/Devices.aspx">開発者用Live MeshのDeviceタブ</a>からLive Framework Clientをインストール </li>
<li><a href="https://developer.mesh-ctp.com/Web/Apps/AppConsent.aspx?AppUrl=Mesh%2fApplications%2fWJMUWBWCWAUUFAZ7F7CLQJHYJ4">MeshにCardSafe/Eをインストール</a>←このURLを踏んでMeshにCardSafe/Eをインストール </li>
</ol>
<p>という手順になります。開発者用Live Meshへの登録手順などは、<a href="http://gihyo.jp/dev/serial/01/live-fw/0003?page=2">使ってみよう！ Live Framework：第3回 はじめようLive Framework CTP｜gihyo.jp … 技術評論社</a>という記事が非常に分かりやすいので是非参照して進めてください。</p>
<h3>new CloudApp()</h3>
<p>ところで。このアプリケーションは<a href="http://msdn.microsoft.com/ja-jp/azure/dd939048.aspx">new CloudApp()</a>というMicrosoftのコンテストに出しています。気に入って頂けた場合は、<a href="http://www.newcloudapp.com/vote.aspx">new CloudApp(): The Azure™ Services Platform Developer Challenge &#8211; Vote</a>という投票ページでCardSafe/Eにご投票頂けると励みになります。CardSafe/Eに清き一票を！（ぇ</p>
<h3>CardSafe/Eの公開ページ</h3>
<p><a href="http://blog.sharplab.net/cardsafeeverywhere/">CardSafe/E &#8211; SharpLab.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/live-framework/3179/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# .NETアプリケーション開発 徹底攻略 Listing2.26への疑問</title>
		<link>http://blog.sharplab.net/computer/cprograming/3149/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/3149/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 14:39:32 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[C#Programing]]></category>
		<category><![CDATA[Book]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Multi Thread]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/3149/</guid>
		<description><![CDATA[追補エントリを書きました。こちらもあわせてご参照ください：     UnhandledExceptionイベントは、サブスレッドの例外も捕捉可能 &#8211; SharpLab.
&#160;
先日C# .NETアプリ [...]]]></description>
			<content:encoded><![CDATA[<p><strong>追補エントリを書きました。こちらもあわせてご参照ください：     <br /></strong><a href="http://blog.sharplab.net/computer/cprograming/3253/"><strong>UnhandledExceptionイベントは、サブスレッドの例外も捕捉可能 &#8211; SharpLab.</strong></a></p>
<p>&#160;</p>
<p>先日<a href="http://www.amazon.co.jp/NET%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E9%96%8B%E7%99%BA-%E5%BE%B9%E5%BA%95%E6%94%BB%E7%95%A5-NET-Framework-3-5%E5%AF%BE%E5%BF%9C/dp/4839930422">C# .NETアプリケーション開発 徹底攻略</a>という本を購入しました。C#での業務アプリケーション開発におけるノウハウをまとめた本で、プロファイリングの方法など、普段、趣味グラマをしていると考えない部分について色々と触れているので大変参考になる本なのですが、一点、マルチスレッド処理における例外処理についての記述でおかしなところがありました。</p>
<p>2章6節4項の、サブスレッドで発生した例外の捕捉の仕方についての部分です。まず、93~95ページで、集約例外ハンドラではサブスレッドで発生した例外が捕捉出来ない、という部分があります。このようなコードです。</p>
<p>Program.cs</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:81b00071-4932-4930-b709-88549b1ad295" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;

namespace ThreadExceptionBehavior {
	static class Program {
		/// &lt;summary&gt;
		/// アプリケーションのメイン エントリ ポイントです。
		/// &lt;/summary&gt;
		[STAThread]
		static void Main() {

			Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
			Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(Program_UnhandledException);

			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new Form1());
		}

		static void Program_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
			Exception ex = e.ExceptionObject as Exception;
			MessageBox.Show(ex.Message);
		}

		static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
			MessageBox.Show(e.Exception.Message);
		}
	}
}
</pre>
</div>
<p>Form1.cs</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:b0fdf375-b7f8-41dc-afe9-9a1386281615" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Windows.Forms;

namespace ThreadExceptionBehavior {
	public partial class Form1 : Form {
		public Form1() {
			InitializeComponent();
		}

		private delegate void SampleDelegate();

		private void button1_Click(object sender, EventArgs e) {
			//非同期スレッドの実行
			SampleDelegate a = new SampleDelegate(ThreadMethod);
			a.BeginInvoke(null, null);
		}

		private void ThreadMethod() {
			//意図的に起こした例外
			throw new Exception("非同期スレッドで起こった例外です。");
		}
	}
}
</pre>
</div>
<p>ここは良いのです。</p>
<p>そして続いての96~97ページで例外をメインスレッドへの通知して捕捉出来るように書き換える方法が書かれているのですが、このようになっています。</p>
<p>Form1.cs</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:c38975da-5b8f-44f0-88ec-f578c178a366" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Windows.Forms;

namespace ThreadExceptionBehavior {
	public partial class Form1 : Form {
		public Form1() {
			InitializeComponent();
		}

		private delegate void SampleDelegate();

		private void button1_Click(object sender, EventArgs e) {
			//非同期スレッドの実行
			SampleDelegate a = new SampleDelegate(ThreadMethod);
			a.BeginInvoke(null, null);
		}

		private void ThreadMethod() {
			if (this.InvokeRequired) {
				//メインスレッドに呼び戻して実行
				this.BeginInvoke(new SampleDelegate(ThreadMethod));
				return;
			}
			throw new Exception("非同期スレッドで起こった例外です。");
		}
	}
}
</pre>
</div>
<p>19~23行目が加わった部分です。FormのInvokeRequiredプロパティがtrueの場合、つまりメインスレッド（UIスレッド）で実行されていない場合は、非同期にUIスレッドで実行しなおすようになっているのですが、これではサブスレッドでの例外処理の仕方の説明になっていません。ボタンをクリックした後直ぐに処理が帰ってくるという意味では非同期ではありますが、結局UIスレッド上で、ThreadMethodメソッドは動いているわけで、ThreadMethodメソッドに重たい処理を書いた場合は、UIがブロックされてしまうので無意味です。</p>
<p>本来ならば、以下のように書くべきではないでしょうか？</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:35779a26-def3-4a51-877f-53cae740e5ca" class="wlWriterEditableSmartContent">
<pre name="code" class="c#">using System;
using System.Windows.Forms;

namespace ThreadExceptionBehavior {
	public partial class Form1 : Form {
		public Form1() {
			InitializeComponent();
		}

		private delegate void SampleDelegate();

		private void button1_Click(object sender, EventArgs e) {
			//非同期スレッドの実行
			SampleDelegate a = new SampleDelegate(ThreadMethod);
			a.BeginInvoke(null, null);
		}

		private void ThreadMethod() {
			try {

				//何らかの重たい処理

				throw new Exception("非同期スレッドで起こった例外です。");
			}
			catch(Exception e){
				this.BeginInvoke((MethodInvoker)delegate() {
					throw new ApplicationException("サブスレッドで例外が発生しました。", e);
				});
			}
		}
	}
}
</pre>
</div>
<p>これならば重たい処理によってUIがブロックされることもなく、またサブスレッドで発生した例外も例外集約ハンドラで集めることが可能です。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/3149/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Windows API Code Pack for Microsoft .NET Framework (v0.85)さわってみた。</title>
		<link>http://blog.sharplab.net/computer/cprograming/3148/</link>
		<comments>http://blog.sharplab.net/computer/cprograming/3148/#comments</comments>
		<pubDate>Fri, 22 May 2009 00:56:27 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[C#Programing]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows API Code Pack for Microsoft .NET Framework]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/cprograming/3148/</guid>
		<description><![CDATA[中身は

Windows 7 ライブラリを含む Windows Shell 名前空間オブジェクト、既知のフォルダーと非ファイルシステム コンテナ 
Windows Vista と Windows 7 のタスクダイアログ  [...]]]></description>
			<content:encoded><![CDATA[<p>中身は</p>
<blockquote style="margin-right: 0px" dir="ltr"><ul>
<li>Windows 7 ライブラリを含む Windows Shell 名前空間オブジェクト、既知のフォルダーと非ファイルシステム コンテナ </li>
<li>Windows Vista と Windows 7 のタスクダイアログ </li>
<li>WPF と Windows Forms での Windows 7 Explorer Browser Control のサポート </li>
<li>シェル プロパティ システムのサポート </li>
<li>Windows 7 タスクバー ジャンプリスト、アイコン オーバーレイ、プログレスバー用のヘルパー </li>
<li>Windows Vista と Windows 7 コモン ファイル ダイアログのサポート（カスタム ファイル ダイアログを含む） </li>
<li>Direct3D 11.0とDXGI 1.0/1.1 APIのサポート </li>
<li>センサー プラットフォーム API </li>
<li>拡張言語サービス API </li>
</ul>
<p><a href="http://blogs.msdn.com/hiroyuk/archive/2009/05/08/9595475.aspx">川西 裕幸のブログ : Windows API Code Pack for Microsoft .NET Framework (v0.85)</a></p>
</blockquote>
<p>だそうです。以下では同梱のサンプル（DirectX以外）を動かしてみた際のメモ。</p>
<h3>Explorer Browser Control</h3>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb11.png" width="244" height="182" /></a> <a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb12.png" width="244" height="183" /></a> </p>
<p>Explorerのコントロール。使い場所は色々ありそうですね。左がWPF版、右がWin Forms版。もちろんWPF版の主要なプロパティは依存関係プロパティになっていまして、Thumbnail Sizeというスライダーを動かせば、バインドされたサムネイルの大きさがスルスルと変わっていきました。良いですね。</p>
<h3>Shell</h3>
<h4>KnownFoldersBrowser</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb13.png" width="244" height="184" /></a></p>
<p>既知のフォルダ？（<a href="http://msdn.microsoft.com/en-us/library/bb776911(VS.85).aspx">knownFolders</a>）の一覧を表示するデモ。一覧はMicrosoft.WindowsAPICodePack.Shell.KnownFoldersクラスで取得しています。knownFoldersはVistaで導入されたものらしい。また、standard foldersとは異なり、ベンダが追加（削除）することができるらしい。knownFoldersについて詳しくは<a href="http://msdn.microsoft.com/en-us/library/bb776911(VS.85).aspx">MSDNのknownFoldersについてのページ</a>を参照のこと。</p>
<h4>PropertyEdit</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb14.png" width="244" height="178" /></a></p>
<p>ファイルのプロパティを操作するデモ</p>
<h4>ShellHierarchyTreeDemo</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb15.png" width="244" height="142" /></a>&#160;</p>
<p>階層ツリーのデモ</p>
<h4>ShellObjectCFDBrowser</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb16.png" width="244" height="158" /></a> <a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image17.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb17.png" width="244" height="184" /></a></p>
<p>CommonFileDialogのデモ。表示する場所の初期値として設定できるのはフォルダだけではないのが特徴。<a href="http://msdn.microsoft.com/ja-jp/windows/dd459213.aspx#14">Windows 7で追加された「ライブラリ」</a>を初期値として設定出来たり、検索条件を初期値として指定して開くことが出来ます。これはちょっと感動ものでした。二枚目のSSは検索条件として「最近使ったファイル」という条件を付加して開いたCommonFileDialog。</p>
<h4>StarBackUp</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/06/image27.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/06/image27_thumb.png" width="404" height="186" /></a> </p>
<p>いまいちよくわからない。フォルダ選択ダイアログのサンプル？</p>
<h4>StockIconsDemo</h4>
<p>システムのアイコンを取得するのに使えるMicrosoft.WindowsAPICodePack.StockIconsクラスのデモ</p>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image19.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb19.png" width="244" height="223" /></a> </p>
<h4>TaskBarDemo</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image20.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb20.png" width="205" height="284" /></a><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image21.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb21.png" width="146" height="150" /></a>&#160; <a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image22.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb22.png" width="244" height="222" /></a> </p>
<p>Windows7でのタスクバーでの通知を活用するためのデモ。タスクバー上でのプログレス表示や、ジャンプリストの作成のデモなど。</p>
<h4>ThumbnailBrowserDemo</h4>
<p><a rel="lightbox" href="http://blog.sharplab.net/wp-content/uploads/2009/05/image23.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-thumb23.png" width="244" height="161" /></a></p>
<p>選択された要素のサムネイルをMicrosoft.WindowsAPICodePack.Shell.ShellObjectクラスのThumbnailプロパティから取得してPictureBoxに描画するサンプル。</p>
<h3>センサー プラットフォーム API</h3>
<p>サンプル動かそうとしたら落ちた。まぁ対応するセンサデバイスがないわけだから当然ですね。 </p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
<h3>拡張言語サービス API</h3>
<blockquote><h5>多言語ユーザー インターフェイスのサポートと言語サービス</h5>
<p>Windows 7 は、多言語ユーザー インターフェイスのサポートを強化し、アプリケーションから言語サービスを利用できるようにすることで、開発者がスタンダードな手法で国際市場に向けたアプリケーションを作成できるようになっています。</p>
<p>Extended Linguistic Services は、小規模の同じAPI 群を使用して、さまざまな先進の言語機能を有効活用できる、Windows 7 の新機能です。開発者は Extended Linguistic Services の API を使用することにより、任意の Unicode テキストから言語を自動検出し、その情報を元にして適切な言語が選択されるような、世界中のユーザーが快適に利用できるしくみを構築できます。 Extended Linguistic Services には、テキストの書記体系を変換する、組み込みの表記変換機能もサポートされています。たとえば、簡体字中国語と繁体字中国語間でテキストを自動的に変換すれば、言語の境界を越えた相互コミュニケーションを促進することが可能です。 Extended Linguistic Services の API を使用することにより、開発者は、既存の Extended Linguistic Services に加え、将来、新しいサービスが公開されたときには、新たにコードを覚え直すことなく、必要なサービスを選ぶだけで済むようになります。</p>
<p><a href="http://msdn.microsoft.com/ja-jp/windows/dd459213.aspx">Windows 7 開発者ガイド</a></p>
</blockquote>
<p>この機能を利用するためのものみたい。あんまり弄れてないです。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/cprograming/3148/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Android</title>
		<link>http://blog.sharplab.net/computer/hardware/3121/</link>
		<comments>http://blog.sharplab.net/computer/hardware/3121/#comments</comments>
		<pubDate>Thu, 21 May 2009 13:04:09 +0000</pubDate>
		<dc:creator>shiroica</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Andoroid]]></category>

		<guid isPermaLink="false">http://blog.sharplab.net/computer/hardware/3121/</guid>
		<description><![CDATA[

いつの間にかに大学の研究室で先生がGoogle AndroidのDev Phone 1を買っていました。別に自分が使うわけじゃないですが、ちょこちょこ弄らせてもらったり。しかしUI関係の研究室でもないのに、何に使うん [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="IMAGE_262" border="0" alt="IMAGE_262" align="left" src="http://blog.sharplab.net/wp-content/uploads/2009/05/image-262.jpg" width="244" height="324" />
</p>
<p>いつの間にかに大学の研究室で先生がGoogle AndroidのDev Phone 1を買っていました。別に自分が使うわけじゃないですが、ちょこちょこ弄らせてもらったり。しかしUI関係の研究室でもないのに、何に使うんだろ。</p>
<p>やっぱいいなぁAndroid。いいなぁいいなぁいいなぁ･･･。Touch Diamond買ってなければ絶対に今度docomoから出るAndroid端末買ってましたよ。はぁ･･･。</p>
<p>まぁいいさ、色々なことに手を出しても仕方ない。自分はWPF/Silverlightを頑張ろう。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharplab.net/computer/hardware/3121/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
