2007年9月27日木曜日

Excelにてカタカナを全角、英数記号を半角に変換する。


'rwmin : 開始行
'rwmax : 終了行
'col : 列番号
Sub change(rwstart as integer,rwend as integer,col as integer)
Dim i As Integer
Dim j As Integer
Dim result As String
Dim temp As String

For i = rwstart To rwend
result = ""
For j = 1 To Len(Cells(i, col))
temp = Mid(Cells(i, col), j, 1)
temp = StrConv(temp, vbNarrow)
If (Asc(temp) >= &HA6) And (Asc(temp) <= &HDF) Then
temp = StrConv(temp, vbWide)
  End If
  result = result + temp
     Next j
     Cells(i, col) = result
   Next i
End Sub

2007年9月10日月曜日

postfixをサテライトシステムとして設定する

他のメールサーバーで受信を行い、自分では受信しないサテライトシステムとして
postfixを設定するためには、下記の手順を行う。
(1)sudo dpkg-reconfigure postfix
(2)説明画面にて<了解>を押下。
(3)タイプ選択画面にて"サテライトシステム"を選択。
(4)rootの送り先設定として、自分のユーザを設定。
(5)メール名として、ドメイン名を設定する。
(6)SMTPリレーホストとして、メールサーバーのIPアドレスを指定する。
(7)メールを受け取る他の宛先は空にする。
(8)「メールキューの同期更新を強制しますか?」では<いいえ>を選択する。
(9)「ローカルネットワークは何ですか?」ではデフォルト(127.0.0.0/8[::1]/128)を設定。
(10)メールボックスのサイズの制限では0を設定。
(11)ローカルアドレス拡張文字には+を設定。
(12)プロトコル選択はすべてを選択。

2007年9月8日土曜日

JavaでZip圧縮する方法

<サンプル>

ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(
new FileOutputStream("sample.zip")));


//圧縮するファイルを書き込む。(A)
out.putNextEntry(new ZipEntry("sample.txt"));
BufferedInputStream in = new BufferedInputStream(new FileInputStream("sample.txt"));

while(true) {
int b = in.read();
if (b < 0) {
break;
}
out.write(b);
}

in.close();

out.closeEntry();

//他のファイルを圧縮する場合はから繰り返す。(A)

out.close();