忍者ブログ
  • 2024.04«
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • » 2024.06
[PR]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

【2024/05/20 10:45 】 |
ibusでAnthyを使う
■インストール
# apt install anthy ibus-anthy

■設定
1. ibus用設定を開く
$ ibus-setup
2. 「Input Method」にAnthyを追加する。

拍手[0回]

PR
【2018/12/10 21:11 】 | Ubuntu | 有り難いご意見(0)
GTKのフォント
それぞれの形式でファイルに設定する。
■gtk-3.0
~/.config/gtk-3.0/settings.ini
[Settings]
gtk-font-name = IPAPGothic 14

■gtk-2.0
style "default" {
    font_name = "IPAPGothic 14"
}
class "GtkWidget"    style "default"

拍手[0回]

【2018/12/10 21:07 】 | linux | 有り難いご意見(0)
LVMを試してみる
もうパーティションの開始アドレスとかを気にしなくても良くなるLVMを試してみた。

LVMは物理ボリュームをグローバルボリュームとしてまとめ、論理ボリュームとして切り出して使うイメージだ。
これの使い道はkvmのディスク等いろいろ使えそう
PV(=物理ボリューム) ⊆ GV(=グローバルボリューム) ⊇ LV(論理ボリューム)
(1)物理ボリュームを作成
※lvmに使うパーティションはpartedでset n lvm onをしておく。
# pvcreate /dev/sda1
(2)ボリュームグループを作成
# vgcreate VG_SDA /dev/sda1
(3)論理ボリュームを作成
# lvcreate -L 40G -n home.cur VG_SDA
確認例
# vgdisplay -v
  --- Volume group ---
  VG Name               VG_SDA
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <1.82 TiB
  PE Size               4.00 MiB
  Total PE              476932
  Alloc PE / Size       111216 / <434.44 GiB
  Free  PE / Size       365716 / <1.40 TiB
  VG UUID               GKpSTs-Mwtn-KBYo-ieDQ-XhFa-3ZVh-oY8x5G
   
  --- Logical volume ---
  LV Path                /dev/VG_SDA/home.cur
  LV Name                home.cur
  VG Name                VG_SDA
  LV UUID                MRDH1I-KKj7-YcVO-ztDI-bfcO-I8yz-eh6GOv
  LV Write Access        read/write
  LV Creation host, time pc001, 2018-12-02 19:06:34 +0900
  LV Status              available
  # open                 1
  LV Size                40.00 GiB
  Current LE             10240
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/VG_SDA/win10.img
  LV Name                win10.img
  VG Name                VG_SDA
  LV UUID                EEdeJ1-SZWa-YaqP-SJLK-vd4n-wVjh-ASrj85
  LV Write Access        read/write
  LV Creation host, time pc001, 2018-12-08 08:10:55 +0900
  LV Status              available
  # open                 0
  LV Size                <94.44 GiB
  Current LE             24176
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/VG_SDA/work
  LV Name                work
  VG Name                VG_SDA
  LV UUID                Z3vbrP-G9sc-7OLk-oTsV-CheY-Wy45-QT6z1b
  LV Write Access        read/write
  LV Creation host, time pc001, 2018-12-08 08:13:21 +0900
  LV Status              available
  # open                 1
  LV Size                200.00 GiB
  Current LE             51200
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
   
  --- Logical volume ---
  LV Path                /dev/VG_SDA/win_work.img
  LV Name                win_work.img
  VG Name                VG_SDA
  LV UUID                5AC5rm-eo20-jNL3-b9XH-BfFe-yusp-adobt8
  LV Write Access        read/write
  LV Creation host, time pc001, 2018-12-08 10:43:29 +0900
  LV Status              available
  # open                 1
  LV Size                100.00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
   
  --- Physical volumes ---
  PV Name               /dev/sda1     
  PV UUID               4QkoE0-5YNL-LOi7-qwci-jJE6-yAvh-8fnv0Q
  PV Status             allocatable
  Total PE / Free PE    476932 / 365716
   

拍手[0回]

【2018/12/08 12:16 】 | linux | 有り難いご意見(0)
重複して始まらないBeginAcceptTcpClient その2
BeginAcceptTcpClientについて、スレッドIDを取得してみた。
子スレッドは2つまで?うむむ。

ソース
Imports System.Net.Sockets

Imports System.Threading


