This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <Windows.h> | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
TCHAR commandLine[MAX_PATH] = { 0 }; | |
HDESK hOldDesk, hInputDesk, hNewDesk; | |
STARTUPINFO si; | |
PROCESS_INFORMATION pi; | |
BOOL success; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Data | |
Imports System.Runtime.CompilerServices | |
Imports Common.Logging | |
Public Class DbLoggingWrapper | |
Private Shared _logger As ILog | |
Public Shared Property Logger As ILog | |
Get | |
If _logger Is Nothing Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Net | |
open System.Net.Sockets | |
type IpMessenger (port: int) = | |
let client = new UdpClient(port) | |
let random = new Random(Environment.TickCount) | |
let nextId = fun () -> random.Next(0, 1000) | |
let sendBuffer (address: IPAddress, message: Byte[]) = | |
client.Send(message, message.Length, new IPEndPoint(address, 2425)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Class EnumerableEx | |
{ | |
} |
別に TaskCompletionSource でハマったわけではないですが、TaskCompletionSource で作成したタスクを Async/Await で待ったときにハマってしまった。
元々、OPC Automation で非同期入出力が、コマンドに対しイベントで完了を通知していますので、TaskCompletionSource を使って Task にする説明を考えていました。
最初に、チョロット書こうとしていたことを事実を捻じ曲げて説明します。(本当は引数等が違います。) OPC Automation では、AsyncRead に対し完了を AsyncReadComplete イベントで通知し、操作のキャンセルも AsyncCancel に対し AsyncCancelComplete で完了を通知しています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var connection = ConnectionMultiplexer.Connect("192.168.5.40"); | |
var sx1 = connection.ObservableSubscription("pa"); | |
using (sx1.Subscribe(_ => Console.WriteLine(_))) Console.ReadLine(); | |
var sx2 = connection.ObservableList("qa", TimeSpan.FromSeconds(5)); | |
using (sx2.Subscribe(_ => Console.WriteLine(_))) Console.ReadLine(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.ComponentModel | |
Public Class Form1 | |
Private _model As New Model() | |
Public Sub New() | |
InitializeComponent() |