Mac OS X LionでQuickTime形式の動画をWMVにエンコードする方法

普通にhomebrewでffmpegをインストールすると失敗するので、ここ*1を参考にffmpegをインストール

brew install --use-clang --HEAD ffmpeg

QuickTimeの動画をWMV形式に変換

ffmpeg -i in.mov -vcodec wmv1 -b:v 2400k out1.wmv

Apache SSL Setting

Ubuntu10.04 Netbook Edition でSSLサーバ(apache2.2.14)を立てたときの覚書。

インストール

$apt-get intall apache2

設定ファイル

$/etc/apache2/

コマンド

$/etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}

モジュールの追加

$a2enmod ssl

SSL

俺々証明書作成

$make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /path/to/cert-file.crt

この辺のことは/usr/share/doc/apache2/README.Debian.gzに書いている。

$zless /usr/share/doc/apache2/README.Debian.gz

haru-sさん感謝HTTPS接続のための証明書作成方法(Apache2 + SSL) - Debian [Lenny] - ...ing logging 4.0

/etc/apache2/sites-enabled/default-sslに証明書を設定

SSLCertificateFile /path/to/cert-file.crt

Basic認証の設定は本家サイトを参照http://httpd.apache.org/docs/2.2/ja/howto/auth.html

ルータ設定

Mizushimaさん感謝http://mizushima.ne.jp/Windows/port/CTU/premium.php


大体こんな感じ、だったはず。
apache2の設定は、色々情報があふれているけど、環境やバージョンの違いのせいだと思うけど、結局は、/usr/share/doc/apache2配下のドキュメントが役に立った。

VB.NET 複数のExcelファイルのシートをコピーして、1つのファイルにまとめるサンプルソース

会社の後輩へ向けたサンプルソースです。

バグが入っていませんように(-人-)

Imports Microsoft.Office.Interop
Imports System.IO

Public Class ExcelSheetMerge

#Region "複数のExcelファイルにあるシートを1つのExcelファイルにまとめる"
    Public Shared Sub CreateMergedFile(ByRef filePath() As String, ByRef savePath As String)
        Dim xlApp As Excel.Application = Nothing
        Dim xlBooks As Excel.Workbooks = Nothing
        Dim xlTargetBook As Excel.Workbook = Nothing
        Dim xlTargetSheets As Excel.Sheets = Nothing
        Dim xlTargetTailSheet As Excel.Worksheet = Nothing

        Try
            ' Excelアプリケーション起動
            xlApp = New Excel.Application()
            xlBooks = xlApp.Workbooks

            ' Excel終了時にダイアログを表示しないように設定
            xlApp.DisplayAlerts = False

            ' マージ先のワークブックを作成
            ' テンプレートを指定することでデフォルトで存在するシートを1つにする。
            xlTargetBook = xlBooks.Add(Excel.XlWBATemplate.xlWBATWorksheet)
            xlTargetSheets = xlTargetBook.Sheets

            ' シートを末尾に追加していくため、最後のシートを取得
            xlTargetTailSheet = DirectCast(xlTargetSheets("Sheet1"), Excel.Worksheet)

            For Each aFilePath As String In filePath
                Dim xlSourceBook As Excel.Workbook = Nothing
                Dim xlSourceSheets As Excel.Sheets = Nothing

                Try
                    ' シートのコピー元のブックを開く
                    xlSourceBook = xlBooks.Open(aFilePath, UpdateLinks:=False)
                    xlSourceSheets = xlSourceBook.Sheets

                    ' 各シートをマージ先にコピーする
                    xlSourceSheets.Copy(After:=xlTargetTailSheet)
                    Util.MRComObject(DirectCast(xlTargetTailSheet, Object))
                    xlTargetTailSheet = DirectCast(xlTargetSheets(xlTargetSheets.Count), Excel.Worksheet)

                Finally
                    If Not xlSourceSheets Is Nothing Then
                        Util.MRComObject(DirectCast(xlSourceSheets, Object))
                    End If
                    If Not xlSourceBook Is Nothing Then
                        xlSourceBook.Close(SaveChanges:=False)
                        Util.MRComObject(DirectCast(xlSourceBook, Object))
                    End If
                End Try
            Next

            ' シートのコピー開始前から存在するデフォルトのシート「Sheet1」を削除する。
            Dim xlSheet1 As Excel.Worksheet = Nothing
            Try
                xlSheet1 = DirectCast(xlTargetSheets("Sheet1"), Excel.Worksheet)
                xlSheet1.Delete()
            Finally
                If Not xlSheet1 Is Nothing Then
                    Util.MRComObject(DirectCast(xlSheet1, Object))
                End If
            End Try

            ' マージしたExcelファイルを保存
            xlTargetBook.SaveAs(Filename:=savePath)
        Finally
            If Not xlTargetTailSheet Is Nothing Then
                Util.MRComObject(DirectCast(xlTargetTailSheet, Object))
            End If
            If Not xlTargetSheets Is Nothing Then
                Util.MRComObject(DirectCast(xlTargetSheets, Object))
            End If
            If Not xlTargetBook Is Nothing Then
                xlTargetBook.Close()
                Util.MRComObject(DirectCast(xlTargetBook, Object))
            End If
            If Not xlBooks Is Nothing Then
                Util.MRComObject(DirectCast(xlBooks, Object))
            End If
            If Not xlApp Is Nothing Then
                xlApp.Quit()
                xlApp.DisplayAlerts = True
                Util.MRComObject(DirectCast(xlApp, Object))
            End If
        End Try

    End Sub
#End Region

End Class