Public Class TestNet
    ' Thread signal.
    Public Shared tcpClientConnected As New ManualResetEvent(False)
    Public Shared Sub dp(s As String, ParamArray a() As String)
        SyncLock tcpClientConnected
            Debug.Print(s, a)
        End SyncLock
    End Sub
    Public Sub TestServerAndClient()
        Dim client As Thread

        Dim procClient As Action(Of Byte) _
            = Sub(aByte As Byte)
                  client = New Thread(New ThreadStart(Sub()
                                                          Thread.Sleep(1000)

                                                          Dim sckClient As TcpClient
                                                          sckClient = New TcpClient()
                                                          dp("cl connect {0}-{1}", Now, aByte)
                                                          sckClient.Connect(Net.IPAddress.Loopback, 9000)
                                                          sckClient.GetStream().WriteByte(aByte)
                                                      End Sub))
                  client.Start()
              End Sub
        procClient(0)
        procClient(1)
        procClient(2)
        procClient(3)
        procClient(4)

        Dim tl As TcpListener = New TcpListener(Net.IPAddress.Loopback, 9000)
        tl.Start(3)
        DoBeginAcceptTcpClient(tl)
        dp("sv connect")
        DoBeginAcceptTcpClient(tl)
        dp("sv connect")
        DoBeginAcceptTcpClient(tl)
        dp("sv connect")
        DoBeginAcceptTcpClient(tl)
        dp("sv connect")
        DoBeginAcceptTcpClient(tl)
        dp("sv connect")
    End Sub

    Public Shared Sub DoBeginAcceptTcpClient(listener As TcpListener)
        tcpClientConnected.Reset()
        listener.BeginAcceptTcpClient(New AsyncCallback(AddressOf DoAcceptTcpClientCallback), listener)
        tcpClientConnected.WaitOne()
    End Sub


    Public Shared Sub DoAcceptTcpClientCallback(ar As IAsyncResult)
        Dim listener As TcpListener = CType(ar.AsyncState, TcpListener)
        Dim client As TcpClient = listener.EndAcceptTcpClient(ar)
        tcpClientConnected.Set()
        Dim bt As Byte = client.GetStream().ReadByte()
        dp("child accept {0}-{1} Start {2}", Now, bt, Thread.CurrentThread.ManagedThreadId)
        Thread.Sleep(3000)
        dp("child accept {0}-{1} End", Now, bt)
        client.GetStream().Close()
    End Sub

End Class


cl connect 2018/03/21 5:46:56-1
cl connect 2018/03/21 5:46:56-2
cl connect 2018/03/21 5:46:56-3
cl connect 2018/03/21 5:46:56-4
スレッド 0x514 はコード 0 (0x0) で終了しました。
スレッド 0x126c はコード 0 (0x0) で終了しました。
スレッド 0x600 はコード 0 (0x0) で終了しました。
child accept 2018/03/21 5:46:57-1 Start 16
スレッド 0x1384 はコード 0 (0x0) で終了しました。
sv connect
cl connect 2018/03/21 5:46:56-0
child accept 2018/03/21 5:46:57-2 Start 9
スレッド 0x2948 はコード 0 (0x0) で終了しました。
child accept 2018/03/21 5:47:00-1 End
child accept 2018/03/21 5:47:00-2 End
sv connect
child accept 2018/03/21 5:47:00-3 Start 9
child accept 2018/03/21 5:47:03-3 End
sv connect
child accept 2018/03/21 5:47:03-4 Start 9
child accept 2018/03/21 5:47:06-4 End
sv connect
child accept 2018/03/21 5:47:06-0 Start 9
child accept 2018/03/21 5:47:09-0 End
sv connect
プログラム '[6396] NetTest.vshost.exe' はコード -1 (0xffffffff) で終了しました。

拍手[0回]

【2018/03/21 06:01 】 | javascript | 有り難いご意見(3)
重複して始まらないBeginAcceptTcpClient
EndAcceptTcpClientごとにスレッドが作成されるのかと思ったら、1スレッドしか作成できないらしい。何のための非同期なんだろう。。。1つ目のTcpClient作成後に、別の要求があっても2つ目のスレッドは作成されないで1つ目のTcpClientが終了するまでコールバックが呼ばれない。。。うむむ。
Public Sub run()

  Dim socks As clsSocket() = New clsSocket(1) {}
  Dim waits As Threading.WaitHandle() = New Threading.WaitHandle(socks.Length - 1) {}
  Debug.Print(Threading.Thread.CurrentThread.ManagedThreadId)
  mServer.Start(socks.Length - 1)
  Do
    For i As Integer = 0 To socks.Length - 1
      Dim wrkIdx As Integer = i
      If waits(wrkIdx) Is Nothing Then

        socks(wrkIdx) = New clsSocket(mIGetMessage)
        waits(wrkIdx) = mServer.BeginAcceptTcpClient(Sub(aISyncResult As IAsyncResult)

                                 Debug.Print(Threading.Thread.CurrentThread.ManagedThreadId)
                                 socks(wrkIdx).Begin(mServer.EndAcceptTcpClient(aISyncResult).GetStream())

                               End Sub, Nothing).AsyncWaitHandle

      End If
    Next

    waits(Threading.EventWaitHandle.WaitAny(waits)) = Nothing
  Loop

End Sub

拍手[0回]

【2018/03/18 13:48 】 | javascript | 有り難いご意見(2)
前ページ | ホーム | 次ページ

忍者ブログ [PR]