2018年11月2日 <pre class="src"> ○cpp/cli Distionary // ConsoleApplication1.cpp : メイン プロジェクト ファイルです。 #include "stdafx.h" using namespace System; using namespace Collections::Generic; int main(array<System::String ^> ^args) { Console::WriteLine(L"Hello World"); #if 0 List<String^>^ a = gcnew List<String^>; //a->Add("1"); //a->Add("2"); //a->Add("3"); //a->Add("4"); //a->Add("5"); for(int i = a->Count-1; i>=0; i--) { if(a[i]=="2") a->Remove(a[i]); if(a[i]=="4") a->Remove(a[i]); } for each (String^ var in a) { System::Diagnostics::Debug::WriteLine(var); } #endif Dictionary<String^, String^>^ aa = gcnew Dictionary<String^, String^>(); aa->Add("abc1","201"); aa->Add("abc2","202"); aa->Add("abc3","203"); String^ key = "abc4"; String^ b=nullptr; if (aa->ContainsKey(key)) b = aa[key]; System::Diagnostics::Debug::WriteLine(b); key = "abc2"; b=nullptr; if (aa->ContainsKey(key)) b = aa[key]; System::Diagnostics::Debug::WriteLine(b); key = "abc3"; aa->TryGetValue(key, b); System::Diagnostics::Debug::WriteLine(b); key = "abc5"; bool w = aa->TryGetValue(key, b); if(b==nullptr) System::Diagnostics::Debug::WriteLine("nullptr"+":"+w); else System::Diagnostics::Debug::WriteLine(b+":"+w); key = "abc1"; w = aa->TryGetValue(key, b); if(b==nullptr) System::Diagnostics::Debug::WriteLine("nullptr"); else System::Diagnostics::Debug::WriteLine(b+":"+w); return 0; } ○コールバック ========================================== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApplicationDelegate { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { Class1 cls1 = new Class1(); cls1.fn1(); } } } ========================================== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; //trace using WpfApplicationDelegate2; using System.Threading; //thread namespace WpfApplicationDelegate { class Class1 { public void fn1() { //Class2 cls2 = new Class2(); //cls2.fn2(callback2); Class3 cls3 = new Class3(); Trace.WriteLine(string.Format("start {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); cls3.fn3(callback2); Trace.WriteLine(string.Format("end {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); } //void callback3(int id, Object obj) //{ // Trace.WriteLine(string.Format("start {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); // Task.Run( () => callback2(id,obj) ); // Trace.WriteLine(string.Format("end {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); //} //void callback1(int id, Object obj) //{ // System.Windows.Application.Current.Dispatcher.BeginInvoke( // (Action)(() => { callback2(id,obj); })); //} void callback2(int id, Object obj) { Trace.WriteLine(string.Format("start {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); Thread.Sleep(3000); Class3.Data3 data = obj as Class3.Data3; Trace.WriteLine(string.Format("id={0}",id)); Trace.WriteLine(string.Format("end {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); } } } ========================================== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WpfApplicationDelegate { class Class2 { public void fn2(Action<int> callbk) { callbk(278); } } } ========================================== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace WpfApplicationDelegate2 { public class Class3 { public class Data1 { public string s1; public int i2; }; public class Data2 { public int i2; public string s1; }; public class Data3 { public Data1 data1; public Data2 data2; }; public void fn3(Action<int, Object> callbk) { Data1 data1 = new Data1(); data1.s1 = "abc"; data1.i2 = 45; Data2 data2 = new Data2(); data2.i2 = 678; Data3 data3 = new Data3(); data3.data1 = data1; data3.data2 = data2; //Trace.WriteLine(string.Format("start {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); //callbk(367, data3); //Trace.WriteLine(string.Format("end {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); Trace.WriteLine(string.Format("start {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); Task.Run( () => callbk(368,data3) ); Trace.WriteLine(string.Format("end {0}:{1}", this.GetType().ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name)); } } } ========================================== =============================================================================== ○ワーカスレッドから呼び出し側スレッドのメソッド実行 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Threading; using System.Windows.Threading; namespace WpfApplication1 { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public Action<int,string> dgUpdateText; Class1 cls1; public MainWindow() { InitializeComponent(); btn1.Focus(); dgUpdateText = (v,s) => { Dispatcher.BeginInvoke( (Action<int,string>)((x,y) => OnUpdateText(x,y)), v,s ); }; cls1 = new Class1(dgUpdateText); } private void OnUpdateText(int v, string s) { prg1.Value = v; prg1.DataContext = s; Console.WriteLine(v.ToString()+":"+s); } private void Button_Click(object sender, RoutedEventArgs e) { cls1.func101(); } } } =============================================================================== using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ClassLibrary2; namespace WpfApplication1 { class Class1 { public Action<int,string> dgUpdateText; public Class1(Action<int,string> ope) { dgUpdateText = ope; } public async void func101() { await Task.Run(() => { workerThread1(dgUpdateText); }); Console.WriteLine("thread1...end"); } void workerThread1(Action<int,string> ope) { Class2 class2 = new Class2(); Console.WriteLine("--"); foreach (var index in Enumerable.Range(0, 11)) { Console.WriteLine(index); //ope(index*10,"ssss"); class2.func1(ope); System.Threading.Thread.Sleep(250); } Console.WriteLine("finish"); } } } =============================================================================== // これは メイン DLL ファイルです。 #include "stdafx.h" #include "ClassLibrary2.h" using System::Threading::Thread; void ClassLibrary2::Class2::func1(Action<int,String^>^ ope) { for(int i=0; i<11; i++) { ope(i*10,"zzz"); Thread::Sleep(250); } } =============================================================================== // ClassLibrary2.h #pragma once using namespace System; namespace ClassLibrary2 { public ref class Class2 { // TODO: このクラスの、ユーザーのメソッドをここに追加してください。 public: void func1(Action<int,String^>^ ope); }; } ○msbuild MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug;TargetFrameworkVersion=v3.5 ○statusbar <Window x:Class="statusbar.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Width="525" Height="200"> <Grid> <StatusBar Name="StatusBar1" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Background="LightGray"> <StatusBarItem> <StackPanel Orientation="Horizontal"> <Label Width="50" Height="25" VerticalAlignment="Bottom" Background="LightGray" BorderBrush="LightGray" BorderThickness="1" Content="国国国" /> <TextBlock Text="国国国" /> <ProgressBar x:Name="progressBar" Width="100" Height="20" Background="LightGray" BorderBrush="LightGray" IsIndeterminate="True" Visibility="Hidden" /> </StackPanel> </StatusBarItem> <StatusBarItem HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal"> <Label Width="50" Height="25" VerticalAlignment="Bottom" Background="LightGray" BorderBrush="LightGray" Content="bbb" /> <Label Width="50" Height="25" VerticalAlignment="Bottom" Background="LightGray" BorderBrush="LightGray" Content="ccc" /> </StackPanel> </StatusBarItem> </StatusBar> <Button Width="75" Margin="5,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click" Content="Button" /> <ListBox Name="lb1" HorizontalAlignment="Left" Height="129" Margin="127,10,0,0" VerticalAlignment="Top" Width="100"/> <Button Content="Button" HorizontalAlignment="Left" Margin="253,60,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/> </Grid> </Window> ------------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace statusbar { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); lb1.Items.Add("a1"); lb1.Items.Add("a2"); lb1.Items.Add("a3"); lb1.SelectedValue = "a2"; lb1.IsEnabled = false; } private async void Button_Click(object sender, RoutedEventArgs e) { progressBar.IsIndeterminate = false; progressBar.Value = 0; progressBar.Maximum = 100; progressBar.Visibility = Visibility.Visible; foreach (var index in Enumerable.Range(0, 10)) { progressBar.Value = index * 10; await Task.Delay(1000); } progressBar.Visibility = Visibility.Hidden; } private void Button_Click_1(object sender, RoutedEventArgs e) { lb1.IsEnabled = !lb1.IsEnabled; } } } ○非同期処理とキャンセル <Window x:Class="WpfApplication8.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Width="104" Height="128" Closing="Windows_Closing"> <Grid> <Button Name="btn1" Width="75" Margin="10,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click1" Content="実行" /> <Button Width="75" Margin="10,35,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click2" Content="一時停止" /> <Button Width="75" Margin="10,60,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click3" Content="キャンセル" /> </Grid> </Window> ---------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Diagnostics; using System.Threading; using System.Windows.Threading; namespace WpfApplication8 { /// <summary> /// MainWindow.xaml の相互作用ロジック /// </summary> public partial class MainWindow : Window { /// <summary> /// /// </summary> private bool asycExecute{get;set;} private CancellationTokenSource tokenSource{get;set;} //private ManualResetEvent mReset; private object asyncObject; /// <summary> /// /// </summary> public MainWindow() { InitializeComponent(); asycExecute = true; tokenSource = null; //mReset = new ManualResetEvent(true); asyncObject = new object(); btn1.Focus(); } /// <summary> /// /// </summary> private void Run() { Console.WriteLine("run...s"); var cancelToken = tokenSource.Token; //try { asyncMain(cancelToken, asyncObject); for (int i = 0; i < 12; i++) { //if (i == 2) Monitor.Enter(asyncObject); DoEvents(); Console.WriteLine((101 + i).ToString() + "------------------"); Thread.Sleep(1800); } if (Monitor.IsEntered(asyncObject)) Monitor.Exit(asyncObject); tokenSource.Cancel(); //Task.Factory.StartNew(() => MessageBox.Show("test")); Console.WriteLine("stopping"); //} catch (OperationCanceledException) { Console.WriteLine("canceled"); } Console.WriteLine("run...e"); } /// <summary> /// /// </summary> /// <param name="cancelToken"></param> /// <param name="asyncLockObj"></param> internal async void asyncMain(CancellationToken cancelToken, object asyncLockObj=null) { Console.WriteLine("asyncMain...s"); btn1.IsEnabled = false; DoEvents(); await Task.Run(() => asyncWork(cancelToken, asyncLockObj)); btn1.IsEnabled = true; DoEvents(); Console.WriteLine("asyncMain...e"); } /// <summary> /// /// </summary> /// <param name="cancelToken"></param> /// <param name="asyncLockObj"></param> private void asyncWork(CancellationToken cancelToken = new CancellationToken(), object asyncLockObj = null) { Console.WriteLine("asyncWork...s"); asycExecute = false; for (int i = 0; i < 100; i++) { if (asyncLockObj != null) { lock (asyncLockObj){ }; } //mReset.WaitOne(); try { cancelToken.ThrowIfCancellationRequested(); } catch(Exception) { Console.WriteLine("asyncWork cancel"); break; } //if (cancelToken.IsCancellationRequested) break; Console.WriteLine((201 + i).ToString()); Thread.Sleep(600); } Console.WriteLine("asyncWork...e"); } /// <summary> /// /// </summary> private void DoEvents() { DispatcherFrame frame = new DispatcherFrame(); var callback = new DispatcherOperationCallback(obj => { ((DispatcherFrame)obj).Continue = false; return null; }); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, callback, frame); Dispatcher.PushFrame(frame); } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Windows_Closing(object sender, System.ComponentModel.CancelEventArgs e) { tokenSource.Cancel(); Console.WriteLine("canceled"); } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click1(object sender, RoutedEventArgs e) { //ThreadPool.SetMaxThreads(20, 20); int workerThreads = 0, portThreads = 0; ThreadPool.GetMaxThreads(out workerThreads, out portThreads); Console.WriteLine("Worker threads={0}, Completion port threads={1}", workerThreads, portThreads); if (tokenSource != null) tokenSource.Dispose(); tokenSource = new CancellationTokenSource(); //if (asycExecute) Run(); else asyncWork(); Run(); } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click2(object sender, RoutedEventArgs e) { if (Monitor.IsEntered(asyncObject)) { Monitor.Exit(asyncObject); //resume Console.WriteLine("resume"); } else { Monitor.Enter(asyncObject); // pause Console.WriteLine("pause"); } } private void Button_Click3(object sender, RoutedEventArgs e) { tokenSource.Cancel(); } } } ○xml file read using Microsoft.Win32; using System.Xml; private void Button_Click_2(object sender, RoutedEventArgs e) { string kind = "3"; char sepa = ','; string res = GetParam(kind, sepa); if (res != string.Empty) { string[] param = res.Split(sepa); MessageBox.Show("kind : " + kind + "\n" + "param1 : " + param[0] + "\n" + "param2 : " + param[1]); } } private string GetParam(string target, char sepa) { string res = string.Empty; string xmlfile; OpenFileDialog ofd = new OpenFileDialog(); //string stCurrentDir = ""; string stCurrentDir = System.IO.Directory.GetCurrentDirectory() + @"\"; ofd.FileName = stCurrentDir + "aa.xml"; ofd.DefaultExt = "*.xml"; ofd.Filter = "XML Files (.xml)|*.xml"; if (ofd.ShowDialog() == true) { xmlfile = ofd.FileName; var xmlDoc = new XmlDocument(); try { xmlDoc.Load(xmlfile); var xmldata = xmlDoc.SelectNodes("test/api"); foreach (XmlNode line in xmldata) { var kind = line.Attributes["kind"].InnerText; if (kind == target) { int nodeCnt = 5; string[] str = new string[nodeCnt]; XmlNode item; for (int no = 0; no < nodeCnt; no++) { if ((item = line.SelectSingleNode("param/p" + (no + 1).ToString())) != null) { str[no] = item.InnerText; } res += str[no] + sepa; } //XmlNode item; //var p1 = string.Empty; //var p2 = string.Empty; //var p3 = string.Empty; //if ((item = line.SelectSingleNode("param/p1")) != null) { p1 = item.InnerText;} //if ((item = line.SelectSingleNode("param/p2")) != null) { p2 = item.InnerText; } //if ((item = line.SelectSingleNode("param/p3")) != null) { p3 = item.InnerText; } //res = p1 + sepa + p2 + sepa + p3; break; } } } catch (Exception e) { MessageBox.Show(e.Message); } } return res; } file : aa.xml <?xml version="1.0" encoding="utf-8" ?> <test> <api kind="1"> <param> <p1>para11国</p1> <!-- ああ --> <p2>para22</p2> </param> </api> <api kind="2"> <param> <p1>para21国</p1> <!-- ああ --> <p2>para22</p2> </param> </api> <api kind="3"> <param> <p1>para31国</p1> <!-- ああ --> <p2>para22</p2> </param> </api> </test> ○wpf Color var ThicknessSize = 3; var myThickness = new Thickness(ThicknessSize, ThicknessSize, ThicknessSize, ThicknessSize); SolidColorBrush brBlue = new SolidColorBrush(Colors.Blue); SolidColorBrush brWhite = new SolidColorBrush(Colors.White); SolidColorBrush brRed = new SolidColorBrush(Colors.Red); SolidColorBrush brSilver = new SolidColorBrush(Colors.Silver); var bc = new BrushConverter(); var bcBlue = bc.ConvertFrom("#0000EE"); var bcRed = bc.ConvertFrom("#FF0000"); var bcWhite = bc.ConvertFrom("#FFFFFF"); //this.txt2.Background = (Brush)bcBlue; //this.txt2.Foreground = (Brush)bcWhite; this.txt2.BorderThickness = myThickness; //this.txt2.BorderBrush = brSilver; //this.btn2.Background = brBlue; //this.btn2.Foreground = brWhite; this.btn2.BorderThickness = myThickness; //this.btn2.BorderBrush = brSilver; this.cb2.Items.Add("123"); this.cb2.Items.Add("23"); this.cb2.SelectedItem = "123"; //var th = new Thickness(); //this.cb2.BorderThickness = th; //var myBorder2 = new Border(); //myBorder2.BorderBrush = Brushes.SteelBlue; this.cb2.BorderThickness = myThickness; //this.cb2.BorderBrush = brSilver; //this.cb2.Background = brBlue; //this.cb2.Foreground = brWhite; ○コントロールを明示的に更新する using System.Windows.Threading; private void DoEvents() { DispatcherFrame frame = new DispatcherFrame(); var callback = new DispatcherOperationCallback(ExitFrames); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, callback, frame); Dispatcher.PushFrame(frame); } private object ExitFrames(object obj) { ((DispatcherFrame)obj).Continue = false; return null; } ○vba Sub aa() For line = 1 To 1 ' MsgBox (Cells(Line, 1)) fullname = Cells(line, 1) a1 (fullname) Next line End Sub Sub a1(fullname As String) Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") kekaRow = 1 kekacol = 3 fname = fso.GetFileName(fullname) folderPath = "c:\wk" col = 2 Row = 3 sRow = CStr(Row) sCol = CStr(col) ss = "'" & folderPath & "\[" & fname & "]Sheet1'!R" & sRow & "C" & sCol Cells(kekaRow, kekacol + 0) = ExecuteExcel4Macro(ss) col = col + 1 sCol = CStr(col) ss = "'" & folderPath & "\[" & fname & "]Sheet1'!R" & Row & "C" & sCol Cells(kekaRow, kekacol + 1) = ExecuteExcel4Macro(ss) kekaRow = kekaRow + 1 Set fso = Nothing End Sub ○戻り値 Environment.ExitCode = -1; p.WaitForExit(1000); MessageBox.Show(p.ExitCode.ToString()); ○Bitmapからbyte[] 配列に変換 MemoryStream ms = new MemoryStream(); bmp.Save(ms); byte[] img = ms.GetBuffer(); System.IO.FileStream fs = new System.IO.FileStream( @"C:\test.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read); //ファイルを読み込むバイト型配列を作成する byte[] bs = new byte[fs.Length]; //ファイルの内容をすべて読み込む fs.Read(bs, 0, bs.Length); //閉じる fs.Close(); ◆Windows Log 「Windows Log」内のファイルが原因となる場合も その他、チェックしておきたいのは「Windows Log」。「C:\Windows\Logs\CBS」フォルダを見ると、「CbsPersist_*****.cab」という圧縮ファイルが並んでいるはず。その下に「CbsPersist_*****.log」というファイルがあればレッドカード! 「cab」ファイルはシステムのエラーログ記録なので、あって当然(正常)。が、「log」ファイルの方は、何らかの原因で圧縮(cab化)に失敗した残骸だ。圧縮に失敗し続ける=HDDに長時間アクセスし続ける要因なので、あれば削除してしまおう。(※cabファイルまで消さないように注意!) ◆システムの保護 Windows7がインストールされたドライブ(通常はC)は「システムの保護」がデフォルトで有効なので復元ポイントは自動的に作成されます スタートメニューから「コンピューター」を右クリックし「プロパティ」をクリック ※又は「コントロールパネル」-「システムとセキュリティ」-「システム」をクリック 左ウィンドウで「システムの保護」をクリック ○ 時計回り x = x*COS(c3) + y*SIN(c3) y = -x*SIN(c3) + y*COS(c3) 反時計回り x = x*COS(ang) - y*SIN(ang) y = x*SIN(ang) + y*COS(ang) ○ using System.Drawing.Imaging; using ZXing; using System.Collections; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string[] cmds = System.Environment.GetCommandLineArgs(); string str = cmds[1]; BarcodeWriter bacodeWriter = new BarcodeWriter { // バーコードの種類 Format = BarcodeFormat.CODE_39, Options = new ZXing.Common.EncodingOptions { // サイズ Height = 100, Width = 500, //// バーコード左右の余白 Margin = 10, //// バーコードのみ表示するか //// falseにするとテキストも表示する PureBarcode = false } }; // バーコードBitmapを作成 using (Bitmap bitmap = bacodeWriter.Write(str)) { bitmap.Save(@".\barcode" + str + @".bmp"); } Close(); Application.Exit(); } } } ○ this.DataContext = new { 管理者 = new { 姓 = "岩永", 名 = "信之" }, コンテンツ = new[] { new { タイトル = "C# 入門", URL = "csharp" }, new { タイトル = "信号処理", URL = "dsp" }, new { タイトル = "力学", URL = "dynamics" }, } }; ○devenv bat devenv "E:\test\dialog1\Dialog1.sln" /rebuild 1> error.txt if errorlevel 1 goto :a1 devenv "E:\test\WpfApplication1\WpfApplication1.sln" /rebuild 1>> error.txt :a1 ○cpp/cli #include "stdafx.h" using namespace System; using namespace System::Diagnostics; //★ int main(array<System::String ^> ^args) { //Console::WriteLine(L"Hello World{0}","aaa"); String^ ss; ss = String::Format("Sample {0} {1}","abc", 123); Trace::WriteLine("1.."+ss); Trace::Indent(); Trace::WriteLine("2.."+ss); Trace::Unindent(); return 0; } ○再帰呼び出し private void Button_Click_1(object sender, RoutedEventArgs e) { foreach (Person v in treeView.ItemsSource) { Person p = SearchNode(v.Children); string s = p.Name; } } private Person SearchNode(List<Person> nodes) { if(nodes == null ) return null; Person find = nodes.FirstOrDefault(x => x.Name == "xxx"); if (find != null) { return find; } foreach (var node in nodes) { //子ノードがある時 Person node2 = SearchNode(node.Children); if (node2 != null) { return node2; } } return null; } ○デコード certutil -f -decode "入力ファイル".txt "出力ファイル".cab ○oracle トレース ALTER SYSTEM SET SQL_TRACE = TRUE トレースログをtkprofで解析する   トレース・マップ・ファイル(.trm) ログの場所 user_dump_dest core_dump_dest $ find test -exec echo foo {} \; foo test foo test/a foo test/b $ find test -exec echo foo {} + foo test test/a test/b トレースファイル XE_ora_xxxx.trc less -N [file] 過去1日間のファイル一覧 $ find *ora*.trc -mtime 0 -ls $ sudo chmod o+r XE_ora_24633.trc $ tkprof XE_ora_24633.trc ~/XE_ora_24633.trc.txt select value from v$diag_info --where name='Diag Trace' ALTER SYSTEM SET SQL_TRACE = true 〇vba 配列の初期化 Dim ss() As Variant ss = Array("a", "bc", "d") </pre>