qshinoの日記

Powershell関係と徒然なこと

EtherIP/IPsec

EtherIP/IPsec

Softether + IX2000シリーズ。

  • ike mode aggressive
  • ipsec mode tunnel
  • ike id 入力値
  • pre-shared-key 入力値

  • peer se側 恐らくany

  • peer ix側 seのIP
  • nat traversal on

  • ike aes / sha DH group2/ 1024bit

  • ipsec aes/sha

パケット

  • 元 eth ip0 payload
  • eip: ip1 eip eth ip0 payload
  • eip/tunnel ip2 esp ip1 eip eth ip0
  • eip/natt ip2 udp esp ip1 eip eth ip0

ip2 = peer ip1 = ??? ip0 = private

使用ポート

参考

https://ja.m.wikipedia.org/wiki/NAT_traversal

Windows Installer作成ツール

Windows Installer作成ツール

主なツールは下記の通り。

  1. WiX Toolset
  2. Inno Setup
  3. Nullsoft Scriptable Install System (NSIS)

WiXのみ、WindowsInstallの仕組みを利用している。

WiXが難しそうなので、トライして撃退されたらInno Setupが良さそうな雰囲気。取り敢えず、3つを調べた上で最終的に採用するものを決める。

参考

wix チュートリアル

http://wix-tutorial-ja.github.io/preface.html

wix 使い方

https://codezine.jp/article/detail/428

https://msdn.microsoft.com/ja-jp/library/bb164671.aspx

http://qiita.com/tohshima/items/314143d605f8ae1e0d87

PowerShell Action delegate

PowerShell Action delegate

Action/Funcはdelegate

  • Action : 戻り値なし、引数なし。
  • Action: 戻り値なし、引数1
  • Func<T,TResult: 戻り値1,引数1

PowerShellでは

  • [action]
  • [action[int]]
  • [func[int][int]] ?
  • or func[int,int]] ?

Funcの例

Func<T,TResult>

using System;

public class GenericFunc
{
   public static void Main()
   {
      // Instantiate delegate to reference UppercaseString method
      Func<string, string> convertMethod = UppercaseString;
      string name = "Dakota";
      // Use delegate instance to call UppercaseString method
      Console.WriteLine(convertMethod(name));
   }

   private static string UppercaseString(string inputString)
   {
      return inputString.ToUpper();
   }
}

参考

Powershell delegate

http://stackoverflow.com/questions/19849848/powershell-how-to-create-a-delegate

System.Action

https://msdn.microsoft.com/ja-jp/library/system.action(v=vs.110).aspx

System.Action

https://msdn.microsoft.com/ja-jp/library/018hxwa8(v=vs.110).aspx

System.Func<T,TResult>

https://msdn.microsoft.com/ja-jp/library/bb549151(v=vs.110).aspx

wpfクリップボード

wpfクリップボードを使う。

クリップボードへのテキストコピーは、

Clipboard.SetData(DataFormats.Text, (Object)txet);

取り出すには、同様にGetDataを用いる。

サンプル

// copy string
string textData = "Hinan.";

// To clipboard
Clipboard.SetData(DataFormats.Text, (Object)textData);

参考

System.Windows.Clipboard

Assembly: PresentationCore

https://msdn.microsoft.com/ja-jp/library/system.windows.clipboard(v=vs.110).aspx

http://anis774.net/codevault/clipboardwatcherwpf.html

http://blog.hiros-dot.net/?page_id=3797

http://blog.hiros-dot.net/?page_id=3797

http://dobon.net/vb/dotnet/string/clipboard.html

以上

wpf window owner property

owner property

Windowの親子関係と振る舞い。親子関係は、子のowner propertyに親を設定する事で決まる。親子関係を設定した場合、どちらかのウインドウの振る舞いが他に影響する。未設定の場合は影響しない。また、ユーザープログラムが子ウインドウのownerプロパティを設定する。親のOwnedWindows propertyのアクセスはgetのみであり、外部から設定できない。子のowner propertyが反映される模様。

親子関係

親子関係は自動では設定されず、ユーザープログラムで設定する。

未設定時の振る舞い

どちらかのウインドウのclose/minimize/maximizeによる親子ウインドウへの影響なし。タスクバーではそれぞれ別ウインドウとして表示される。

設定時の振る舞い

和訳 1. 親を最小化するとすべての子も最小化される。 2. 子を最小化しても親には影響なし。 3. 親を最大化すると、親子全てが元に戻る。 4. 親は子を覆わない。 5. ShowDialogで開かれなかった子はモードレス。子を開いても親は入力を受け付ける。 6. 親を閉じると全ての子が閉じられる 7. show()で開いた子に対しては、親を閉じてもClosing eventが送られない。

英文

    1. If an owner window is minimized, all its owned windows are minimized as well.
  • If an owned window is minimized, its owner is not minimized.
  • If an owner window is maximized, both the owner window and its owned windows are restored.
  • An owner window can never cover an owned window.
  • Owned windows that were not opened using ShowDialog are not modal. The user can still interact with the owner window.
  • If you close an owner window, its owned windows are also closed.
  • If an owned window was opened by its owner window using Show, and the owner window is closed, the owned window’s Closing event is not raised.

重要

子をShowDialog()で表示した場合も、親子関係を設定する事。自動では設定されない。

設定方法 C#
// Create a window and make this window its owner
Window ownedWindow = new Window();
ownedWindow.Owner = this;
ownedWindow.Show();

CSS練習

CSSの練習

h1. だけ。

影使ったもの

h1 {
    padding: .5em .75em;
    background-color: #f6f6f6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

番号付き

body {
    counter-reset: secno
}
section {
    counter-increment: secno;
}
h1 {
    position: relative;
    padding: 0 0 .5em 2em;
    border-bottom: 1px solid #ccc;
}
h1::before {
    content: counter(secno);
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    border-radius: 100%;
    font-size: .10em;
    text-align: center;
    background-color: #ccc;
    color: #fff;
}

影その二

h1 {
    padding: .5em .75em;
    background: #f4f4f4;
    border-top: 1px dashed #ccc;
    border-bottom: 1px dashed #ccc;
    box-shadow: 0 7px 10px -5px rgba(0, 0, 0, .1) inset;
}

影と番号

body {
    counter-reset: secno;
}
section {
    counter-increment: secno;
}
h1 {
    padding: 0 0 .5em 2em;
    background: #f4f4f4;
    border-top: 1px dashed #ccc;
    border-bottom: 1px dashed #ccc;
    box-shadow: 0 7px 10px -5px rgba(0, 0, 0, .1) inset;
}

h1::before {
    position: absolute;
    top: 0;
    left: 0;
    content: counter(secno);
    width: 30px;
    height: 30px;
    line-height: 30px;
    background-color: #ccc;
    border-radius: 100%;
    color: #fff;
    font-size: .10em;
    text-align: center;
}

参考

https://nelog.jp/wordpress-h1-h6