2014年12月10日 星期三

1. Simplify Kinect code based on version 1.8 --- Audio event

Ref : AudioBasic-WPF
This example demonstrates the audio sensor application by 6 steps.

// 1. Add Ref Kinect 1.8
// 2. Add namespace
using Microsoft.Kinect;

namespace AudioAngleEx1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 3. Create Sensor object
            KinectSensor Sensor = KinectSensor.KinectSensors[0];
            // 4. Add event method
            Sensor.AudioSource.BeamAngleChanged += AudioSource_BeamAngleChanged;
            // 5. Start Sensor
            Sensor.Start();
            // 6. Start Microphone
            Sensor.AudioSource.Start();
            Console.WriteLine("Press 'Enter' then stop.");
            Console.ReadLine();

        }

        static void AudioSource_BeamAngleChanged(object sender, BeamAngleChangedEventArgs e)
        {
            Console.WriteLine("BeamAngle = {0} ", e.Angle);
        }
    }
}


2014年11月27日 星期四

WiFi connection was limited after 2014/11/27 update processes (Windows 10 Technical Preview 9879)

1. System
    Hardware: ASUS X450J Notebook
    OS : Windows 10 preview 9879
2. Issue
     WiFi can not access the hot spot and show limited as follows


3. Solution:
    3-1 Download wireless card driver from ASUS ( for Windows 8.1 )
    3-2 Install the driver (can not work properly)
    3-3 Hyper-V Manager : Virtual switch manager remove the virtual NAT binding with wireless)
    3-4 Re-build a virtual NAT binding with wireless card.



2014年11月6日 星期四

Update Server Core 2008 R2

1. The message shows

2. Download 
http://go.microsoft.com/fwlink/?LinkID=113199 
http://go.microsoft.com/fwlink/?LinkId=142906 

3. Move into a shared fold such as \\iccloud99\test








4. Remote log into server core host
5. Copy msu files from shared fold @  ICCloud99\test and Excute them.
Copy \\ICCloud99\test\*x64.msu
Wusa Windows6.0-KB956589-x64.msu -quiet
Wusa Windows6.0-KB956774-x64.msu -quiet


2014年10月30日 星期四

Cancel Hangouts Event.

Ref: https://support.google.com/plus/answer/2660446?hl=en
Desktop computer:
  1. Open Google+. Place your cursor in the top left corner for the Google+ main menu. Click Events.
  2. Place your cursor over the event card and click the  dropdown arrow.
  3. Click Delete Event
The dropdown arrow is in the event page rather than the list page.
2-1) Entering events list page
2-2 Click into the selected event
2-3 The dropdown arrow and the delete option is on this page.

2014年10月5日 星期日

Android 懶人包

ref: http://www.inote.tw/adt-bundle-setup-tutorial
1. Download Java SDK
   
2. Download Android 懶人包 (http://developer.android.com/sdk/index.html#download)

3. Install Java SDK
4. Unzip 懶人包
5. 執行 Eclipse 

2014年10月4日 星期六

Google Go 2 -- for

Ref : http://www.golang-book.com/5/index.htm

Hardware ASUS X450J
OS : Windows 8.1 Prof

1. Edit ForEx.go
//------------
package main

import "fmt"

func main() {
    i := 1
    for i <= 10 {
        fmt.Println(i)
        i = i + 1
    }
}
//---------------
5. Run ForEx.go

Google Go -- 1 (Hello World)

Ref : http://golang.org/doc/install

Hardware ASUS X450J
OS : Windows 8.1 Prof
1. Download compile
http://golang.org/dl/
2. Install go

3. Reboot
4. Edit Hello.go
//------------
package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}
//---------------
5. Run Hello.go

2014年9月14日 星期日

Kinect for Windows v2 Test - 1

1. ASUS BM6660
2. Windows 8.1
3. Kinect for Windows SDK 2.0

One Kinect sensor can support 3 application in the same time.

2014年9月11日 星期四

Leap Motion -Hello World

1. ASUS X450J
2. Windows 8.1
3. VS 2012
4. Leap Motion SDK 1.0.9+8391

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//----
// 1. Copy LeapC#.NET.4.0, Leap.DLL, LeapC#.DLL  into project folder
// 2.  Add the first one as reference and  add two others as existed items.
//----
using Leap;

namespace ConsoleEx1
{
    class Program
    {
        static void Main(string[] args)
        {
            SampleListener listener = new SampleListener();
            Controller controller = new Controller();
            controller.AddListener(listener);

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press Enter to quit...");
            Console.ReadLine();

            controller.RemoveListener(listener);
            controller.Dispose();
        }

    }
    class SampleListener : Listener
    {
        private Object thisLock = new Object();

        private void SafeWriteLine(String line)
        {
            lock (thisLock)
            {
                Console.WriteLine(line);
            }
        }

        public override void OnConnect(Controller controller)
        {
            SafeWriteLine("Connected");
        }


        //public override void OnFrame(Controller controller)
        //{
        //    SafeWriteLine("Frame available");
        //}
        public override void OnFrame(Controller controller)
        {
            Frame frame = controller.Frame();

            SafeWriteLine("Frame id: " + frame.Id
                     + ", timestamp: " + frame.Timestamp
                     + ", hands: " + frame.Hands.Count
                     + ", fingers: " + frame.Fingers.Count
                     + ", tools: " + frame.Tools.Count
                     + ", gestures: " + frame.Gestures().Count);
        }
    }
}


2014年9月3日 星期三

Schedule task (PowerShell)

Ref: http://key.chtouch.com/ContentView.aspx?P=1533
1. 控制台 系統與安全
2. 工作排程窗右側新增工作
3. 設定排程名稱

 4. 設定排程觸發時間
5. 啟用PowerShell


Notes: PowerShell.exe 檔名

2014年9月2日 星期二

機碼用在特定狀態時無效 -- Install Python 2.6.6

Ref: http://forum.gamer.com.tw/C.php?bsn=60030&snA=356116

1. Windows 8.1  user: Administrator
2. Install Python 2.6.6
    即便更改新版,仍持續出現"機碼用在特定狀態時無效"
3. 參考 Ref 改帳號
4. 改用具administratorsr角色的 帳號,安裝OK。

2014年9月1日 星期一

PowerShell Basic -- I Foreach

To start or stop VMs (W7SQLH2V1 - W7SQLH2V3)

1. Start VMs

$VM = Get-VM -Name "W7SQLH2*"
Foreach ($iVM in $VM)
{
   Start-VM -VM $iVM
}

2. Stop VMs
$VM = Get-VM -Name "W7SQLH2*"
Foreach ($iVM in $VM)
{
   Stop-VM -VM $iVM
}

3. Stop a classroom and then start another classroom
$VM1 = Get-VM -Name "W7SQL*"
Foreach ($iVM in $VM1)
{
   Stop-VM -VM $iVM
}
$VM2 = Get-VM -Name "W7eclipse*"
Foreach ($iVM in $VM2)
{
   Start-VM -VM $iVM
}

4. VMM 2008 Module import
Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager
Get-VMMServer -ComputerName serverRealName
$VM2 = Get-VM -Name "W7eclipse*"
Foreach ($iVM in $VM2)
{
   Stop-VM -VM $iVM
}

2014年8月11日 星期一

WPF Datagrid vs Access Database

<DataGrid Margin="0,30,0,0" ItemsSource="{Binding GridData}" Name="dataGrid1" CanUserAddRows="False" AutoGenerateColumns="False" RowEditEnding="dataGrid1_RowEditEnding"  >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding ID, NotifyOnTargetUpdated=True,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Header="ID" IsReadOnly="True" />
                    <DataGridTextColumn Binding="{Binding 食物名稱, NotifyOnTargetUpdated=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Header="食物名稱"/>
                    <DataGridTextColumn Binding="{Binding 熱量(Kcal), NotifyOnSourceUpdated=True, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="100" Header="熱量(Kcal)"/>
                    <DataGridTextColumn Binding="{Binding 水分(g), NotifyOnTargetUpdated=True,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Header="水分(g)"/>
                    <DataGridTextColumn Binding="{Binding 粗蛋白(g), NotifyOnTargetUpdated=True,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Header="粗蛋白(g)"/>
                    <DataGridTextColumn Binding="{Binding 粗脂肪(g), NotifyOnTargetUpdated=True,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Header="粗脂肪(g)"/>
                    <DataGridTextColumn Binding="{Binding 碳水化合物(g), NotifyOnTargetUpdated=True,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Header="碳水化合物(g)"/>
                </DataGrid.Columns>
            </DataGrid>

private void dataGrid1_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
{
               myConnection.Open();
                using (OleDbCommand cmd =
                    new OleDbCommand("UPDATE 肉類 SET
[食物名稱]='" + ((DataRowView)e.Row.Item)["食物名稱"].ToString() +
"', [熱量(Kcal)]=" + ((DataRowView)e.Row.Item)["熱量(Kcal)"].ToString() +
", [水分(g)]=" + ((DataRowView)e.Row.Item)["水分(g)"].ToString() +
" WHERE Id='" + ((DataRowView)e.Row.Item)["ID"].ToString() + "';" , myConnection))
                {
                    // Not allowed in Access database
                    //cmd.Parameters.AddWithValue("@Id", "12345");
                    //cmd.Parameters.AddWithValue("@食物名稱", "DDD");
                    //cmd.Parameters.AddWithValue("@熱量", "222");
                    //cmd.Parameters.AddWithValue("@水分", "333");
                    int rows = cmd.ExecuteNonQuery();
                    this.Title =  rows.ToString() ;
                    //rows number of record got updated
                }
                myConnection.Close();
}


2014年7月13日 星期日

Dart-2 (中文輸入)

Ref: http://ask.make-money-article.com/que/11122732
import 'dart:async';
import 'dart:io';
import 'dart:convert';

void main() {
  readLine().listen(processLine);
}

Stream readLine() => stdin
  .transform(UTF8.decoder)
  .transform(new LineSplitter());

void processLine(String line) {
  print(line);
}


2014年7月12日 星期六

Dart-1

Hello World : Command line

void main() {
  print("Hello, World!");
  // Ref: http://www.dart-tutorials.co.uk/#Tutorials/Getting-Started
  String a = "Hellow World 1";
   String b = 'Hello World 2';
   var c = "Hello World 3";
   print('$a');
   print('$b');
   print('$c');
   String a2 = "1";
   String c2 = "1";
   int b2 = 1;
   print(stringToInt(a2)==b2);
   print(a2==b2);
   print(a2==c2);
 }

 int stringToInt(String value) {
   return value.codeUnitAt(0)-48;
 }


2014年5月20日 星期二

Arduino Test1

Hardware : ASUS X450J
OS: Windows 8.1 Pro.
1. ARDUINO 0023 - 2011.11.09 (Arduino UNO)
2. Installation
2.1 disable windows 8.1 driver signature enforcement
http://www.howtogeek.com/167723/how-to-disable-driver-signature-verification-on-64-bit-windows-8.1-so-that-you-can-install-unsigned-drivers/
2.2 Installation driver


3. Test hello world.

4. Open Serial monitor



2014年5月12日 星期一

2014年4月16日 星期三

7度C

1. 需求
3x3 (1920x1080) Screen To 1x5 ( 1920+1920/3*2 ) x 360   3200x360
2. Video cover with a semi-transparency film interact with moving body.
3. Employ kinect sdk backgroudremove example.
4. First try













5. 下載

6. 測試一版下載

7. 測試2版下載 (X.Top=0)

8. 測試3版下載 (Fine tune and slightly modification)



2014年4月5日 星期六

Kinect 1.8 Interaction

Hardware: ASUS X450J, XBOX360
OS: Windows 8.1
Tools: VS2012 + Kinect SDK1.8
1) Prepare
    KinectInteraction180_32.dll
    KinectInteraction180_64.dll
    Microsoft.Kinect.Toolkit.Controls.dll
   Microsoft.Kinect.Toolkit.Interaction.dll
2) Add Ref:
    Microsoft.Kinect (1.8)
   Microsoft.Kinect.Toolkit.Controls.dll
   Microsoft.Kinect.Toolkit.Interaction.dll
3) Add Existed items
    KinectInteraction180_32.dll
    KinectInteraction180_64.dll
4) xaml
<Window x:Class="WPFS1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:k="http://schemas.microsoft.com/kinect/2013"
        Title="MainWindow" Height="350" Width="525"
        Closing="WindowClosing">
    <Grid>
        <k:KinectUserViewer k:KinectRegion.KinectRegion="{Binding ElementName=kinectRegion}" Height="100" HorizontalAlignment="Center" VerticalAlignment="Top" />
        <k:KinectSensorChooserUI HorizontalAlignment="Center" VerticalAlignment="Top" Name="sensorChooserUi" />
        <k:KinectRegion x:Name="kinectRegion">
            <k:KinectTileButton Label="Press Me" Click="KinectTileButton_Click" />
        </k:KinectRegion>
    </Grid>
</Window>
   5) C#
 public MainWindow()
        {
            InitializeComponent();
            this.sensorChooser = new KinectSensorChooser();
            this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
            this.sensorChooserUi.KinectSensorChooser = this.sensorChooser;
            this.sensorChooser.Start();

            // Bind the sensor chooser's current sensor to the KinectRegion
            var regionSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
            BindingOperations.SetBinding(this.kinectRegion, KinectRegion.KinectSensorProperty, regionSensorBinding);
        }
 private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.sensorChooser.Stop();
        }

        private void KinectTileButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.Title != "Press")
            {
                this.Title = "Press";
            }
            else
            {
                this.Title = "Again?";
            }
        }
6) 下載(請自行加入KinectInteraction180_32 and _64.dll files)

2014年3月20日 星期四

PowerShell Import-Module for VMM2012

In order to execute commands of SCVMM 2012 R2, the procedure is :
1. Execute powershell by administrator
2. ps> Set-ExecutionPolicy remotesigned
3. ps> Import-Module "C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager.psd1"

2014年3月18日 星期二

Windows 8.1 + VS2012 開發市集(Window Store)應用程式在目標機器上測試程序

1. Prepare 'Windows Store App' program.
2. VS 2012 建立應用程式
 3. 自行測試

 4. Settings
 5. 建置完成
 6. 產生套件(安裝)目錄與PowerShell批次指令程式
 7. 複製到目標電腦,安裝後執行


2014年1月31日 星期五

Google TTS by WPF C#

1. OS: Windows 8.1
2. Tool: Visual Studio 2012
3. Coding
WPF :
<Window x:Class="WPFGoogleTTS.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" >
    <StackPanel>
        <TextBox Name="tb1" Height="30" Width="300" >這是一個測試</TextBox>
        <Button Name="btn1" Click="btn1_Click" Width="150" Height="50" ></Button>
        <MediaElement Name="med1" Width="20" Height="20" LoadedBehavior="Manual" >
           
        </MediaElement>
    </StackPanel>
</Window>
C# :
namespace WPFGoogleTTS
{
    /// <summary>
    /// MainWindow.xaml 的互動邏輯
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void btn1_Click(object sender, RoutedEventArgs e)
        {
            var chinese = "這是一個測試。";
            string pathx = "http://translate.google.com/translate_tts?ie=UTF-8&tl=zh-TW&q=" + tb1.Text ;
            Uri u = new Uri(pathx, UriKind.RelativeOrAbsolute);
            med1.Source = u;
            med1.Play();
        }
    }
}

2014年1月12日 星期日

emgu-無法載入 DLL 'opencv_core290': 找不到指定的模組

1. Hardware : ASUS X450J, OS: WIndows 8.1(x64)
2. Tools: VS2012
3. Error as title.
4. Solve by emgu wiki solution
    copy C:\Emgu\emgucv-windows-universal-cuda 2.9.0.1922\bin\x64 folder into
    VS2012 Project xxx/bin/.debug

2014年1月9日 星期四

Kinect ShapeGame 中文化

1. Kinect SDK 1.8 ShapeGame 範例,VS2012 @ Windows 8 ASUS X450J
2. MSSpeech_SR_zh_TW_Tele.msi V11, 微軟已不開放下載 http://www.vdisk.cn/down/index/10996836
3. 修改 SpeechRecognizer.cs
 private static RecognizerInfo GetKinectRecognizer()
        {
            //Func<RecognizerInfo, bool> matchingFunc = r =>
            //{
            //    string value;
            //    r.AdditionalInfo.TryGetValue("Kinect", out value);
            //    return "True".Equals(value, StringComparison.InvariantCultureIgnoreCase) && "en-US".Equals(r.Culture.Name, StringComparison.InvariantCultureIgnoreCase);
            //};
            //return SpeechRecognitionEngine.InstalledRecognizers().Where(matchingFunc).FirstOrDefault();
            // 中文化
            RecognizerInfo SPE = SpeechRecognitionEngine.InstalledRecognizers()[0];
            for (int i = 0; i < SpeechRecognitionEngine.InstalledRecognizers().Count; i++)
            {
                if (SpeechRecognitionEngine.InstalledRecognizers()[i].Culture.Name == "zh-TW")
                {
                    SPE = SpeechRecognitionEngine.InstalledRecognizers()[i];
                    break;
                }
            }
            return SPE;
        }
4.
5. 下載



2014年1月5日 星期日

Kinect Skeleton Raw

Ref: Kinect for Windows SDK 1.8
1. Try to get skeleton raw data in a few statements.
2. Procedure
2-1 Add reference
2-2 using namespace
2-3 add data into a Access data table
3. Coding
// 1. Add Ref, using
using Microsoft.Kinect;
using System.Data.OleDb;

namespace WPFSkeletonRaw
{
    /// <summary>
    /// MainWindow.xaml 的互動邏輯
    /// </summary>
    public partial class MainWindow : Window
    {
        // 2.
        KinectSensor sensor;
        OleDbConnection conn = new OleDbConnection();
         
        public MainWindow()
        {
            InitializeComponent();
            // 3.
            sensor =  KinectSensor.KinectSensors[0];
            sensor.SkeletonStream.Enable();
            sensor.SkeletonFrameReady += sensor_SkeletonFrameReady;
            sensor.Start();
            sensor.ElevationAngle = 10;
            conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database1.accdb";
            conn.Open();
            for (int i = 0; i < 20; i++)
                for (int j = 0; j < 3; j++)
                {
                    TranslateTransform TR = new TranslateTransform(j * 100, i * 30);
                    txtbx[i, j] = new TextBox();
                    txtbx[i, j].Width = 90;
                    txtbx[i, j].Height = 25;
                    txtbx[i, j].RenderTransform = TR;
                    Can1.Children.Add(txtbx[i, j]);
                }


        }

        TextBox[,] txtbx = new TextBox[20, 3];

        void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
       
            Skeleton[] skeletons = new Skeleton[0];

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    skeletonFrame.CopySkeletonDataTo(skeletons);
                }
            }
         
                foreach (Skeleton skeleton in skeletons)
                {
                    if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                    {
                        //DrawTrackedSkeletonJoints(skeleton.Joints);
                        for (int i=0; i<20; i++)
                        {
                            string x, y, z;
                            x = skeleton.Joints[(JointType)i].Position.X.ToString();
                            y = skeleton.Joints[(JointType)i].Position.Y.ToString();
                            z = skeleton.Joints[(JointType)i].Position.Z.ToString();
                            txtbx[i, 0].Text = x;
                            txtbx[i, 1].Text = y;
                            txtbx[i, 2].Text = z;
                          OleDbCommand cmmd = new OleDbCommand("INSERT INTO JointTrace (JointNumber, X,Y,Z) Values("
                            + i.ToString() + ", " + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ")", conn);
                          cmmd.ExecuteNonQuery();
                                      }
                    }
                    else if (skeleton.TrackingState == SkeletonTrackingState.PositionOnly)
                    {
                        //txtbk.Text += skeleton.Joints[0].Position.ToString() + "\r\n";
                    }
                }

        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            sensor.SkeletonStream.Disable();
            sensor.Stop();
            conn.Close();
        }
    }

4. Example
    Example